Redirect if $_Server['REQUEST_URI'] is /wp-login.php?checkemail=registered

This question extents the question Redirect to custom url when registration fails?: In his comment He Shiming noted.. > that to redirect the user on a successful registration, one has to > `add_action` for `login_head` and check whether `$_SERVER['REQUEST_URI']` is > `/wp-login.php?checkemail=registered`, and redirect to the correct one. > Supposably there's a filter named `registration_redirect`, but it doesn't > work I'm trying to translate this into code, here's what I got:               function redirect_after_success() {            if ($_SERVER['REQUEST_URI']=='/wp-login.php?checkemail=registered'){               $redirect_url = get_bloginfo('url') . '/register';          wp_redirect( $redirect_url );       exit;     }     }     add_action('login_head','redirect_after_success');      This function doesn't seem to be correct. I still get redirected to `http://../register/?login=failed` even after successful registrations. Here are the other functions that handle incomplete/invalid registrations:                // hook failed login     add_action('wp_login_failed', 'my_frontend_login_fail');           function my_frontend_login_fail($username){         // Get the reffering page, where did the post submission come from?         $referrer = add_query_arg('login', false, $_SERVER['HTTP_REFERER']);              // if there's a valid referrer, and it's not the default log-in screen         if(!empty($referrer) && !strstr($referrer,'wp-login') && !strstr($referrer,'wp-admin')){             // let's append some information (login=failed) to the URL for the theme to use             wp_redirect($referrer . '?login=failed');          exit;         }     }          //hook empty login submit     add_action( 'login_head', 'my_frontend_login_no_pass_no_username' );          function my_frontend_login_no_pass_no_username(){         $referrer = add_query_arg('login', false, $_SERVER['HTTP_REFERER']);         if ( (!isset($_REQUEST['user_login']) || ( isset( $_REQUEST['user_login'] ) && trim( $_REQUEST['user_login'] ) == '' ) ) || (!isset($_REQUEST['user_pass']) || ( isset( $_REQUEST['user_pass'] ) && trim( $_REQUEST['user_pass'] ) == '' ) ) ){             wp_redirect( add_query_arg('login', 'failed', $referrer) );              exit;          }        }               // unsuccessfull registration     add_action('register_post', 'binda_register_fail_redirect', 99, 3);          function binda_register_fail_redirect( $sanitized_user_login, $user_email, $errors ){         //this line is copied from register_new_user function of wp-login.php         $errors = apply_filters( 'registration_errors', $errors, $sanitized_user_login, $user_email );         //this if check is copied from register_new_user function of wp-login.php         if ( $errors->get_error_code() ){             //setup your custom URL for redirection             $redirect_url = get_bloginfo('url') . '/register';             //add error codes to custom redirection URL one by one             foreach ( $errors->errors as $e => $m ){                 $redirect_url = add_query_arg( $e, '1', $redirect_url );                 }             //add finally, redirect to your custom page with all errors in attributes             wp_redirect( $redirect_url );             exit;            }     }


Filter Text from sidebar widget?

Hey guys, I'm using a calendar plugin that provides a sidebar widget to show current calendar dates. However this widget always shows N/A if I don't set a category for a specific event. Any idea how I could add a filter to that widget and match N/A and remove it? thank you for your help


Which Function Displays The Post Authors Gravatar

I am using:               echo get_avatar(get_the_author_id(), 30);      Which works, however i am getting this notice to use:               echo get_avatar(get_the_author_meta(), 30);      Which doesn't display the authors Gravatar image, just the Gravatar default image. > `**Notice:** get_the_author_ID is deprecated since version 2.8! Use > get_the_author_meta('ID') instead. in > C:\Users\Administrator\Desktop\www.wpsites.dev\wp-includes\functions.php on > line 2908` So my question is, what should i use to display the posts author Gravatar?


How can I create an auto-populated menu that is automatically assigned to a location?

I'm trying to add BuddyPress nav menu support to my theme and, unfortunately, BP's template tags still aren't fully up to snuff. (Basically, if you're not making an explicit child theme for the BP Default theme, you've got to reinvent several wheels.) So what I'd like to do is   1. Detect when BP is active (I know how to do this)   2. Register a menu position when BP is active (also a known quantity)   3. Create a default menu containing links to the BP sections ( **this is where the hole in my knowledge exists** )   4. Assign said default menu to the newly-registered position So, essentially, with my theme active, if a user activates BuddyPress, they'll automatically get a menu with Members, Forums, Activity, etc. and it will be displayed to a position, **but** if users wanted to override the menu, they would be free to do so. Thoughts? **EDIT 1** Bainternet wins the prize. Here's what I did, slightly modified from his solution: I conditionally registered a menu location               if( function_exists( 'bp_get_loggedin_user_nav' ) ){         register_nav_menu( 'lblgbpmenu', 'Default BuddyPress Menu' );     }      I then conditionally hooked in a call to the menu setup               if( function_exists( 'bp_get_loggedin_user_nav' ) ){         add_action( 'widgets_init', 'lblg_add_default_buddypress_menu' );     }      Then, last of all, I actually registered the menu               function lblg_add_default_buddypress_menu(){         global $lblg_themename;         $menuname = $lblg_themename . ' BuddyPress Menu';         $bpmenulocation = 'lblgbpmenu';         // Does the menu exist already?         $menu_exists = wp_get_nav_menu_object( $menuname );              // If it doesn't exist, let's create it.         if( !$menu_exists){             $menu_id = wp_create_nav_menu($menuname);                  // Set up default BuddyPress links and add them to the menu.             wp_update_nav_menu_item($menu_id, 0, array(                 'menu-item-title' =>  __('Home'),                 'menu-item-classes' => 'home',                 'menu-item-url' => home_url( '/' ),                  'menu-item-status' => 'publish'));                  wp_update_nav_menu_item($menu_id, 0, array(                 'menu-item-title' =>  __('Activity'),                 'menu-item-classes' => 'activity',                 'menu-item-url' => home_url( '/activity/' ),                  'menu-item-status' => 'publish'));                  wp_update_nav_menu_item($menu_id, 0, array(                 'menu-item-title' =>  __('Members'),                 'menu-item-classes' => 'members',                 'menu-item-url' => home_url( '/members/' ),                  'menu-item-status' => 'publish'));                  wp_update_nav_menu_item($menu_id, 0, array(                 'menu-item-title' =>  __('Groups'),                 'menu-item-classes' => 'groups',                 'menu-item-url' => home_url( '/groups/' ),                  'menu-item-status' => 'publish'));                  wp_update_nav_menu_item($menu_id, 0, array(                 'menu-item-title' =>  __('Forums'),                 'menu-item-classes' => 'forums',                 'menu-item-url' => home_url( '/forums/' ),                  'menu-item-status' => 'publish'));                  // Grab the theme locations and assign our newly-created menu             // to the BuddyPress menu location.             if( !has_nav_menu( $bpmenulocation ) ){                 $locations = get_theme_mod('nav_menu_locations');                 $locations[$bpmenulocation] = $menu_id;                 set_theme_mod( 'nav_menu_locations', $locations );             }              }      }


How to enable %postname% permalinks on Mac?

I'm using Mac OS X's built in Apache + PHP with MySQL. Everything works perfectly, except for my pretty %postname% permalinks — they just won't work. I have obviously enabled mod_rewrite and set the AllowOverride setting to All on my httpd.conf file. In case there's anything I can do (I really don't want to run MAMP), is there any programmatic way to use default permalinks on localhost using the very same template files?


Combining these queries? (Same taxonomy term + same category as post)

I´m not to good at coding so I could use some help with this! I have a single page which below the post shows more posts from the same category. Then I have another single page which in a similare fashion shows more posts from the same taxonomy term as the current post. I would like to combine this to show posts from the same category and taxonomy term as the current post. Code for "same taxonomy term": http://pastebin.com/ebpbzfNi Code for "same category" : http://pastebin.com/kB0n49Bd If someone would help me with this I would be very grateful!


query to create woocommerce products from images

I have hundreds of art images in my WP media library, each of which I want to convert into a woocommerce product, and set as featured image of that product. Rather than manually adding new products and setting featured images, which would take days of repetitive work, is there a way to do this automatically in MySQL?


Custom query Custom-Post-Types creates error

I created a custom-post-type for members of a firm. On the start-page I tried to call them via custom query but it shows an error. Heres my code: http://pastebin.com/rRzNcqPP and the error says: Call to a member function get_queried_object() on a non-object in /www/htdocs/w00e3b6a/hosting/basecamp/wp-includes/query.php on line 43 What did I wrong with the query?


How do make Wordpress to let alone my static home page?

I want to install wordpress in the root of an existing site, and temporarily use my new installation home as /home, while the rest of the static site is still there find-able by visitors/google. I don't know how to "tell" wordpress to stop trying to handle/capture/mess with the root main page (rewrite rules? .htaccess redirection?, custom template?)


IF user is logged in only show certain page

I have this wordpress site that I am making where a user has to login to see their specific gallery. My problem is that all our users are members and all the members can see all the other member pages. It's kind of hard to explain so I'll link you guys to what I have. Once this client is logged in and you hover over "Members" > "Members Page" you can see the other clients galleries clear, even though they both need passwords. How do I hide all other pages? I thought about making page titles the same as the client name but that might be too much of an inconvenience. Any suggestions or help on this?   * I thought that comparing userID with galleryID would work, but only in a perfect world. 1 mishap and the whole comparison would be off.    * I then thought comparing title with username but the odds of a misspelling are too great and I have a feel would cause much frustration.


how to refresh wordpress permalink settings? (without admin panel)

I changed permalinks in wp_options table in database and I'm getting 404 on every post. Everything works fine after I log in into the panel and click "save settings" on permalinks options page. How to do this automatically (ie. "refresh" those settings)?


Wordpress 3.5 - Add custom image size

Since the new version of Wordpress (3.5), it seems to be an incompatibility between the image manager and the custom image sizes. Previously I used in my functions.php :               add_action( 'after_setup_theme', 'addemo_setup' );           function addemo_setup() {         add_theme_support( 'post-thumbnails' );            add_image_size( 'featured-image', 375, 500, true );       }          // Insert Custom Sized Image Into Post Using Media Gallery     add_filter( 'image_size_names_choose', 'custom_image_sizes_choose' );       function custom_image_sizes_choose( $sizes ) {           $custom_sizes = array(               'featured-image' => 'Featured Image'           );           return array_merge( $sizes, $custom_sizes );       }      When I add a thumbnail, I don't have any choice. Does anyone has encountered this problem ?


need correction with a snippet in functions.php

I use gravity forms and wp-favorites plugin (helps users select their favorite posts). I am trying to auto-populate gravity form with the following snippet. It works pretty well but it shows only the first item in the list. How can I get all items in the array?               add_filter("gform_field_value_circle", "populate_square");     function populate_square ($value) {         $favs = wpfp_get_users_favorites();         foreach ($favs as $fav){             $list = get_the_title($fav);         }         return $list;     }      This snippet shows me the title of the first selected post only. I would like to get a list of all the selected posts, how do I acheive that ? FYI, I am trying to make use of the HOOK provided by gravity forms. You can see the code here. Pleae let me know if I need to be more clear.


How to correctly load wordpress in a non WP script for AJAX request

I want a script in my theme, ajax.php, which I want to load or access from other frontend pages using ajax. In ajax.php I want access to core WP functions such as get_posts(), do_shortcode() etc. I.e. I need WordPress loaded on the script. Traditionally I have setup a page in the admin and given it a custom template so then for my ajax requests I can send to www.site.com/ajax and the custom template handles the request. While this works fine I'm pretty sure this is not the most efficient, or safest way of handling ajax on WP frontend but not sure how to do it properly. Thanks.


Proper indentation of code generated inside hooks

I really like having my code all properly indented and all, but all the code generated by wordpress, like the one that appears on the header when we use wp_head(), loses all the indentation. I think it doesn't really matter, neither the users nor the search engines give a s**t about the code being indented or not, but when it comes to debugging, it really helps a lot. Do you know of any plugin or option or something to fix this?


LEFT JOIN, INNER OUTER JOIN, LEFT OUTER JOIN is driving me crazy. Please help?

fellow coders! I an having a hard time JOIN(ing) tables. I have a a lot of users on my site and many of them have the same last names. I am trying to get their emails by their last name. WP stores emails in the users table and user names in the usermeta and I have been trying to use JOIN to get what I want, but I don't understand how it works and I am about to give up for the day. This is what i have after 4.5 hours.               $usersemails = $wpdb->get_results("SELECT users.user_email, usermeta.meta_value      FROM $wpdb->users     LEFT JOIN $wpdb->usermeta ON $wpdb->users.ID = $wpdb->usermeta.user_id          WHERE user_status = '0'          AND meta_value = 'Smith'");      Any help is appreciated, so can you please help? Thanks.


Is sanitize_title_with_dashes formatting function too liberal (in terms of accepted characters)?

`sanitize_title_with_dashes` (see code below for reference) is the function Wordpress uses to format "pretty" urls. However, contrary to the function's comment header, it allows much more than alphanumeric characters, underscore (_) and dash (-). It also allows signs like °, etc. How would I go about really allowing only alphanumeric characters and dashes?               /**      * Sanitizes title, replacing whitespace with dashes.      *      * Limits the output to alphanumeric characters, underscore (_) and dash (-).      * Whitespace becomes a dash.      *      * @since 1.2.0      *      * @param string $title The title to be sanitized.      * @return string The sanitized title.      */     function sanitize_title_with_dashes($title) {         $title = strip_tags($title);         // Preserve escaped octets.         $title = preg_replace('|%([a-fA-F0-9][a-fA-F0-9])|', '---$1---', $title);         // Remove percent signs that are not part of an octet.         $title = str_replace('%', '', $title);         // Restore octets.         $title = preg_replace('|---([a-fA-F0-9][a-fA-F0-9])---|', '%$1', $title);              $title = remove_accents($title);         if (seems_utf8($title)) {             if (function_exists('mb_strtolower')) {                 $title = mb_strtolower($title, 'UTF-8');             }             $title = utf8_uri_encode($title, 200);         }              $title = strtolower($title);         $title = preg_replace('/&.+?;/', '', $title); // kill entities         $title = str_replace('.', '-', $title);         $title = preg_replace('/[^%a-z0-9 _-]/', '', $title);         $title = preg_replace('/\s+/', '-', $title);         $title = preg_replace('|-+|', '-', $title);         $title = trim($title, '-');              return $title;     }


get_term_by with a variable

I have a Custom template with a custom query. I want to use additional information about the current taxonomy > description and name (and use it in the HEAD, desc, keywords, etc...)               <?php      $productvariable = $_GET['product'];          $term = get_term_by('slug', $productvariable, 'mytaxonomy');     $mytitle = $term->name;     $mydesc = $term->description;     ?>        * How do i make the variable safe from url to get_term_by ($value)?   * And what if there is no match is it possible to use ELSE?   * Is it possible to use the values inside HEAD (header.php)? > Is there a security issue when using a GET variable from url with > get_term_by?


Add a Custom Field in Comment Box next to the Text area

Good Day. I Recently try to figure out for adding the custom field in the comment box it working fine. Still I need to know how to add the custom field after the comment box. I am not sure how to do this. add_filter('comment_form_defaults', 'change_comment_form_defaults');               function change_comment_form_defaults($default) {              $commenter = wp_get_current_commenter();              $default['fields']['comment'] .= '
' .                 '     <input type="checkbox" style="margin:0px;height:auto;width:auto; position:relative;" name="privacy" value="1"/> I agree to the Terms of Use and Privacy Policy
';         return $default;     }      When i Tried this above code this way itself is appear. ![enter image description here](http://i.stack.imgur.com/ICKDY.png) How can i do this to show this field next to the comment box. Any suggestion would be great. **EDITED:** ![enter image description here](http://i.stack.imgur.com/rOzqN.png)


Using categories & "stickyness" together

I've got a custom query on my homepage showing all posts in a certain category. I need this query to respect sticky posts, but it seems from my research that category queries ignore stickyness. My question is two (and a half) fold:   1. Can anyone tell me where/how in the database stickyness is applied to a post? I don't see it in `wp_postmeta` or `wp_posts`. **This one is most important and will probably be enough to get you the ~~win~~ accepted answer.**   2. Is there any simple elegant way to grab sticky posts only from a certain category?   3. If not, then how about an ugly way to do it? Just for the heck of it, here's my query, though I think it won't make a difference to the answer.               $getHighlights = array(         'posts_per_page' => 7,         'post_type' => array('post','Event'),         'category_name' => 'Highlights',      );      _Sorry for the long title, but I wanted to be clear what I was asking for._


Call to undefined method - Download Monitor

I have been working on adding some customizations to Download Monitor So far I have been able to add custom meta check boxes, and save them using the following code.               global $post, $download;          //add additional meta to download monitor post screen.     function add_custom_dm_options( $post ) {             global $post, $thepostid;             $thepostid = $post->ID;                  echo '
                 <input type="checkbox" name="_act_sub" id="_act_sub" ' . checked( get_post_meta( $thepostid, '_act_sub', true ), 'yes', false ) . ' />                 ' . __( 'Active Subscriber', 'download_monitor' ) . '                 ' . __( 'This download is only for users who belong to the Active Subscriber Role.', 'download_monitor' ) . '
';              }     add_action( 'dlm_options_end', 'add_custom_dm_options' );          //save additional meta on download monitor post.     function save_custom_dm_options( $post_id, $post ) {       $_act_sub = ( isset( $_POST['_act_sub'] ) ) ? 'yes' : 'no';       update_post_meta( $post_id, '_act_sub', $_act_sub );     }     add_action( 'dlm_save_meta_boxes', 'save_custom_dm_options', 1, 2 );      The next step is to determine if the user is logged in and that the post was saved with _act_sub. Here is the code I am using:               //new rules using the act_sub post meta check and the active_subscription user role.      function subscription_access( $post, $download ) {                  if ( $download->is_act_sub() && ! is_user_logged_in() )                 $can_download = true;                  return $can_download;         }     add_filter( 'dlm_can_download', 'subscription_access', 1, 2 );      This code is all on the same function file so it also uses the globals previously stated. When I dump the $download variable I get: pastebin I can use the built in meta key of _members_only just fine but I have not been able to use my custom meta key. I checked the database ad everything is saving properly. Can anyone help me determine if there is some syntax issues? Plugin - Download Monitor Custom Plugin - The code above


how to create a conditional content_width for a wordpress theme?

I'm trying to create a conditional statement for the content width in the functions.php of my theme. So some categories will have a content_width of 580, some will have 900. This will make the oEmbed work correctly wherever it's used. Usually, you would have this in your functions.php:               if ( ! isset( $content_width ) )          $content_width = 900;      I want something like this:               if(in_category(array('news','blog'))) {        $content_width = 580;     }      elseif(is_page()) {        $content_width = 580;     }     else {        $content_width = 900;     }      When I have this in my functions.php the content width becomes whatever I write in the last line. Am I missing something? Is this even possible? Thanks!


Clear Cart with Wordpress E-commerce plugin

I added a Merchant to the Wordpress E-commerce plugin.   I want on the submit, after doing my curl() call, to clear the cart   How do I do that?      (link to plugin page)


How can I attach images to a post from the media library?

Currently, there is no way to do this in a vanilla Wordpress install. Is there a way to retroactively attach an image from the Library to a post? EDIT: Ah, let me clarify — when editing a post, and clicking the "Insert Media" button, I see no way to add past media. I can insert it into the post, but not add it to the post gallery.


What other plugins are there available to track app performance for wordpress?

I came across this post earlier this year, showing how various plugins affect the performance of a wordpress install, by using a tracker class to measure how long each plugin takes to execute each time a page is loaded: http://www.dev4press.com/2011/blog/benchmark/measuring-impact-of-plugins-on- wordpress-loading In that article, they did it using part of plugin that's available as part of paid bundle from GD Press. Are there other alternative plugins that also let you find the bottlenecks in your own code, in production, without resorting to using NewRelic, or something complex, like running webgrind or an equivalent for local development?


How can I populate a select element with terms from a custom taxonomy and filter post results?

Alright, so first, I need you to check out this wire-frame so you can see what I'm trying to accomplish: Wire-frame What I've done so far is this:   1. I created a custom post type for individual addresses.   2. I created a hierarchical custom taxonomy where the "parent categories" are States, and the "child categories" are Cities.   3. I've used the following code to populate the first select element:              <select name="states" id="states" class="etc">     <?php  $terms = get_terms('area', 'parent=0');         $count = count($terms);         if ( $count > 0 ){             foreach ( $terms as $term ) {                 echo '<option value="' . $term->name . '">' . $term->name . '</option>';             }         }     ?>     </select>      So here's what I need to know:   1. How do I populate the second select element based on which parent is selected in the first?   2. How do I use these select elements to filter my custom posts?


Parse error: syntax error, unexpected

I get this error when I enter data in my form Parse error: syntax error, unexpected T_CONSTANT_ENCAPSED_STRING in \functions.php on line 77               return 'Views''$count.';      ==== Whole function===               function getPostViews($postID){     $count_key = 'post_views_count';     $count = get_post_meta($postID, $count_key, true);     if($count==''){         delete_post_meta($postID, $count_key);         add_post_meta($postID, $count_key, '0');         return "0 View";     }     return $count. 'Views''views';     }


Override typo in multiple parent theme files?

I'm using the lovely Imbalance theme from WPShower. I am able to make almost all the modifications I need through files and filters in the child theme I created. However, there is a typo that appears in multiple files:               <?php printf(__('Filled under: %s'), get_the_category_list(', ')); ?>
      This line is in archive.php. attachement.php, archive.php, and single.php. Is there a way to change "Filled under" to something like "tags" without directly editing the parent theme files? Thanks!


Buddypress Group creation step reordering

If someone can help me out in changing the Steps of group creation I would really appreciate it. The group creation steps are 1. Group details 2. Group Settings 3. Group avatar 4. Invites Can I change this to 1. Group Details 2. Invites 3. Group Settings 4. Group avatar please note Invite is original step 4 which I like to be on step 2. I tried playing around in bp-custom.php but dint helped. Is it possible?


Image crop, resize and compression plugin?

I've been looking through the plugins to find one that will allow the user to resize & crop images within WP. This has been the one area that clients struggle with - mainly those who don't have any photo editing software on their computers. Also, if there's one that deals with some kind of image compression options then that would be great as some clients have put some huge images on pages. Has anyone got any pointers or experience with any of the plugins out there to do this? **Update:** Image rotation would be nice too!


How to organize a WP_Query's list of posts by category and display category title?

If I run a query with some args and get a list of posts, how can I organize the posts separated by category and display the title of each category?               $array_out = array();          $args = array(      'orderby' => 'title',     'order' => 'ASC',      );          $the_query = new WP_Query( $args );     while ( $the_query->have_posts()) : $the_query->the_post();           $terms = get_the_terms( $post->ID, 'category');      foreach($terms as $term){         $term_link = get_term_link($term, 'category');         $array_out[] = '
'.$term->name.'
';     }     endwhile;           $array_clean = array_unique($array_out);          foreach($array_clean as $array_single){          echo $array_single;          }      This gets me a list of unique category terms for all my posts with no duplicates. Im stuck from here though as I would like to list all the posts of the query grouped by the terms I got. The point is I do not want to get all the category terms first then query posts for each term, like I have seen suggested elsewhere. I need to do it after I get a list of posts from a query. So I thought   1. Query for posts with some args   2. while loop through posts to find list of terms of categories   3. Array_unique found terms because there will be duplicates   4. Then query for posts again for each category term found in step 2 Would this work? Im not exactly sure what Im doing as Im new. I just want to be able to: No matter what posts I'm querying for with arguments of my choice to put out a list of posts grouped by category terms separated by term name. Is it hard to understand what I'm asking for? I dont know how else to put it.


Custom post type - update_meta not working

I'm sure this must be something simple, but I can't for the life of me work out why this isn't working.               if (!class_exists('FeaturedItem')) :          class FeaturedItem {              var $plugin_url;              function FeaturedItem()         {             $this->plugin_url = trailingslashit(plugins_url('sf-featured-items'));         }              function enqueue_scripts() {             /* start of replacement tinyMCE instance             wp_register_script('cleditor', $this->plugin_url .'cleditor/jquery.cleditor.min.js', array('jquery'));             wp_enqueue_script('cleditor'); */         }              function enqueue_styles() {             /* Image upload styles             wp_enqueue_style('thickbox'); */         }              function register_featured_item(){                  $labels = array(               'name' => _x('Featured Item', 'post type general name'),               'singular_name' => _x('Featured Item', 'post type singular name'),               'add_new' => _x('Add New', 'profile'),               'add_new_item' => __('Add New Featured Item'),               'edit_item' => __('Edit Featured Item'),               'new_item' => __('New Featured Item'),               'view_item' => __('View Featured Item'),               'search_items' => __('Search Featured Items'),               'not_found' =>  __('No featured items found'),               'not_found_in_trash' => __('No featured items found in Trash'),               'parent_item_colon' => '',               'menu_name' => 'Featured'                  );             $args = array(               'labels' => $labels,               'public' => true,               'publicly_queryable' => false,               'exclude_from_search' => true,                   'show_ui' => true,               'show_in_menu' => true,               'query_var' => true,               'rewrite' => false,               'capability_type' => 'post',               'has_archive' => false,               'hierarchical' => false,               'menu_position' => 50,               'menu_icon' => $this->plugin_url . 'images/star.png',               'supports' => array('title','editor','thumbnail')             );                  register_post_type('featured-item', $args);         }              function meta_link(){             global $post;                  if ($post->ID) {                 $link_to_post = get_post_meta( $post->ID , 'link_to_post', TRUE );             }                  ?>

Make sure you use the permalink (i.e. written link) rather than the short link (numeric).
             <input type="text" name="link_to_post" class="range" value="<?php if (isset($link_to_post)) { echo esc_attr($link_to_post); } ?>" />
             <?php         }              function register_featured_meta(){             add_meta_box("link_to_post", "Link to Post", array($this, 'meta_link'), "featured-item", "normal", "core");         }              function update_featured_meta(){             global $post;                  if ($post) {                 /* when Trashing a custom post type, it fires the save_post mechanism.                    running a hidden nonce allows the Trash mechanism to ignore all of the                    update_post_meta functions */                 if (isset($_POST['featured-item_trash_nonce'])) {                     $nonce = $_POST['featured-item_trash_nonce'];                 } else {                     $nonce = NULL;                 }                      if (!wp_verify_nonce($nonce, plugin_basename(__FILE__).$post->ID)) {                     return $post->ID;                 }                      // Taxonomy meta                 update_post_meta( $post->ID, "link_to_post", $_POST["link_to_post"] );             }         }          }          else :         exit("Class FeaturedItem already exists.");     endif ;          /* INSTANCE CLASS */     if (!isset($FeaturedItem)) {         $FeaturedItem = new FeaturedItem();     }          if (isset($FeaturedItem)) {         add_action( 'init' , array (&$FeaturedItem, 'register_featured_item' ));         add_action( 'admin_enqueue_scripts', array (&$FeaturedItem, 'enqueue_scripts' ));         add_action( 'admin_enqueue_scripts', array (&$FeaturedItem, 'enqueue_styles' ));         add_action( 'admin_init' , array( &$FeaturedItem, 'register_featured_meta' ));         add_action( 'save_post' , array( &$FeaturedItem, 'update_featured_meta' ));     }      I have other CPTs which work using very similar code. What have I done wrong this time?


Creating author Specific page URL

My Question is almost similar to author-specific-urls-in-wordpress and mapping-multiple-urls-to-same-page-in-wordpress. And i have followed the following steps   1. Created a custom page (writer.php)   2. Associated that page from dashboard since all the writer are not being registered with word-press so WP build in author functionality is not of any help for me. So i created a custom URL something like               $author_page_url = home_url( '/' );     $author_page_url .='writer/'.$author_id[0];      where `author_id` is being fetched from the database.i have following entry in my function.php               add_action('init', 'add_my_rule');               function add_my_rule()     {                     global $wp;                  $wp->add_query_var('args');                    add_rewrite_rule('writer\/(.*)','index.php?pagename=writer&                                args=$matches[1]','top');                      }      and on writer.php i am doing something like               $params = get_query_var('args');                  $ppp = get_option('posts_per_page');                 if (!is_paged()) {                         $custom_offset = 0;                 } else {                     $custom_offset = $ppp*($paged-1);                    }                 $args = array( 'meta_key' => 'writer', 'meta_value' => $params                             ,'numberposts' => $ppp,'offset' => $custom_offset);                 $authorposts=get_posts($args);      My problem is when i am hitting the following URL `http://localhost/blog/wordpress/writer/umesh-awasthi` WP is giving me 404 Error.while the URL `http://localhost/blog/wordpress/writer/` is working perfectly fine. Initialy when i developed this, it was working fine and now i have no clue what is going wrong. Can any one help me to debug the problem.Thanks in advance. **Update** My initial doubt is that the rewrite rule is not working but not sure why


Pagination is not working correctly there is this wierd looping

I am working with a developer who recently updated my site to 3.3.1 My site is http://www.pagesandprint.com When I open the site and then select Shop from the menu drill down to a category page like 1980-1989. When I scroll to the bottom of the page the beginning of the next page starts and it shows the category header again and the next item which should technically be displayed on the top of the next page. I looked through reference material throughout the internet and I can't see how to fix this and neither can the developer I am using. Does anyone have any suggestions of what I need to correct to get the correct pagination ? Thank You -karen-


Redirecting specific category to subdomain

I have a problem in following situation: I have 2 separate **Wordpress 3.3.1** instances, main at `domain.com` and one of them (which consists of simple Q&A type site) is available from subdomain `forum.domain.com`. Now I have to merge them into one instance - to be able to share plugins, theme and posts (<-- that's important). At this moment, `forum.domain.com` points to that second instance. I can quite easily get rid of it just by creating post categories for questions and displaying them accordingly. But then, my questions will have links like `domain.com/category/forum/question-subcategory/question` and I want them to be like `forum.domain.com/question-subcategory/question`. I've seen that there is a WP Subdomains plug-in that does exactly that but it's not compatible with WP 3.3.1. I thought that should be possible with .htaccess rules but this post seems to explain that it's not. I considered using _WP Multi-site_ feature but as far as I know, separate sites have separate tables in DB, thus they can't share posts (which is needed, as previously said). Does anybody have any clue how to fix this problem ?


How to wrap the widget content with a div or get the widget title outside?

Is there a way to get the widget title outside of the widget area like this:

The title here

      instead of this:

The title here

      the only reason is that i want the title on top of the widget and I want to apply a padding for all .widget elements, I tried solving it with the styling but it needed some negative margins on the title so I was wondering if we can create a sidebar with a markup like the first example ? and if we can't do that is there a way to wrap the content without the title with a div ? like this

The title here

      and thanks in advance.


Loop not allowing infinite scroll after post per page limit

Im using masonry with infinite scroll to display posts in a loop. I set the post per page which works great on the index page but when I place that same loop on a single page or a buddypress profile page then it only displays the first set of post per page and when I scroll down it returns no more posts to show. Heres the loop minus the guts.
     <?php      query_posts("cat=-1&r_sortby=highest_rated&posts_per_page=8paged=".get_query_var('paged'));        if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>

         <?php endwhile; ?>       <?php endif; ?>

     <?php next_posts_link( __( 'Load more posts', 'imbalance2' ) ); ?>
                Any idea why it's behaving differently on non index pages?


How to change commenter links to /user/user_id?

I would like to change the commenter links as shown in this screenshot: ![screenshot](http://i.stack.imgur.com/2mKaI.png) In my test plugin at GitHub I have first tried the following code:               define('PROFILE', '%s');          function get_comment_author_link($cid) {        $uid = get_comment_author($cid);        return sprintf(PROFILE, $uid->ID, $uid->name);     }          add_action('get_comment_author_link',  'get_comment_author_link');      But then by studying the file `wp-includes/comment-template.php` I have realized, that the argument to `get_comment_author_link` is not a comment ID, but a string containing `<a href="...">...</a>` and thus I can't use this hook for my purpose (because the user ID can't be found in the hook). Please advise me a suitable hook or way to change the commenter links.


Can Sidebar's widget retrieve information from content area?

Recently I have received a response from our wordpress coder regarding the issue.   1. We have a map in content area which shows number of entities in each district. Then we have search form widget in sidebar area. We wanted these two to cooperate. If I change something in search form and press Search -> the map would dynamically respond and vice versa. Vice versa = if i pick the district, this district would be changed in sidebar's form element. We were told this isn't possible as of now.    2. on other subpage we have in main content area results of search (companies, addresses, etc.) In sidebar, we planned to have a minimap showing location of these search results. Coder claims that sidebar's content aka widget of minimap has no way to find out what the results and addresses are.  Is this true? Is there really such obstacle, and no way to bypass it? (besides javascript) **EDIT:** This might look suboptimal, indeed but the map is not universal feature. We are counting with some users having problems so it would be graphical (in the end) that you can use THIS OR THIS.. work version: http://i.imgur.com/PypXAkY.png Those dots on map districts should have been updated as someone picks main district, subdisctrict, vyrobca (manufacturer). It was all a pyramid and if specific manufacturer was picked the dots should have shown only number of companies from the database that include tag of the manufacturer. Also, we were told it's not possible. He could do only district-> subdiscrit filtering, not more. I understand our budget wasn't high, only $3500 :( Maybe that's the problem.


displays only broken images in WPMU sub domains

I am using **wp 3.8** the default .htaccess code, displays only broken images in WPMU subdomains. I tried to modify the RewriteRule to:               RewriteRule ^([_0-9a-zA-Z-]+/)?files/(.+) wp-content/blogs.dir/2/files/$2 [L]      but this **only works with one** of the subdomains-- not 3 or 4 subdomains. Here is the current .htaccess code:               <IfModule mod_rewrite.c>          RewriteEngine On     RewriteBase /wpmu/          RewriteRule ^index\.php$ - [L]          # uploaded files     RewriteRule ^([_0-9a-zA-Z-]+/)?files/(.+) wp-includes/ms-files.php?file=$2 [L]          # add a trailing slash to /wp-admin     RewriteRule ^([_0-9a-zA-Z-]+/)?wp-admin$ $1wp-admin/ [R=301,L]          RewriteCond %{REQUEST_FILENAME} -f [OR]     RewriteCond %{REQUEST_FILENAME} -d     RewriteRule ^ - [L]          RewriteRule ^([_0-9a-zA-Z-]+/)?(wp-(content|admin|includes).*) $2 [L]          RewriteRule ^([_0-9a-zA-Z-]+/)?(.*\.php)$ $2 [L]          RewriteRule . index.php [L]          </IfModule>        1. try to fix the rewrite rule   2. also looking into the wp-admin.php/sites.php -- to modify none of these steps worked, at least from my minimal understanding. Can anybody help me out to resolve the issue on images not display on WPMU subdomains?


Page/2 in my custom page template throws 404 error

I have a form on that page in where I have used the solution provided at Advanced search form with filters for custom taxonomies and custom fields, that works fine and search results appear OK, but when I click on the 2nd page on the pagination it goes to the 404 page with page/2 in the search form. I have searched for this a lot, but found no way.


Crop image from get_theme_mod Customizer field

I'm using the following code to allow a user to upload a custom image (in addition to header image) through the customizer. Is there a way to crop the image when displaying it?               $wp_customize->add_setting( 'intro-img',     array (     'default' => 'http://example.com/image.png',     )     );          $wp_customize->add_control(     new WP_Customize_Image_Control(         $wp_customize,         'intro-img',         array(             'label' => 'Intro Image',             'section' => 'section_one',             'settings' => 'intro-img'              )         )     );      and displaying with:               <?php echo get_theme_mod( 'intro-img', 'http://example.com/image.png' ); ?>


How to hide get_theme_mod if field empty

I'm using: get_theme_mod to show various pieces of info from the theme customizer, in the following format:               <a href=" <?php get_theme_mod( $name, $default ) ?> ">This is the link      I would like to hide the whole line if that particular customizer field is empty. What could I wrap around the anchor to accomplish this?


WordPress Genesis not excluding category from blog

I am trying to exclude a category from my blog. I login to WP and go to Genesis and Theme Settings and add the category IDs to the Blog Page Template area and hit save. Nothing happens. I have also tried adding the following to my `functions.php` file:               add_action( 'pre_get_posts', 'be_exclude_category_from_blog' );     function be_exclude_category_from_blog( $query ) {              if( $query->is_main_query() && $query->is_home() ) {             $query->set( 'cat', '-156' );         }     }      but again nothing happens. Can anyone point me into the right direction?


Creating sub-categories via php

Can someone tell me what's wrong here? I'm trying to create a category and a sub-category via PHP. My code is               wp_set_object_terms($postID, array($subCategory, $catgeory), 'category');      But that creates two categories on the same hirearchy level; my goal is a category with a sub-category.


Is there function similar to wp_upload_bits() that will allow uploading to a specific path?

`wp_upload_bits()` allows you to put arbitrary binary data into a file, but it selects the path where the file is placed and doesn't allow configuration of this destination besides the basename. There's always the option of playing with the Filesystem API directly, but I was wondering if there is a similar function to `wp_upload_bits()` that would wrap the logic for me. Last thing I want is to reinvent the wheel. It's probably not relevant, but the bits being uploaded are being extracted from image/video metadata. A lot of the functionality is being reworked based on code from `wp_generate_attachment_metadata()`.


Maintenance mode just for WooCommerce shop pages

I am trying to enable some sort of maintenance mode for a Woocommerce site. The problem is all of the maintenance mode plugins I have seen designed for both WordPress and specifically for WooCommerce just target the entire site. I want to target just the shop pages. I have looked and all of the woocommerce pages have a body tag of woocommerce- page Can anyone point me in the direction of a snippet to just target pages by body tag and allow me to hide the content and replace with a custom message?


How do you create an archive for a custom post type from a plugin?

So I'm creating a plugin to create buildings that list condos for sale. The simplest way to do this was to just create a custom post type for the buildings and then the listings but I'm now stuck on how to display them in an archive. I've done something similar while developing themes where I would just create a archive-my_post_type.php and single-my_post_type.php but I don't know how to anticipate how themes could be developed. I found an answer on stack overflow that allows you to hijack the chosen template but I'm afraid template files might be more than just get_header() and the_content() etc... What is considered best practice for this sort of thing? Do I just grab get_template_part_content and replace it with my custom loop? Or hijack the chosen template like the answer above and hope for the best?


Show all products on one page with WooCommerce

I have WooCommerce running on this store. Although the default is to show 12 products on a page the client has asked for a "show all" button that will prevent the user having to use pagination to get to the other products. Is there a function I can run on the current page that will rerun the loop but change the query to give more 'posts per page'? I've had a poke around the WooCommerce template files but it's not obvious how this is done. I was thinking on passing a php `GET` variable to the current page and just testing for it to determine whether to run the modified query, like so (outside the loop):               <a href="<?php      echo get_permalink( $post->ID ) . "?showall=1";      ?>">Show all      And then have something like this before template files loop               <?php if($_GET['showall'] = 1){ //something here to modify the query (wp_query perhaps?? or a woocommerce filter) } ?>     //the loop as normal      Am I on the right track? Is this something that is easy to achieve in this way. Any guidance on how to implement would be appreciated. **Edit:** OK I've had a bit more of a dig around the WooCommerce templates. It looks like `archive-product.php` is the file I'd like to override. Now, I already specify the products per page with a filter in my theme's functions.php as below:               add_filter( 'loop_shop_per_page', create_function( '$cols', 'return 12;' ), 20 );      And Ive added this line in the `archive-product.php` file which I've copied to `my theme folder/woocommerce` to override the default:                       <?php if($_GET['showall']==1){                  add_filter( 'loop_shop_per_page', create_function( '$cols', 'return 8;' ), 30 );              } ?>      When I then visit `shop_page/?showall=1` the filter fails to execute. The filter in functions.php seems to dominate despite having a lower priority.


How do i set cron job for my WordPress site?

My target is to run a file to be executed on each day whether the WordPress site runs or not. How to execute cron file? I have got stuck in this is issue. This is new task for me and i don't got any correct solution to my question. Please help me to find out the solution.


Wordpress User Name Limitations

I need to know what the wp specifications for the usernames are. Like allowed minimum and maximum length, are special characters like ü,ö,ä,ß accepted,..? Unfortunately I couldn't find any insight on this in the interweb. Do you have any?


How to lock content?

What is the easiest method to make all my articles accessible only to registered users? My homepage contains titles and excerpts but I want to allow access to the full content only to registered users. I remember there was an admin setting for that but I cannot find it. Maybe Im wrong. Any ideas? Thanks.


How to load theme textdomain from plugin?

I built a simple localization plugin to suit some specifications needed by my orgnanization. For each language there is a single .mo file that contains both the theme translations as the page content translations. The .mo files are located in `myplugin/languages/en_US.mo`. I'm trying to use these .mo files for all gettext calls however I cannot get them to work. Here is the code I'm using to load the text domain:               echo get_locale(); // es_ES     $directory = dirname(plugin_basename(__FILE__)) . '/lang/';     load_plugin_textdomain('localization-v', false, $directory);      _e("English");


How to add product in woocommerce with php code

I want to add products with PHP code like below:               $post_information = array(       'post_title' => 'new item shop',       'post_content' => 'this is new item shop',       'post_type' => 'post',       'post_status' => 'publish'     );     $post_id = wp_insert_post($post_information);      but this code optimize for WooCommerce such as post type and guid and metadata and... Can someone help?


Need to convert Sitecore blogs to WordPress

To this point, I haven't been able to find very much information on this subject, but I am going to need to convert some Sitecore blog content to a WordPress blog. I'm not new to WordPress, but am to conversions of content, and from what I gather, the easiest way to convert content to WP is to import some kind of XML file. Has anyone had experience with importing into WordPress Sitecore content?


Update image links in database

I recently changed the URL of a wordpress site and I can't seem to find some of the image links I was able to update most of the links in the wp_posts tables               update wp_posts set guid = REPLACE(guid, 'domain.com/wp/', 'domain.com/blog/');     update wp_posts set post_content = REPLACE(post_content, 'domain.com/wp', 'domain.com/blog');      Are there other tables, columns that I am missing? ![enter image description here](http://i.stack.imgur.com/zOQ8F.png)


How to edit wordpress native gallery's css file?

I want to edit my gallery's css file. Where do I find it? or Am I override it? PS: I've got 5 different gallery in 5 different page..


Alter post order on taxonomy template

I have a taxonomy template that is returning the correct posts (actually a custom post type) but I want to alter the order in which the posts are displayed. However, nothing I've tried will change the order of the posts from chronological. I've assumed that since the posts have already been returned then I should use 'query_posts' to alter the order of the posts. Accordingly, based on the codex, I added the following before the loop on the template:               <?php      global $query_string;     query_posts( $query_string . '&order=>ASC');     ?>      Changing "ASC" to "DESC" produces no changes in the listing. NOTE: The end result I want will be more complicated than this example but for the moment I can't even get a simple sort like above to work. I've also tried using this approach               <?php $sectionarg = array(                          'order' => 'ASC',                             );     query_posts($sectionarg);       ?>            But that completely destroys the original list of returned posts and replaces it with regular posts. So it appears that to maintain the original query you have to use the first approach but how then do you sort the returned posts? Any advice would be greatly appreciated. Thanks


Search box background on a different page template

I'm trying to make the search box background the same as the homepage, but for some reason there is a orange background - it doesn't use a different header.php its called within a filter the code below.               add_filter('wp_nav_menu_items','add_search_box_to_menu', 10, 2);     function add_search_box_to_menu( $items, $args ) {         if( $args->theme_location == 'main nav' )             return $items."
".__('Search', 'concept7')."
<form style=\"overflow:hidden;text-align:center;\" method=\"get\" id=\"searchbar\" action=" .home_url()."/ >                     <input type=\"text\" class=\"menu-search-form-input\" name=\"s\" id=\"search\" value=\"Type and hit enter ...\"/>                     </form>

";              return $items;     }      This is the code that generates the search box, however I can't see anything in this that changes the background colour or a condition to say if its a certain page template change the background or div element. Here is a link to the website, my desired result is to get the navigation to look the same as the homepage on all other pages - basically remove the orange background.               http://79.170.44.128/new-getextra.co.uk/      Many Thanks in advance.


How do you turn on comments for only the last page of a paginated post?

I have a single post with page breaks, but I only want to show comments and the ability to comment on the last page. Is this possible with WordPress?


Rewrite url for custom post type

I'm using WPML plugin to translate my site. I have a custom post type called "vinos" and I use this args:               $args = array(                  'labels' => $labels,                 'hierarchical' => false,                 'supports' => array('title', 'thumbnail'),                 'public' => true,                 'show_ui' => true,                 'show_in_menu' => true,                 'menu_position' => 6,                 'show_in_nav_menus' => true,                 'publicly_queryable' => true,                 'exclude_from_search' => false,                 'has_archive' => 'nuestros-vinos/catalogo',                 'query_var' => true,                 'can_export' => true,                 'capability_type' => 'post',                 'rewrite' => array('slug' => 'nuestros-vinos/catalogo/marcas/%marcas%')         );         register_post_type('vinos', $args);      The problem is that I can't translate my string "nuestros- vinos/catalogo/marcas" to english and for that reason my urls are: www.domain.com/nuestros-vinos/catalogo/ ---------> show all my list of wines in spanish www.domain.com/en/nuestros-vinos/catalogo/ ------> show all my list of wines in english but I would like that in english version, the url was: www.domain.com/en/our-wines/catalog/ I'm trying to use rewrite rules:               add_filter('generate_rewrite_rules', 'customposttype_rewrites');     function customposttype_rewrites($wp_rewrite) {         $newrules = array();         $newrules['en/our-wines/catalog/?$'] = 'en/index.php?post_type=vinos';         $wp_rewrite->rules = $newrules + $wp_rewrite->rules;     }      But it doesn't work, always page not found. How can I do it? Thanks.


Placing a widget with $wpdb query

I'm getting the feeling that adding Widgets via MySQL query is not as simple as I thought. I was under the impression all data is stored in the `options` table, but it seems like I was wrong. Any idea how to place a widget via $wpdb? What data should be written down? And where? Thanks!


Membership / subscription plugins - alternatives

Does anyone have recommendations (backed by experience) for a membership plugin that can   * Provide for recurring subscriptions via PayPal   * Allow selected posts to be visible only to subscription members   * Allow selected posts to have come content that can be viewed by anyone, and some content that is only visible to subscription members   * Good support that recognises that the urgent support needs of payment processing not working. I'm reasonably capable of running a Google search for alternatives - what I'm after is any actual experience (apologies if that comes across as slightly rude!) Key requirements are reliability of the integration, informative error messaging, and support that recognises that payment processing is important and often critical.


After site transfer I'm still getting redirected to the old site (WordPress)

I have transfered my WordPress theme on another domain doing these steps:   1. I have used a backup plugin and backed up database   2. Transfered wp-content folder to the new site   3. Uploaded the database to a new host   4. Changed `siteurl` in `wp-options` to a new one But I'm still getting redirected on the old URL pressing on the header. In `header.php` the PHP echo `home_url();` could be changed, so I'll be redirected on the new URL but I'm not sure that this is the solution. Would be glad to hear from you what have I done wrong.


Possible to "Attach" images to multiple posts without inserting or uploading twice?

How can I attach images to a post which have already been attached to other posts without having to upload them twice? I don't want to insert the images into the post, I simply want to attach the same set of images to multiple posts. As of WP.3.0.1 it does not appear that this is possible, however, if the "Media Library" tab of the "Insert Image" wizard had a column labeled "Attach" with a checkbox next to each image in the media library, this could be easily done. How difficult a task would it be to add this functionality?


What is the use of wp_schedule_event hook?

I want to do a cron(executes function at specific time, like email,db backup etc) job. I searched in wordpress, i got this wp_schedule_event Here they say it will execute job when someone visits wordpress site if the specified time is passed. I have a doubt, it is doing this only when someone visits wordpress website. Is cron job same for normal php site without any framework. If it runs only when user visits the site, then why not can i do it in `init` hook itself with a time if condition so i can achieve what `wp_schedule_event` is doing without it.Like below               function test(){     if($time_condition > 20 && $time_condition < 23){     //do stuff     }     }     add_action('init','test');      As `init` runs wordpress loaded, so every time user visits site this will be checked and executed. can someone please give the difference and Which is useful for this kind of job? I see both `wp_schedule_event` and `init` are same except we need to add the condition in `init` because other than that `wp_schedule_event` also runs only when someone visits.


Prevent multiple form submissions from one page

I have a problem with the end user form. Users can spam by just pressing all the time the add button. Is there a way to hide it or disable it when someone click the Wyslij button? I am using this code. This is in php                   <?php       /**      * Template Name: Dodaj Page      */     acf_form_head();          get_header();          the_post();           ?>

             <?php get_template_part('includes/breadcrumbs', 'page'); ?>                                 <article id="post-<?php the_ID(); ?>" <?php post_class('entry clearfix'); ?> role="article">
                                  <?php                              $options = array(                                 'post_id' => 'newdata', // post id to get field groups from and save data to                                 'field_groups' => array( 27 ), // this will find the field groups for this post (post ID's of the acf post objects)                                 'form' => true, // set this to false to prevent the <form> tag from being created                                 'form_attributes' => array( // attributes will be added to the form element                                     'id' => 'post',                                     'class' => '',                                     'action' => '',                                     'method' => 'post',                                 ),                                 'return' => add_query_arg( 'updated', 'true', get_permalink() ), // return url                                 'html_before_fields' => '', // html inside form before fields                                 'html_after_fields' => '', // html inside form after fields                                 'submit_value' => 'Wyślij', // value for submit field                                 'updated_message' => 'Wpis został dodany prawidłowo.', // default updated message. Can be false to show no message                             );                             //Sprawdzenie id zalogowanego użytkownika                             if ( is_user_logged_in() ) {                                 $user_ID = get_current_user_id();                                 //Funckja licząca statusy wpisów.                                 global $wp_query;                                 $curauth = $user_ID;                                 $post_count_draft = $wpdb->get_var("SELECT COUNT(*) FROM $wpdb->posts WHERE post_author = '" . $curauth . "' AND post_type = 'post' AND post_status = 'draft'");                                 $post_count_publish = $wpdb->get_var("SELECT COUNT(*) FROM $wpdb->posts WHERE post_author = '" . $curauth . "' AND post_type = 'post' AND post_status = 'publish'");                                 //Jeśli więcej niż 1 wpis, zakaż dodawania więcej.                                 if (!current_user_can('moderate_comments') AND (($post_count_draft > 0) OR ($post_count_publish > 0))) {                                     echo '
Wpis został dodany prawidłowo.
';                                     echo '
Możesz tylko dodać jeden wpis, wróć na stronę główną.
';                                 }                                 else {                                     acf_form( $options );                                 }                             }                             else {                                 echo '
Tylko dla zalogowanych użytkowników.
';                                 echo wp_login_form();                                 echo wp_register('', '');                             }                             ?>

                                  <?php if ( 'on' == et_get_option('lucid_show_pagescomments') ) comments_template('', true); ?>

            <?php get_footer(); ?>      This is in functions.php                   function add_new_post( $post_id )     {         if( $post_id == 'newdata' ) {             // Create a new post             $post = array(                 'post_title' => $_POST["fields"]['field_52e8ce62f6982'],                 'post_status'  => 'draft',                 'post_category' => array(6),                 'post_type'  => 'post'             );                  // insert the post             $post_id = wp_insert_post( $post );                  return $post_id;              }     }     add_filter('acf/pre_save_post' , 'add_new_post' );                    function acf_set_featured_image( $value, $post_id, $field  ){     //    echo '
'. print_r($value,1).'
'.print_r($_POST,1).'
'; die();         if($value != ''){             //Add the value which is the image ID to the _thumbnail_id meta data for the current post             add_post_meta($post_id, '_thumbnail_id', $value);         }              return $value;     }     // acf/update_value/name={$field_name} - filter for a specific field based on it's name     add_filter('acf/update_value/name=zdjecie1', 'acf_set_featured_image', 10, 3);                    function acf_set_miejsce( $value, $post_id, $field  ){        // echo '
'. print_r($value,1).'
'.print_r($field,1).'
'; die();         if($value['address'] != ''){             //Add the value which is the image ID to the _thumbnail_id meta data for the current post             add_post_meta($post_id, 'codespacing_progress_map_address', $value['address']);         }          if($value['lat'] != ''){             //Add the value which is the image ID to the _thumbnail_id meta data for the current post             add_post_meta($post_id, 'codespacing_progress_map_lat', $value['lat']);              }          if($value['lng'] != ''){             //Add the value which is the image ID to the _thumbnail_id meta data for the current post             add_post_meta($post_id, 'codespacing_progress_map_lng', $value['lng']);         }         return $value;     }     // acf/update_value/name={$field_name} - filter for a specific field based on it's name     add_filter('acf/update_value/name=miejsce_kradziezy', 'acf_set_miejsce', 10, 3);


How to get this JavaScript working with get_permalink

I am pretty new to this awesome forum, therefore not sure if this question below belongs here. A little JavaScript, which works perfect when I drop a static url in it but I can't figure out how to do with `get_permalink()`               var $el, $tempDiv, $tempButton, divHeight = 0;          $.fn.middleBoxButton = function(text, url) {          return this.hover(function(e) {          $el = $(this).css("border-color", "white");         divHeight = $el.height() + parseInt($el.css("padding-top")) + parseInt($el.css("padding-bottom"));              $tempDiv = $("<div />", {             "class": "overlay rounded"         });              $tempButton = $("<a />", {             "text": text,             "href": url,             "class": "widget-button rounded",             "css": {                 "top": (divHeight / 2) - 7 + "px"             }         }).appendTo($tempDiv);              $tempDiv.appendTo($el);          }, function(e) {              $el = $(this).css("border-color", "#999");              $(".overlay").fadeOut("fast", function() {             $(this).remove();         })     });     }          $(function() {     $(".widget-one").middleBoxButton("Read More", "http:// bla bla bla");          });      Any help I would love to get.


previous_posts_link returns null when querying custom post type

I have created a custom post type named `lesson`, and I want to display all lessons, so I created a custom page named `lesson.php`, inside, I added a query to look for all the posts which type are `lesson`.               <?php     $page = get_query_var( 'page' ) ? get_query_var( 'page' ) : 1;     $query = new WP_Query( array( 'post_type' => 'lesson', 'paged' => $page ) );          while ($query->have_posts()) : $query->the_post(); ?>

<?php echo the_title(); ?>

<?php echo the_content(); ?>

     <?php endwhile; // end of the loop.      wp_reset_query(); ?>
<?php next_posts_link( 'Next Lessons', $query->max_num_pages ); ?>

<?php previous_posts_link( 'Previous Lessons' ); ?>
      It works, the problem is pagination, the `next_post_link` always shows up, even in the last page, linking to the same page, that itself is not a very big problem, the biggest issue is `previous_posts_link` just returns null, and nothing is displayed. Reading about this issue on the internet I found out the query must be named $wp_query as it's a global object those functions use, nevertheless when I change the name of the query it still doesn't work.


Custom post type and taxonomy permalinks

I have a custom post type 'news' and a taxonomy 'category-news'. I would like to get this permalinks:                   www.domain.com/news -------------> list of all news         www.domain.com/news/sport -------> list of all sport news         www.domain.com/news/sport/post --> the post         www.domain.com/news/2014 --------> list of all news of year 2014         www.domain.com/news/sport/2014 --> list of all sport news of year 2014         www.domain.com/news/page/2 ------> second page of pagination news         www.domain.com/news/sport/page/2 -> second page of pagination sport news      is it posible? How can I do it? Thanks.


Using wp-super-cache and amazon cloudfront - can I serve a file directly (no cdn)?

I'm using the wp super cache plugin with cdn support turned on (aws cloudfront). I'm also using wp tables reloaded. The latter plugin includes a text file via ajax, and that file is being served by the cdn. The plugin doesn't do any sort of jsonp maneuvers, so the file hits access-control-allow- origin issues. Before I go and mess with the plugin to pull the file correctly, does anyone know how I can restrict the cdn from storing this file, and just serve it up directly?


How to post WP article on social sites along with publish?

when we press "Publish" button in wordpress for a article. than along with wordpress , that article's reference link should be posted automatically to twitter, linkedin and Facebook. How to make this possible?


What happens when permalink settings are updated?

I have to identical copies of the same site on two different webhosting companies (besides the actual domain of course). One of them works all the time with pretty permalinks and the other works fine a day or so, but then all of a sudden it does not work and the permalink gives an 404 file not found, but only when viewing a singe custom post page, named single-`<cpt-name>`.php in the thems folder. When I go into admin / Permalink page - the sites starts to work again (with the custom post page showing again) My thoughts are that this must be server-related. The site that is working all the time has PHP 5.4 and the one that is not working all of the time has PHP 5.5, but I don't think the version of PHP is the issue. Both sites have WP 3.8. I'm using a cacheplugin called WP Supercache, but that doesn't seem to be the issue because the site works again with cpt without flushing the cache (after viewing permalinksettings in admin) I'm using permalink-structure: `/%postname%/` I'm wondering how I could debug this? In order for me to debug this **I want to know what happens (programmatically) when peramlink-settings are updated?** _I think that the .htaccess in the root-folder (same as wp_config.php) is changed. (based on some reading)_ Is this correct? I'm wondering if some plugin can cause the issue? (a plugin that somehow messes up pretty permalinks somehow) My .htaccess looks like this (when working):               # BEGIN WordPress     <IfModule mod_rewrite.c>     RewriteEngine On     RewriteBase /     RewriteRule ^index\.php$ - [L]     RewriteCond %{REQUEST_FILENAME} !-f     RewriteCond %{REQUEST_FILENAME} !-d     RewriteRule . /index.php [L]     </IfModule>     # END WordPress


Warning after create Custom post type with Roots theme

I've created e Custom post type with Roots theme, adding the custom script inside functions.php like               require_once locate_template('/lib/custom-post-types.php');          // Custom post types      After that in backend the list of pages is not displayed, and in frontend show this Warning: > Warning: strpos() expects parameter 1 to be string, array given in > /wordpress/wp-includes/query.php on line 2375 > > Warning: urldecode() expects parameter 1 to be string, array given in > /wordpress/wp-includes/post.php on line 3901 > > Warning: urlencode() expects parameter 1 to be string, array given in > /wordpress/wp-includes/formatting.php on line 3690 What could be?


How to find out what's causing (broken) ajax login

I have inherited a pretty jumbled wordpress site. Just recently, my development version of the site has decided it uses some sort of ajax login, which brings up a throbber, then does nothing, after clicking login. How would I go about finding the source of this problem?


I would like single.php to act just like index.php

I'm creating a WordPress theme for my portfolio and I would like to my single.php file to act just like the index.php. I need the single.php to show the entire loop but if I access single post's page it only shows the specific post not the full list of posts. I'm using a one page design and I have to use i.e `<?php echo($post->post_name) ?>` on page load in order to load some AJAX and have some deeplinking, etc. If I delete the single.php it also only shows the specific post not the full list of posts when using a http://www.example.com/postname URL. Deleting functions.php doesn't change anything about it. Here is a simplified version of the index.php/single.php loop:               <?php get_header(); ?>     <?php if (have_posts()) : ?>     <?php while (have_posts()) : the_post(); ?>     <?php if (has_post_format( 'image' )) { ?>     <?php } else if (has_post_format('chat')) { ?>     <?php } else if (has_post_format('gallery')) { ?>     <?php } else if (has_post_format('video')) { ?>     <?php } else { ?>     <?php } ?>     <?php endwhile; ?>     <?php endif; ?>      Many thanks for your time and help.


Switch form Next/Previous to post title

I want to switch from the Next Post/Previous Post type navigation, to showing the title of the previous or the next post.Here is the code I think needs to be changed, it's form loop-single.php
<?php _e( 'Post navigation', 'admired' ); ?>
         <?php previous_post_link( '%link', __( '← Previous', 'admired' ) ); ?>         <?php next_post_link( '%link', __( 'Next →', 'admired' ) ); ?>


Get attachment id from WP Customizer

The WP Customizer's `WP_Customize_Image_Control` returns the attachment's URL, but I need the ID because I want to output the image like this:               echo wp_get_attachment_image( $user_logo_id, 'riiskit-user-logo' );      The reason for this is because I want the logo to be compatible with the WP Retina 2x plugin. That's why I'm using the thumbnail-sizing above. This way, the user only has to upload one big image and everything else will be taken care of by the code. I've already tried all the different `attachment_src_to_id` functions out there but none of them works and only returns `null` or `false`. This for instance Even when I type the URL manually as a parameter, it still returns negative. However when I type the ID manually inside `wp_get_attachment_image`, it shows as expected. Have something changed in WP v3.9 that causes these functions to return false? Perhaps there is some way to extend the Customizer's image control to receive the attachment ID? Any ideas? :)


Widget does not work with WooCommerce enabled

I have created a widget here https://gist.github.com/joshbenham/e03c35313282c6ac402a For some reason when WooCommerce is enabled it will not save the extra fields (greatest, great and good). I have disabled WooCommerce. Changed products to just be posts. Tested and it works perfectly. Has anyone run into this problem before? The weirder thing is that it actually does save the title just none of the other fields. It does not even save them as blank. They just get cut out full stop.


Remove the 'Attachment Details' section of the wordpress media manager

I'm using the new WP media manager for a branding plugin (well, new from 3.5), and it is working well. My only issue is that I have an 'Attachment Details' area on the right, allowing users to edit, delete and generally mess with images. Is there a way to remove this area? Thanks. Here is an image showing which area I want to eliminate - ![enter image description here](http://i.stack.imgur.com/RpAUt.png) Here is my JS to invoke the media manager -               $(document).ready(function(){              var dd_media_frame,     // The custom dd_media frame             clicked_parent = 0; // The parent element of the button that was clicked              /** Open the media manager when the any button with the class 'open-media-manager' is clicked*/         $('#dd-custom-branding-metabox').on('click', '.manage-images-button', function(e){                  e.preventDefault();                  clicked_parent = $(this).parent();                  /** Ensure the 'dd_media_frame' media manager instance already exists (i.e. if it's already been used since the page was loaded) */             if(!dd_media_frame){                      dd_media_frame = wp.media.frames.dd_media_frame = wp.media({                          /** Set the parameters for the media uploader */                     button: { text: 'Select image' },                           // Set the text of the button.                     className: 'media-frame custom-admin-branding-media-frame', // The class to use for this instance of the media manager                     library: { type: 'image' },                                 // Ensure only images are allowed                     multiple: false,                                            // Disable multiple selections                     title: 'Select a custom admin header image'                 // The tile to show in the media uploader                 });                      dd_media_frame.on('select', function(){                          /** Grab the attachment selection and construct a JSON representation of the model */                     var media_attachment = dd_media_frame.state().get('selection').first().toJSON();                          /** Update the hidden 'branding[header_logo]' field with the ID of the selected logo */                     clicked_parent.find('input[name="branding[header_logo]"]', '#dd-custom-branding-metabox').val(media_attachment.id);                      });                  }                  /** Finally, open the media manager */             dd_media_frame.open();              });          });


Changing title bar in browser window of theme "Encounters Lite"

I have an external php application for for genealogical research ("TheNextGeneration", TNG) integrated into WP. The integration plugin hooks the external content into a blank WP page and displays the genealogical data there. Because it is always the same page, the browser window shows only the name of the WP page in the title bar. Since each of the TNG pages comes with its own title, I like to have this information used instead. The theme in use is "Encounters Lite" (if this is relevant). Thanks!


Edit multiple custom post types while saving a new or edited post

I have a custom post type with some custom fields in it. Now what i want to do is when i save a new OR edit an existing post in that post type, is to change custom fields from all the other posts of that custom post type. I'm familiar with the update_post_meta, but i can't figure out on how to get the post ID's of all the other posts to update them all.


need a help for modify .htaccess rule

here is my wp `.htaccess`               # BEGIN WordPress     <IfModule mod_rewrite.c>     RewriteEngine On     RewriteBase /wordpress/     RewriteRule ^index\.php$ - [L]     RewriteCond %{REQUEST_FILENAME} !-f     RewriteCond %{REQUEST_FILENAME} !-d     RewriteRule . /wordpress/index.php [L]     </IfModule>          # END WordPress      now I want combine the below rules into my wp `.htaccess`. `new` is a new page which I created in the wp admin panel and set the hyperlink make the URL looks like `http://localhost/wordpress/new`               # Don't show directory listings for URLs which map to a directory.     ##Options All -Indexes          # Follow symbolic links in this directory.     ##Options +FollowSymLinks          # Customized error messages.     ErrorDocument 404 /new          # Various rewrite rules.     <IfModule mod_rewrite.c>       RewriteEngine on            # Rewrite current-style URLs of the form 'new?url=x'.       RewriteCond %{REQUEST_FILENAME} !-f       RewriteCond %{REQUEST_FILENAME} !-d       RewriteRule ^(.*)$ new?url=$1 [L,QSA]     </IfModule>      I have easily add `# Rewrite current-style URLs of the form 'new?url=x'.` and `RewriteRule ^(.*)$ new?url=$1 [L,QSA]` in wp `.htaccess`, not work, even bronken all the links in wordpress. So how to do in right way?


Hide post list for custom post type in the backend

i'm trying to hide the post-list for the admin, when there are no posts in the database. Custom post types initially look like follows: ![Current](http://i.stack.imgur.com/qx53F.jpg) But I want to add my own content (if needed) INSTEAD of the the list. (Or at least above the list) Like the picture shows: ![Want](http://i.stack.imgur.com/EMPE5.jpg) Do you have any Ideas? Hooks, filters etc... I've searched for a couple of hours now, but didn't find anything helpful. Any help would be appreciated, thanks!


I want to create a Visual Recipe site on WordPress, any suggestions or tips on how i can do it?

I would like to create a visual recipe site, which lists how to make a dish in step by step through pictures.. Is it possible to create a custom page template where i can the following fields. 1.Dishname(title) 2.Introduction(Brief info) 3.Ingredients 4.upload photo input.. followed by add more pic Is it possible in wordpress, you have any effective ideas? please share :) here is a screenshot of what i have in my mind http://i.stack.imgur.com/rsWKg.png


How to retrive Custom Fields as Values for a Form field

I am constructing a theme for Wordpress that uses PAGES for products for sale on a site. This Product will have properties like DESCRIPTION, PRICE that will be stored to custom fields. I was wondering if it is possible to retrieve the values from the custom fields and forward them to a form which is stored in another wordpress page. This form is a request for quotation form that the user fills out. Thank you.


Create permalink structure for one taxonomy archive per custom post type

So, I've been going crazy trying to figure this out. Essentially, I've created two custom post types, `'the_case_study`' and `'the_video'`, with respective slugs `'case-studies'` and `'videos'`. I've also created three taxonomies which apply to both the_case_study and the_video. These are `'the_room'`, `'the_system'` and `'the_style'`. By default, the taxonomy archive displays **all posts** tagged with a given term, and the permalink looks like this:               example.com/room/kitchen (displays all posts tagged with kitchen)      I would like to have a taxonomy archive that will **only display the posts of the current custom post type** and will have a permalink that is relative to that custom post type. For example:               example.com/case-studies/room/kitchen (should display all case studies tagged with kitchen)          example.com/videos/room/kitchen (should display all videos tagged with kitchen)      I've already resolved a similar problem elsewhere on the site, based on this answer among other things. However, I only know how to make that work for one post type. This seems like something that should be possible, but I don't know how to go about it. Essentially, I'd like to be able to find the parent of the current taxonomy page, where that parent is the current custom post type... but I'm not sure how that jives with the custom post type and taxonomy constraints. Is what I'm trying to do possible? Should I be thinking about it differently?


How to add featured image or custom field to xml feed?

I already tried the plugins RSS Manager, Add featured image to RSS feed and Featured Image In Rss Feed. But all they do is add the image inside the `<description>` attribute of the xml feed. There is at least 2 problems with that:   * The blog that's pulling the feed truncates the `<description>` at about 300 characters which is fine.   * The blog that's pulling the feed strips html tags. I have to strip them because if there is an image inside the body of the post, it will display it. So if there are two images at the beginning of the post, it will display them and it will also display the featured image. Also, the img tag will eat up characters of the 300 character limit.  So I need to generate the RSS xml feed with the added attribute `<featuredimage>` or `<thumbnail>` or something like that. NOT embedded inside `<description>`. I have searched for plugins but can't find any that solve this problem. Thanks in advance.


Adding Pipes to Menu Output

My client has a menu like this image below that I am trying to re-produce for them as a WordPress Menu... ![enter image description here](http://i.stack.imgur.com/ns6CL.png) My first attempt so far was to utilize the `after` parameter option for the `wp_nav_menu`. Below you can see where I have passed in `<span class="navSep">|</span>` This adds the `Pipe` after each menu item. I need to somehow make it not add to the last menu item or else it does not look right having an ending pipe. Any suggestions? I would rather stay away from using JavaScript to hide/remove the last item. I am open to anything as long as I can output the menu like the image below?               wp_nav_menu(        array(         'menu' => 'footer-menu-1' ,         'after' => '|'       )     );


How to create custom content on custom page from plugin?

I have a plugin that I'm working on and I'd like the plugin to create and display custom content on a "page" created using a rewrite rule. I've successfully created the rewrite rule with `add_rewrite_rule()` and when navigating to that URL, I don't receive the "Page not found" error. What I'm having trouble figuring out is how to have the plugin display content when that URL is accessed. I know how to do this in a theme with `get_template_part( 'content', $page_template );` but how can I have the plugin serve this functionality? The plugin can't add a file to the Theme, so how can I have custom page content (via the plugin) show up? Instead of using a theme's `page.php`, I'd like the plugin to pull from `my- plugin/views/custom.php` I've seen other plugins that do this sort of thing, but haven't been able to track down how it gets the content to the public user. I'm sure I'm overlooking something fairly simple, but I'm having a hard time tracking down the issue, I'm not even sure exactly how to search for what I'm looking for. Any help would be greatly appreciated. Thanks.


How to setup the landing and entry pages for a custom post type

I have created a custom post type called services but am not sure if they way the setup pages is most optimal. For the landing page, I have created a normal 'static pages' called services and am using this loop to list the service entries int the file called page- services.php:               <?php $the_query = new WP_Query( array( 'post_type' => 'services' ) ); ?>     <?php while ( $the_query->have_posts() ) : $the_query->the_post(); ?>                            <?php the_title('') ?>     <?php the_field('service_description') ?>     <?php endwhile; ?>      Everything else on the services landing page is hardcoded like the page title (which I think should really be dynamic). For the services individual posts (using custom post types services), the loop looks like this in the file called single-services.php:               <?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>     <?php the_field('testimonial_qoute'); ?>     <?php the_title('') ?>     <?php the_field('service_description') ?>     <?php endwhile; else: ?>
There are no services found
     <?php endif; ?>      The HTML markup for both pages is the same, is just one list the services and the other displays individual service. Any advice is welcome. Thanks


Use Click Image to Play Youtube Video in a Wordpress Loop

Here is my code on Playing Youtube Video when an image is clicked.. The HTML

                    The jQuery                     I tried to used it in a loop, but if i clicked on one image, it plays all the video's inside the loop. Here is the code               <?php if (have_posts()) : while (have_posts()) : the_post(); ?>              <article id="post-<?php the_ID(); ?>" <?php post_class('clearfix'); ?> role="article">
         <?php         if(get_field('youtube_id'))         { ?>

             <iframe src="http://www.youtube.com/embed/<?php echo get_field('youtube_id'); ?>?rel=0&hd=1&autoplay=1" style="position: absolute; top: 0; left: 0; width: 100%; height: 100%;" frameborder="0" webkitAllowFullScreen mozallowfullscreen allowFullScreen>

          <?php the_post_thumbnail('full', array('class' => 'featimg')); ?>         <?php } else { ?>         <?php the_post_thumbnail('full', array('class' => 'featimg')); ?>         <?php } ?>

<?php the_title(); ?>

         <?php the_content(); ?>
          <?php endwhile; ?>
      I want it be dynamic, but I don't know how. Any suggestion will be appreciated, thanks.


Link images to post permalink - custom post types

When someone creates a post in a custom post type and uploads an image the Link URL box shows it as the attachment URL. What I would like is for it to be the permalink to the post. Is there a way to do it without modifying core files?


Creating a photo gallery in WordPress

At times I've tried a few different solutions for a WordPress-powered photo gallery. There are lots of options, including plugins and custom post types. Theme matters a lot, here. ma.tt has a pretty impressive setup (as you would expect from the creator of WordPress), though I'm not sure where all the magic comes from. So, have you implemented a gallery? Did you use built-in functionality, or are there some plugins you found helpful? What sorts of challenges did you face, e.g., needing to pick a focus/highlight image to represent the set.


Looking for simple and lightweight plugin for post reading stats

I am already using Piwik to register all stats of my blog site. What I need now is a simple and lightweight plugin that stores the number of visitors for single posts. It would be nice if it provides a way to show the number of readings inside the post.


Wordpress page editor for clients, opinions needed

I wanted to ask other wordpress developers their thoughts on how clients can best create fairly advanced page layouts via the standard WYSIWYG editor. When I say advanced layout I primarily mean a layout with responsive columns, maybe an image on the left and a heading and content on the right. As simple as that sounds it can end up getting fairly ugly to look at in the editor. Personally I have tried using the standard editor, using shortcode plugins, using advanced custom fields with flexible content fields, and I've researched some of the editors that essentially replace the standard editor. They all have there pros and cons, and in the end I have to remember my client may have fairly limited knowledge in laying out a page let alone markup and CSS. So my question is, what are other wordpress developers using to allow their clients to create more advanced page layouts? Thanks for your thoughts!


Looking for similar posts plugin with custom tuning

I am using Similarity by David Miller; it is nice, but it misses some features. I would like to:   * Assign more "weight" on some specific posts (specify them by ID is ok)   * Assign more "weight" to most recent posts (the plugin that I am using it prefers many times very old posts based on tag/category than recent) Do you known if it exists a plugin with these features?


Custom content before post content

I am using this code to insert custom content after title and before content. How can i limit it to only "post" not pages and custom post types.               function theme_slug_filter_the_content( $content ) {     $custom_content = 'YOUR CONTENT GOES HERE';     $custom_content .= $content;     return $custom_content;} add_filter( 'the_content', 'theme_slug_filter_the_content' );


Why do I get the timeout warning?

I turned on debug mode in WordPress and the first request of the day I get this error: Warning: http_request() [function.http-request]: Timeout was reached; Operation timed out after 1000 milliseconds with 0 bytes received (/wp- cron.php?doing_wp_cron) in /public/wp-includes/class-http.php on line 1218 I know what cron jobs are and I understand how WordPress might want to run periodic jobs (and since HTTP is stateless, running a "cron" job on the first request of the day makes sense) but why does it time out?


Customizing a WordPress theme without changing it?

I have found and downloaded a theme. However I want to tweak the CSS some to change the design, colours etc. a bit. How should I go about doing this, while still being able to update the theme without loosing the changes.


Hiding styles from Facebook

Some of my pages/posts have very short custom stylesheets at the beginning of them. I know this isn't great practice, but it's worked very well thus far. The problem, however, is linking on Facebook: Facebook auto-generates a preview of the page, and it includes a picture, the page title, and a snippet from the beginning of the post content. The post content snippet is only showing the stylesheet that I have directly inside the post--Facebook isn't ignoring the fact that it's HTML. What can I do on WordPress's end to really hide that code? Do I need to put all of those styles in my custom CSS then give everything the proper class? (To clarify, the `<style>` tag doesn't show, just the content of the stylesheet itself. It doesn't show on the page in WordPress, only in the Facebook snippet. This is a self-hosted blog.)


custom walker nav issue involving ajax

I am using ajax in a theme not written by me. This ajax gets the link clicked and then slides that page into view. it works good. In order for it to do it's thing, I had to make a custom walker for wp_nav_menu that adds two characters to the link so my links look like this in the nav                http://my-site.com/#!/post-1      my problem with this is that when viewing a single page. I have to have WordPress reload the page to get the single post. So then my link would look like this                http://my-site.com/?p=post-1      So when I hover over the nav to go back to a previous or new page, this is where my problem starts. my nav shows this as the selection when clicked                http://my-site.com/?p=post-1#!/post-1      I don't know why it won't get rid of the previous address. Here is my custom walker http://pastebin.com/Xn7NRiG7 Most of the site is is loading posts and pages into the index and then using the ajax to scroll that page into view. I am trying to make the single blog pages external to the ajax functionality. I tried using two different menus for this like so                if( is_home() || is_page()){                $args = array( 'depth' => 3, 'container' => '', 'container_class' => '','menu_class' =>'', 'menu_id' => 'menu', 'fallback_cb' => 'default_menu','link_before' => '','link_after' => '', 'theme_location' => 'primary','walker' => new Amaranthe_Custom_Walker_Nav_Sub_Menu());                 wp_nav_menu($args);             } else {                $args = array( 'depth' => 3, 'container' => '', 'container_class' => '','menu_class' =>'', 'menu_id' => 'menu', 'fallback_cb' => 'default_menu','link_before' => '','link_after' => '', 'theme_location' => 'primary');                 wp_nav_menu($args);             } ?>      Do you have any idea how I might be able to get back into the ajax flow properly?


Redirection based on location but without affecting search bots

A client has a successful UK site based powered by Wordpress and is launching a US arm. While the US sub-sites are built, he has a holding page that is visible to US visitors, who are redirected to it from the usual home page by the Geo Redirect plugin. I've just realised that Geo Redirect is also redirecting Google's (and other search engines') bots, which is not at all good; does anyone have a relatively easy solution that would do what Geo Redirect does so well but would not affect visits by search engine bots?


do_action appearing outside of menu?

I'm using Bill Erickson's "Add Extra Code to Any Menu" function:               <?php     /**      * Add Extra Code to Any Menu      * @author Bill Erickson      * @link http://www.billerickson.net/customizing-wordpress-menus/      *      * @param string $menu      * @param object $args      * @return string modified menu      */     function be_menu_extras($menu, $args) {     //$extras = '
Your extras go here
';     if ('secondary' == $args->theme_location)          //return $menu . $extras;           return $menu . '
' . do_action('posts_logout_link') . '
';     else         return $menu;     }     add_filter('wp_nav_menu_items','be_menu_extras', 10, 2);      to insert `do_action('posts_logout_link');` from the Logout Password Protected Posts plugin. Can anyone shed some light as to why `do_action` appears outside the `$menu`. If I use html, it appears at the end on the menu wrapped in the `<li>` tags, as it's supposed to. (Using $extras seemed to duplicate the link in other areas.)