All Menu Items Disappear Seemingly at Random

For the last month or so, seemingly at random and with no discernible pattern, my menu disappears. However, when I look at the Dashboard, what I find is that all the menu items have been deleted but the menu itself is still there. I can select and add the items back and they reappear. There is nothing in my error logs, and I'd guess it's happening about once/week, though that's just a guess. I am using a modified default theme, though the theme has not changed for over a year and this problem started recently. Because I cannot predict when this will happen it's difficult for me to remove all plugins indefinitely while I wait as it will break lots of functionality on my site. However, none of the plugins are directly related to the menu system. And they've all been in place for quite a while. I've seen some posts that seem related to this problem but they all involve huge menus. My menu only has 4 items! The items all point to Pages. The structure/contents of the menu have not changed for a couple years. Any ideas? Even ideas on how to troubleshoot this would be appreciated.


Is a site with 1,500 pages, (1000 of which are E-Commerce Pages) Too Big to Migrate to WordPress?

This is my first post here, so be gentle if my question is stupid :) I have a potential client who has a site with about 1500 pages, 1000 of which are product pages for an online store. To give you a better idea, it's a dermatologists' site whose main offerings are obviously the doctors services, but they also sell some skin products on the site. The site is currently written in ASP and I really, really want to migrate it to Word Press so I can edit content easily, do SEO easier, automate things like Google Analytics tracking code installation rather than manually put the piece of code in each page, etc, etc., etc. A couple of questions... 1.) Is the site too large to move to WordPress? 2.) If I move the site to WordPress, should I go ahead and plan on moving the site to a better hosting server? 3.) How hard is it to migrate a site like this? Unless it's as easy as using an FTP client and moving the files around, I'd really like to hire someone to do it. What type of fees would I be looking at to have someone professionally migrate the site? 4.) Lastly, if you think this is a bad idea, what alternative might you suggest? Thanks ahead of time for all the help! I look forward to getting to know some folks around here.


Best way to version control WordPress template files?

The built-in ability to restore revisions of posts and pages in Wordpress is great. Is there something that gives the same power to template files in the theme-editor? Perhaps a plugin?


Single article separated into multiple pages makes Facebook Like button detect as completely separated articles

I run a multiple author Wordpress platform where authors post articles where many of them are separated in several pages. The visitors can navigate the pages within the article by clicking on a `Next` button. This is various types of articles like galleries, lengthy articles, lists etc I am sure you are all familiar with the Next button by now. The issue here is that the Facebook like button cannot detect that it is **one** article and treats it as completely separate pages. This is the **valid** XHTML 1.0 code I use for the Like button:               <!--[if IE]>     <iframe src="http://www.facebook.com/plugins/like.php?href=<?php echo urlencode("http://domain.com" . $_SERVER["REQUEST_URI"]); ?>%2F&layout=button_count&show_faces=true&width=300&action=like&font&colorscheme=light&height=21" scrolling="no" frameborder="0" style="border-style:none; overflow:hidden; width:200px; height:21px;" allowTransparency="true">     </iframe>     <![endif]-->     <!--[if !IE]>-->     <iframe src="http://www.facebook.com/plugins/like.php?href=<?php echo urlencode("http://domain.com" . $_SERVER["REQUEST_URI"]); ?>%2F&layout=button_count&show_faces=true&width=300&action=like&font&colorscheme=light&height=21" style="border-style:none; overflow:hidden; width:200px; height:21px;">     </iframe>     <!--<![endif]-->      The IE conditions are there so that it works correctly in IE8. The URL of the articles are like this. The original first page is:               http://domain.com/title-of-the-article/      And the second page is:               http://domain.com/title-of-the-article/2/      And so on... **How do I make it so that the Like button detects the second page as the first (original) page and avoid separating them as different**? I have tried hunting down a solution on Google without any direct results, someone mentioned to change `og:url` meta tag on the 'sub' pages to all point at the main URL for the article...


Getting attribute value from shortcode

I have this shortcode                 [learn_more caption="something here:"]       [/learn_more]      I want to extract the caption value and remove other stuff. "something here:" This is the code that I have, but it print the shortcode as it is.                $exclude_codes = 'learn_more';      $wp_content = preg_replace("~(?:\[/?)(?!(?:$exclude_codes))[^/\]]+/?\]~s", '', $wp_content);       Thanks


Link for 'Show all Events Categories'

I expect this is a silly question but could you please tell me, what is the link to 'show all categories' in the event organiser plugin By Stephen Harris. Sorry to be daft.


List only child categories within posts

I am using the_category() to display categories in my posts that are also filed in child-categories. Unfortunately this also displays the parent category which i would love to hide. Is there a way to only display the child categories and not the parent category? Thanks in advance!


How to use the _S framework

I've previously done Tumblr themes and this is my first Wordpress theme. After initially starting out a theme from scratch I decided to switch to _S due to time constraints. My issue is that I may have misunderstood what _S is, so I'm here to get some clarity on a few things.   1. First off, I decided to go with the _S theme as what I understand is that it has all the functionality side of things already done (functions & other PHP) as the site I'm intending to make does not need fancy functionality right now, so this would let me get on with the design aspects. Is this a correct assumption and what exactly is _S?   2. I had a look at the `style.css` as well as layout folder, and my main issue is here. I'm intending to build a site with my own particular layout so should I replace all the CSS in `style.css` with my own? I'm not sure if I should as most of it seemed just to be good practice CSS to make sure things work but could I be wrong in this and is it there more for stylistic purposes? Then there's the issue with my own, actual CSS for the site, should I just place it under the CSS already in `style.css` or make it on a new file and have that linked in? Basically all I want to do is get on with detailing how the particulars of my visuals are at the moment, can i do this with _S? Also would _S allow me to add my own particular functionality easily or would I be better off with making my own parent theme as I want to avoid modifying a theme?


How to add a php custom page to Wordpress

I want to create a custom page for my Wordpress blog that will execute my php code in it, whilst remaining a part of the overall site css/theme/design. The php code will make use of 3rd party APIs (so I need to include other php files) How do I accomplish this? N.B. I do not have a specific need to interact with the Wordpress API - apart from including certain other php libs I need I have no other dependencies in the PHP code I want to include in a WP page. So obviously any solution that didn't require learning the WP api would be the best one.please help me to slove this problem.


Hide the post count behind Post Views (Remove All, Published and Trashed) in Custom Post Type

I need to hide/remove the numbers behind the Edit screen in the backend. All (30) | Published (22) | Draft (5) | Pending (2) | Trash (1) As I am running a multi author blog and each author has just access to its own posts, I dont want to publish the cumulated information of all authors. With the following code the views are completely unset, but I dont want to remove the whole functionality:               function remove__views( $views ) {     unset($views['all']);     unset($views['publish']);     unset($views['trash']);     return $views;     }     add_action( 'views_edit-post',  'remove_views' );     add_action( 'views_edit-movie', 'remove_views' );      Has anybody an idea, how I can either hide/remove the numbers behind the edit screen or - at best - to show only the numbers related to each author?


wp_editor and WPAlchemy messes up tags when updating

when using wp_editor, I paste my text in the visual editor. If I switch to HTML editor, all of my tags are there. So far, no problem. When I update the thing, all of my tags appear in my visual editor and in HTML, they become something like :               <p><strong>      If I update again, the tags appear on my page. So i'm stuck in editing my text only one time. If I update more than one time, the tags appear and everything gets messed up. Anyone got a clue of what's appening? I'm using that line to create the wp_editor:               <?php $metabox->the_field('shortText'); ?>
         <label for="<?php $metabox->the_name(); ?>">Text         <?php wp_editor($metabox->get_the_value(), $metabox->get_the_name(), $settings); ?>
      Thanks! EDIT: The problem is with               $metabox->get_the_value()      It parses the code with the tags, wich then messes up everything. Is there a way to parse the value in the HTML editor and not the visual editor? ADDED SOURCE: Input:               Faire des sorties de groupe et briser l’isolement. Venez vivre une activité entre gens qui vivent les mêmes choses, sentir la force du groupe plutôt que l’isolement.      Output (var_dump):               string(594) "
Faire des sorties de groupe et briser l’isolement. Venez vivre une activité entre gens qui vivent les mêmes choses, sentir la force du groupe plutôt que l’isolement.

Le Regroupement vous propose des sorties de groupe pour faciliter le plaisir en vivant des expériences comme vivent les « autres familles normales ». Nos sorties sont dépourvues d’obstacles et se vivent sans les soucis de se faire identifier parmi le groupe.
"      And then the function get_the_value();               /**      * @since    1.0      * @access    public      */     function get_the_value($n = NULL, $collection = FALSE)     {         $this->_meta(NULL, TRUE);              $value = null;              if ($this->in_loop)         {             if(isset($this->meta[$this->name]))             {                 $n = is_null($n) ? $this->subname : $n ;                      if(!is_null($n))                 {                     if ($collection)                     {                         if(isset($this->meta[$this->name][$this->current]))                         {                             $value = $this->meta[$this->name][$this->current];                         }                     }                     else                     {                         if(isset($this->meta[$this->name][$this->current][$n]))                         {                             $value = $this->meta[$this->name][$this->current][$n];                         }                     }                 }                 else                 {                     if ($collection)                     {                         if(isset($this->meta[$this->name]))                         {                             $value = $this->meta[$this->name];                         }                     }                     else                     {                         if(isset($this->meta[$this->name][$this->current]))                         {                             $value = $this->meta[$this->name][$this->current];                         }                     }                 }             }         }         else         {             $n = is_null($n) ? $this->name : $n ;                  if(isset($this->meta[$n]))             {                 $value = $this->meta[$n];             }         }              if (is_string($value) || is_numeric($value))         {             if ($this->in_template)             {                 return htmlentities($value, ENT_QUOTES, 'UTF-8');             }             else             {                 // http://wordpress.org/support/topic/call-function-called-by-embed-shortcode-direct                 // http://phpdoc.wordpress.org/trunk/WordPress/Embed/WP_Embed.html#run_shortcode                      global $wp_embed;                      return do_shortcode($wp_embed->run_shortcode($value));             }         }         else         {             // value can sometimes be an array             return $value;         }     }


Turn off trackback/pingbacks and comments on all existing multisite sites

I want to turn of trackbacks and pingbacks. Is there a way to turn them off on all existing posts and pages on all sites within a multi-site install? Then set the option not to allow trackback and pingsbacks in the setting for each existing sites?


Changing Menu Fonts Design

I am using the 2011 theme and I would like to make the font that appears on the primary menu bigger and more stylish, is it possible for me to achieve this and if so, how to I go about it.


How to restrict images in v3.5 Media Library modal to only those from a specific post id?

How can someone restrict the images which appear in the v3.5 Media Library modal to only show those that are attached to a specific post id? I'm creating a front-end management template that allows multiple authors to edit any particular post, hence the need to restrict what is shown on a post- by-post basis rather than those uploaded by a particular user. The upload modal is based off of Mike Jolley's upload modal tutorial. It's been modified to look for the post id in the body class and attach uploaded media to that $pid. This is the complete modal js so far:               // Uploading files     jQuery(document).ready(function($) {            var file_frame;       var wp_media_post_id = wp.media.model.settings.post.id; // Store the old id            var classes = $('body').attr('class'); // get all classes from <body> element       var set_to_post_id = classes.match(/postid-(\d+)/)[1]; // pid to attach media to            jQuery(document).on('click', '.upload_image_button', function(){              event.preventDefault();              // If the media frame already exists, reopen it.         if ( file_frame ) {           // Set the post ID to what we want           file_frame.uploader.uploader.param( 'post_id', set_to_post_id );           // Open frame           file_frame.open();           return;         } else {           // Set the wp.media post id so the uploader grabs the ID we want when initialised           wp.media.model.settings.post.id = set_to_post_id;         }              // Create the media frame.         file_frame = wp.media.frames.file_frame = wp.media({           title: jQuery( this ).data( 'uploader_title' ),           button: {             text: jQuery( this ).data( 'uploader_button_text' ),           },           multiple: false  // Set to true to allow multiple files to be selected         });              // When an image is selected, run a callback.         file_frame.on( 'select', function() {           // We set multiple to false so only get one image from the uploader           attachment = file_frame.state().get('selection').first().toJSON();                // Do something with attachment.id and/or attachment.url here                // Restore the main post ID           wp.media.model.settings.post.id = wp_media_post_id;         });              // Finally, open the modal         file_frame.open();            });            // Restore the main ID when the add media button is pressed       jQuery('a.add_media').on('click', function() {         wp.media.model.settings.post.id = wp_media_post_id;       });          });      The two primary authoritative WPSE threads on Media Library only deal with restricting by user.   * Restricting Users to View Only Media Library Items They Have Uploaded?   * Media library to list images only user uploaded Another WPSE reference is Limit Media Library to Given Folder. Any direction is appreciated.


Plugin constructor called multiple times

I have plugin with the following structure -               class emailPlg {                 static $tableName;             static $pluginDbVersion = 1.0;                 function __construct() {             global $wpdb;             emailPlg::$tableName = $wpdb->prefix . 'emails';             $installedPluginVer = get_site_option(EMAIL_VER);             if ($installedPluginVer != cases::$pluginDbVersion) {                 $this->buildDb();                     }                         add_action('wp_ajax_emailsActionTag', array($this,'handleRequests'));             add_action('wp_ajax_nopriv_emailsActionTag', array($this,'handleRequests'));             add_action('wp_enqueue_scripts', array($this,'enqueScripts'));         }              function buildDb() {            }              function handleRequests() {             $recvData = $_POST['dataToProcess'];             $respData = call_user_func(array($this, $recvData['method']), $recvData['data']);             ob_clean();             echo json_encode($respData);             die();         }                         function enqueScripts() {             wp_enqueue_script('emails-js', plugins_url('/js/email.js', __FILE__), array('jquery'));                 }     }     add_action('plugins_loaded', 'loadEmails');          function loadEmails() {         new emailPlg();     }      While debugging in Netbeans with xDebux, I noticed that the `class constructor` and `loadEmails` is getting called multiple times. Is this normal? _I'm calling this plugin through ajax_. Does `call_user_func` call the constructor everytime? I am making multiple `AJAX` calls to different plugins, could that be causing this?


get_permalink() echoing about us page link only. how to solve this.?

I am trying to build an own theme for my wordpress site. I am using the following code to get a 3 posts on my home page.               $paged = (get_query_var('paged')) ? get_query_var('paged') : 1;         $args = array('cat'=> 1, 'posts_per_page' => 3, 'paged' => $paged );                 query_posts( $args);               while (have_posts()) : the_post();         $excerpt = get_the_excerpt();              the_title('
', '
');              if (strlen(get_the_content()) > 100) {                                 $content = get_the_content();                                 echo str_replace(' ', '

', substr($content, 0, 300)). "....";                                    echo '
Read More';                             }         else { the_content(); echo "
"; }         endwhile;      It's giving the 3 posts on my page. But all the **TITLES** and **Read more** buttons **href** attributes getting **myblog.com/about_us** link only. When I click the titles of the posts and read more buttons, those are redirected to the about us page. What I am doing wrong? in function.php I do not have any coding for posts or excerpt. [UPDATE] I do not have any **about us** page too.


Wordpress theme Modifications not showing up on live server

I have been working on localhost with a theme that was already installed on live server. After i completed my mods, uploaded the files to themes folder in wp-content but to my disappointment, the same old non-customized theme was showing up. Then I thought if I add my custom css codes to css editor then it will work fine but even after that nothing was showing up and I ended up with a totally messed up site. I tried to empty all the caches but still no luck. Before installing my custom theme, I actually deleted all the files associated with the old theme and then re-installed my own custom theme. For the sake of information, I am using Genesis Framework and I modified Genesis Sandbox HTML5 child theme. It works like a magic on my localhost but I don't know how to get it working. Please help me. Any help will be appreciated. Thanks for reading.


how to change the verification url of pie register plugin of wordpress?

how can I change the verification url of pie register plugin? when any user registers it send a verifiaction url like this " http://mydomain.com/wp- login.php?piereg_verification=b902g752h4f079d629982f6386&redirect_to=http://mydomain.com/thank- you-for-registering/ " now how can i replace that wp-login.php with my custom login page and that "pie_verification" part also.I checked other registration plugins also but those doesn't even send an email to users. Someone please help.


Display single event not found error | Sugar Events Calendar Lite

I’ve install this plugin but i have an error. If I try lo look the single event on calendar i have an 404 error. Link, here is the error Link with error I've tried to re-save the permalink setting but nothing change. I try make some change. With all permalink the url function but if i select post-name ad permalink i have an 404 error? Why? I've looked in this question wordpress.org/support/topic/doesnt-show-single- event?replies=15 . But how can i do to change the path events on post permalink? How can i resolve the problem?


chained drop-down menu for custom taxonomy using chained.js -- not quite working

So, Im trying to get a chained select to work to select a state then a city with that state. (2 fields). Here is what Ive got: First my function to create the menu using get_categories(). First problem: Not sure what to put for $child to get it to only show child categories.               function taxonomy_dropdown($dropID, $exclude, $taxonomy, $parent, $child) {         $args = array(             'type'                     => 'post',             'child_of'                 => $child,             'parent'                   => $parent,              'orderby'                  => 'name',             'order'                    => 'ASC',             'hide_empty'               => 0,             'hierarchical'             => 1,             'exclude'                  => $exclude,             'include'                  => '',             'number'                   => '',             'taxonomy'                 => $taxonomy,             'pad_counts'               => false         );              $categories = get_categories( $args );              $menu = '<select name="'.$dropID.'" id="'.$dropID.'" class="postform">';              foreach($categories as $category) {             $menu .= '<option class="" value="'.$category->name.'">'.$category->name.'</option>';         }            $menu .= '</select>';         echo $menu;     }      In my plugin, the function is called like so:               <?          taxonomy_dropdown('state','','states_category','0');          taxonomy_dropdown('city','','states_category','','1');     ?>      The second one for 'city' doesnt work because of the above problem of I cant get it to only get the child categories. So once I get that to work, I should have 2 selects, one showing 'states' and one showing 'cities.' Now here is where I get lost. I want to use chained.js (http://www.appelsiini.net/projects/chained) to turn these two select menus into a chained select. Im pretty sure Ive enqued it into my plugin properly:               function includeChained() {         wp_enqueue_script(             'chained',             plugins_url( '/js/chained/chained.min.js' , __FILE__ ),             array( 'jquery' )         );     }     add_action( 'wp_enqueue_scripts', 'includeChained' );      Now Im totally clueless about how to use jquery and javascript beyond the ultra basics. I tried what the docs show for using the class based usage:               <script>     $("#state").chained("#city");     </script>      But nothing happens. If anybody could help I would be greatly appreciative! Thanks!!


Plugin Label Text Wont change

I have a Private Content plugin installed on 3.7.1 and I am trying to translate some texts from the plugin via FTP but they wont update. I even activated the TwentyEleven theme to make sure there isn't any conflicts with that. This was a process that I had done before, to the exact line of code so I am sure that there must be something wrong with the installation. Here is my Installation: Wordpress 3.7.1 on PHP 5.3 Premium Plugins: Warp 7, Private-Content, QubeAdmin Other Plugins : WidgetKit, Ultimate ComingSoon Premium Theme: Square by YooTheme


Mass/Bulk assign featured images to posts

I have a text file with post ids and attachment ids like so:               post_id,attachment_id     post_id,attachment_id     post_id,attachment_id     post_id,attachment_id      I then try to use a function inside my functions.php file like so:               function addimg() {     $fh = @fopen( dirname( __FILE__ ) . '/addimg.txt', 'r' );          if ( $fh ) {         while ( ( $line = fgets( $fh ) ) !== false ) {             $ids = explode( ',', $line );             array_walk( $ids, 'trim' );             $postid = array_shift( $ids );             set_post_thumbnail( $postid, $ids );         }     }     }     add_action('wp_head', 'addimg');      But nothing happens. I've used the same procedure to add categories to posts and it works. I've also tried to manually add a featured image to a post like so:               function thumb() {          set_post_thumbnail( 1, 1);          }     add_action('wp_head', 'thumb');      And that works. So my knowledge is too shallow to understand why what I'm trying to do doesn't work?


Trying to fix multiple category drop down

I'm having some problems trying to fix my category drop down on the website i'm developing. Basically one drop down filters has "Sort by Location" and the second one is "Sort by Price" The first one is working correctly which is "Sort by Location" but the second one doesn't. It is loading all the post and not filtering properly. Here is the link - http://digitalspin.ph/federalland/?page_id=23 Here is my code **HTML-**
             <?php wp_dropdown_categories( $args_cat1 ); ?>

             <?php wp_dropdown_categories( $args_cat2 ); ?>
      **JS-**                                              **Functions.php**               //LOCATION FILTER          $args_cat2 = array(     'show_option_all'    => '',     'show_option_none'   => '',     'orderby'            => 'ID',      'order'              => 'ASC',     'show_count'         => 0,     'hide_empty'         => 1,      'child_of'           => 0,     'exclude'            => '1,2,3,4,32,33,34,35,36,37',     'echo'               => 1,     'selected'           => 0,     'hierarchical'       => 0,      'name'               => 'cat2',     'id'                 => 'cat2',     'class'              => 'postform',     'depth'              => 0,     'tab_index'          => 0,     'taxonomy'           => 'category',     'hide_if_empty'      => false,     'walker'             => ''     );          //PRICE FILTER          $args_cat1 = array(     'show_option_all'    => '',     'show_option_none'   => '',     'orderby'            => 'ID',      'order'              => 'ASC',     'show_count'         => 0,     'hide_empty'         => 1,      'child_of'           => 0,     'exclude'            => '1,2,3,4,23,24,25,26,27,28,29,30,31',     'echo'               => 1,     'selected'           => 0,     'hierarchical'       => 0,      'name'               => 'cat1',     'id'                 => 'cat1',     'class'              => 'postform',     'depth'              => 0,     'tab_index'          => 0,     'taxonomy'           => 'category',     'hide_if_empty'      => false,     'walker'             => ''     );      Here is a javascript error from firebug-               TypeError: dropdown is null     dropdown.onchange = onCatChange;      Whenever i pick a category in "Sort by Price" it display all the post from "Sort by Location" which is category ID 23 ----UPDATED CODE ----


Pagenav Not appearing on custom Template

I've just finished building a custom page template using the following code. The issue is the pagenav doesn't work - But works on every other page with multiple posts. I want this one to appear if there is more then 5 posts in that relevant Category.               <?php     /*       Template Name: specialoffers      *      */     ?><?php global $up_options ?>     <?php get_header(); ?>

                              <?php                         $args = array(                              'post_type' => 'property',                             'posts_per_page' => 5,                             'paged' => get_query_var( 'paged' ),                             'tax_query' => array(                                 array (                                     'taxonomy' => 'sale_type',                                     'field' => 'slug',                                     'terms' => 'special offers'                                        )                                 )                                  );                     $query = new WP_Query ( $args ); ?>                                              <?php if ($query->have_posts()) : ?>                         <?php while ($query->have_posts()) : $query->the_post(); ?>

                                          <?php the_post_thumbnail('special'); ?>
<?php the_field('special_offer'); ?>

<?php the_title(); ?>

<?php the_content(); ?>

<a href="<?php the_permalink(); ?>">Full Details

                                 <?php                                 $attachment_id = get_field('location_image');                                 $size = "thumbnail"; // (thumbnail, medium, large, full or custom size)                                  $image = wp_get_attachment_image_src( $attachment_id, $size );                                 // url = $image[0];                                 // width = $image[1];                                 // height = $image[2];                                 ?>                                 <img src="<?php echo $image[0]; ?>" />
<?php the_field('location'); ?>

                             <?php endwhile; ?>                         <?php endif; ?>
                         <?php wpld_pagenavi(); ?>

          <?php get_footer(); ?>      Code for the wpld_pagenavi function to produce the pagenavi.               function wpld_pagenavi() {         global $wp_query, $wp_rewrite;         $pages = '';         $max = $wp_query->max_num_pages;         if (!$current = get_query_var('paged'))             $current = 1;         $a['base'] = ($wp_rewrite->using_permalinks()) ? user_trailingslashit(trailingslashit(remove_query_arg('s', get_pagenum_link(1))) . 'page/%#%/', 'paged') : @add_query_arg('paged', '%#%');         if (!empty($wp_query->query_vars['s']))             $a['add_args'] = array('s' => get_query_var('s'));         $a['total'] = $max;         $a['current'] = $current;              $total = 1; //1 - display the text "Page N of N", 0 - not display         $a['mid_size'] = 5; //how many links to show on the left and right of the current         $a['end_size'] = 1; //how many links to show in the beginning and end         $a['prev_text'] = '« Previous'; //text of the "Previous page" link         $a['next_text'] = 'Next »'; //text of the "Next page" link              if ($max > 1)             echo '
';         if ($total == 1 && $max > 1)             $pages = 'Page ' . $current . ' of ' . $max . '' . "\r\n";         echo $pages . paginate_links($a);         if ($max > 1)             echo '
';     }      If someone could kindly explain to me why its not appearing that would be fantastic! Many Thanks


How Can I Use $wpdb in PayPal IPN file?

I'm currently writing a plugin that requires the PayPal IPN, since the IPN is not inside the main plugin file, I have no way to use $wpdb. If you know a way to do this that will work with all WordPress installations it would really help me! Thanks in advance!


Getting "wp_list_categories_for_post_type" to link to the right CPT entries

I've got a custom post type called Reports which uses the same default taxonomy of categories as Posts. The code:               wp_list_categories_for_post_type('reports', 'order=DESC&title_li=&child_of=20');      Displays the correct categories for Reports (http://burma.23.co.uk/news/reports/), however, they link through to the entries for Posts. How can I make them link through to the Reports?


How to hide certain categories in wordpress dashboard?

I have two categories which I dont want to show to my site's admin, I want them to be added automatically everytime a new post is creatd or updated. I have the code for it. But now i also want to hide those two categories. This is not for front-end. This is for wodpress dashboard. I dont want that admin will see these two categries at all. But if we hide those still I will be to assign two categories into posts. Any clues???


obtain the author id given the post id

If `$a` contains the ID of a certain post, how can one obtain the corresponding author ID? I've tried with               $b = get_post( $a);     $c = $b->post_author;     $d = $c->ID;      but it does not work.


Jquery Theme Roller to Wordpress

How can you load a custom made Roller Theme for Jquery ui to wordpress? I recently created and downloaded a new theme for the datepicker, but can't get it loaded. I tried adding the css file to my theme files then doing an 'enqueue style' function, but seem to be missing something.               function my_add_styles() {     wp_enqueue_style('datepicker', get_template_directory_uri() . '/lib/js/datepicker.css');     }


Remove "enqueued" script from array

Im working on optimizing a child theme for a site and the parent "has more than we need" Lots of requests being generated all adds up to performance hits. What I'm trying to accomplish is this effect :               wp_dequeue_script('handle')     wp_deregister_script('handle')      But the problem is that `handle` is a child of an array... meaning something like this is enqueuing the scripts initially :               wp_enqueue_script('handle', get_template_directory_uri().'/admin/js/dontwantit.js', array('handleContainer'));      There are any number of enqueued scripted being added to the `handleContainer` queue array. is it possible to cherry pick out the ones I don't want? What would that look like? Thanks in advance


How do I debug an error that a plugin is causing?

I'm having an issue debugging why the plugin I'm creating keeps displaying the error `You need to upgrade your database as soon as possible...`. The work I've done so far has been on a remote dev site, and everything seems to work fine there - with no errors at all. I decided to test what would happen when I throw the plugin into a different environment to see if it would still work fine. Bare in mind that both versions of WordPress are `3.9.1`. The plugin has remained the same, but the servers are different. The only other different thing between the two is one is a multi-site (the original dev site), and the other is just a standard WP install. The first issue I resolved, which was a problem within the way I was creating new tables. For some reason `replace` as a field name was fine on the dev site, but on the vps it wasn't. Possibly due to different versions of MySQL. I was wondering if there is a way to debug what is happening? Why would the database need upgraded?


Taxonomy to WordPress Permalinks of custom post type

I am searching days now for the answer how to add taxonomy to my custom post type permalink. I've found this article which almost exactly gives the answer but it doesn't work for my custom post type. http://shibashake.com/wordpress- theme/add-custom-taxonomy-tags-to-your-wordpress-permalinks The article describes that you first make a simple Taxonomy:               add_action('init', 'my_rating_init');                   function my_rating_init() {             if (!is_taxonomy('rating')) {                 register_taxonomy( 'rating', 'post',                             array(   'hierarchical' => FALSE, 'label' => __('Rating'),                                   'public' => TRUE, 'show_ui' => TRUE,                                 'query_var' => 'rating',                                 'rewrite' => true ) );             }         }      And then you can rewrite the url in your Wordpress system like: /%rating%/%postname% And then you need to translate %rating% to the taxonomy tags by doing:               add_filter('post_link', 'rating_permalink', 10, 3);     add_filter('post_type_link', 'rating_permalink', 10, 3);          function rating_permalink($permalink, $post_id, $leavename) {         if (strpos($permalink, '%rating%') === FALSE) return $permalink;                  // Get post             $post = get_post($post_id);             if (!$post) return $permalink;                  // Get taxonomy terms             $terms = wp_get_object_terms($post->ID, 'rating');                if (!is_wp_error($terms) && !empty($terms) && is_object($terms[0])) $taxonomy_slug = $terms[0]->slug;             else $taxonomy_slug = 'not-rated';              return str_replace('%rating%', $taxonomy_slug, $permalink);     }         This works fine for "post" but when I change:               register_taxonomy( 'rating', 'post',      to:               register_taxonomy( 'rating', 'mycustomposttype',       The URL rewrite doesn't work anymore. And only gives the following url: http://www.website.com/custom-post-type/post Where I want this: http://www.website.com/custom-post-type/taxonomy-tag/post My custom post type code:               function create_mycustomposttype() {              $labels = array(             'name'                => 'mycustomposttype',             'singular_name'       => 'mycustomposttype',             'menu_name'           => 'mycustomposttype',             'parent_item_colon'   => 'Parent artikel:',             'all_items'           => 'Alle artikelen',              'view_item'           => 'Bekijk artikel',             'add_new_item'        => 'Voeg nieuw artikel toe',              'add_new'             => 'Voeg toe',             'edit_item'           => 'Bewerk artikel',              'update_item'         => 'Update artikel',             'search_items'        => 'Zoek artikelen',             'not_found'           => 'Niet gevonden',             'not_found_in_trash'  => 'Niet gevonden in de prullenbak',         );         $args = array(             'label'               => 'mycustomposttype',             'description'         => 'mycustomposttype',             'labels'              => $labels,             'supports'            => array( 'title', 'editor', 'excerpt', 'author', 'thumbnail', 'comments', 'revisions', 'custom-fields', ),             'taxonomies'          => array( 'rating' ),             'hierarchical'        => false,             'public'              => true,             'show_ui'             => true,             'show_in_menu'        => true,             'show_in_nav_menus'   => true,             'show_in_admin_bar'   => true,             'menu_position'       => 5,             'can_export'          => true,             'has_archive'         => true,             'exclude_from_search' => false,             'publicly_queryable'  => true,             'capability_type'     => 'post',             'query_var'         => true,             'rewrite'               => true,         );         register_post_type( 'mycustomposttype', $args );          }      So my 2 questions are:   1. How can I make this work for my custom post type?   2. How can I make this work only for my custom post type? Because I need to add %rating% to my wordpress system (settings -> permalinks) so it changes all my URLS.


Custom Post Type doesn't show Draft and Trash Options

I have custom post type "Pdf"section.But there is no options like Draft and Trash..![kindly find out this on attachment](http://i.stack.imgur.com/jSxET.jpg)


How to re-enable being found by Google

A long time ago when I installed WordPress I enabled the (no robots) or something like it, anyhow Google doesn't show additional details when searching for my site. How do I reverse this? EDIT: My html source:               <meta name="robots" content="noindex,nofollow">      My php Source:               <meta charset="<?php bloginfo('charset'); ?>">


If I delete my wordpress site then does that delete all my sites?

I have 2 wordpress sites, I didn't mean to but create 2 but i did. My main wordpress site I do not want deleted but If i delete the add on site i did not want (I know how to delete sites), will it delete my main site also?


how can I detect that option value has changed?

I am working on a plugin and I want to fire a different action based on each option value change. so how can I do that ? example: $options = get_option('ACP_settings'); if $options['acp-select'] has changed from previous value than I want to fire different action based on selection please note that $option['acp-select'] is retrieved from select/option html form and has following values for selection:'book','air','SW','HW' etc.... I hope I have posted my question clearly. thanks for help


Custom interval is not working

I am trying to create custom interval for cron schedule with given user input, but its not working. Here is the code:               add_filter( 'cron_schedules', 'custom_cron_schedule' );     function custom_cron_schedule( $schedules,$int ) {         $schedules['custom'] = array(             'interval' => $int, // user input integer in second             'display'  => __( 'Custom Interval' ),         );              return $schedules;     }      I tried to look at custom schedule via `_get_cron_array()` and found that interval is missing I also checked `$int`, it has `36000`. So what am I missing here OR am I not allowed to use arguments in this filter?


Linking Plug-In Files to WP

I am writing a plug-in right now which adds a table to the database when activated. I have another file in my plug-in directory which handles a form submission and writes to the database. This file seems to have no link to WP, because it returns NULL when I ask for the **global $wpdb**               <?php     header('Content-type: '.$_POST["mime-type"].'');     header('Content-Disposition: attachment; filename='.$_POST["filename"].'');          global $wpdb;     $table_name = $wpdb->prefix . "my_plugin";     $rows_affected = $wpdb->insert( $table_name, array( 'time' => current_time('mysql') ) );          readfile($_POST["file"]);     exit;     ?>      If I were to make this a custom template file for some private page and then submit forms to that page I think it would work. But I know there must be a way to do this all within the plug-in directory. ### Plug-in Code


Let users upload image(s) to the post from front end

I want to enable logged in users (Wordpress) to submit posts from front end (among with other data). My form is working great, I add custom post meta data which I later display on custom post page. I added `enctype="multipart/form-data"` to form tag. Added this code to functions.php:               function insert_attachment($file_handler,$post_id,$setthumb='false') {         // check to make sure its a successful upload         if ($_FILES[$file_handler]['error'] !== UPLOAD_ERR_OK) __return_false();         require_once(ABSPATH . "wp-admin" . '/includes/image.php');         require_once(ABSPATH . "wp-admin" . '/includes/file.php');         require_once(ABSPATH . "wp-admin" . '/includes/media.php');         $attach_id = media_handle_upload( $file_handler, $post_id );         if ($setthumb) update_post_meta($post_id,'_thumbnail_id',$attach_id);         return $attach_id;     }      And this to the custom post page (where the front end form is):               if ($_FILES) {         foreach ($_FILES as $file => $array) {         $newupload = insert_attachment($file,$pid);         }     };      After this php code I have this code to create post:               $post_information = array(     'post_title' => wp_strip_all_tags( $_POST['title']),     'post_content' => $_POST['content'],     'post_category' => array($_POST['category']),     'post_type' => 'post',     'post_status' => 'pending'     );          $post_information = wp_insert_post($post_information);     add_post_meta($post_information, 'custom1', $_POST['custom1']);     add_post_meta($post_information, 'custom2', $_POST['custom2']);     add_post_meta($post_information, 'custom3', $_POST['custom3']);      Now the post data is added to the new post without problems, and the image is uploaded. I upload image with this:               <input type="file" tabindex="3" name="custom-upload1" id="custom-upload2" />     <input type="file" tabindex="3" name="custom-upload2" id="custom-upload2" />     <input type="file" tabindex="3" name="custom-upload3" id="custom-upload3" />      Now I need to find a way to save and show image on the created custom post. I was thinking about this two options:   1. Save the uploaded image URL in a custom field.   2. Save image directly to the post. For my case the first option would be better, but I do not know how to do this. Is there any way to save like that:               add_post_meta($post_information, 'imageURL', $_POST['imageURL']);      But i do not know how to pass the image URL variable to 'imageURL'. Is there any option to do that?


How to change menu order item

Hello I have a main menu in my website               Home | How to start | about | contact | categories      but I add one item that lists all categories in functions.php               add_filter('wp_nav_menu_items', 'category_list', 10, 2);     function category_list($items, $args)     {         if( $args->theme_location == 'header' )         {             $items .= '
Kategorie
';             $categories = get_categories();             foreach ($categories as $category)             {                 $option = '
term_id ).'">';                 $option .= $category->cat_name;                 $option .= '
';                 $items .= $option;             }                  $items .= '

';         }         return $items;     }     How       How I can change the order of this item. I can't see it in Appearance->menu I want to move it to second position in menu.               Home | Categories | How to start | about | contact


Administrator role capabilities

I need to make that administrator could'nt manage options, but it is not working... My code:               function set_capabilities() {          $editor = get_role( 'administrator' );          $editor = remove_cap('manage_options');     }     add_action( 'admin_init', 'set_capabilities' );      What I do wrong ?


How Do I Delete WordPress Posts Older Than 400 Days, From A WordPress Category

I have tried the following phpMyAdmin query in an effort to delete all posts, from wordpress category 378, that are over 400 days old. `delete a,b,c,d FROM wp_posts a LEFT JOIN wp_term_relationships b ON ( a.ID = b.object_id ) LEFT JOIN wp_postmeta c ON ( a.ID = c.post_id ) LEFT JOIN wp_term_taxonomy d ON ( d.term_taxonomy_id = b.term_taxonomy_id ) LEFT JOIN wp_terms e ON ( e.term_id = d.term_id ) WHERE e.term_id =378 AND DATEDIFF(NOW(), `post_date`) > 400` The query seems to have deleted that entire category, and all its posts, instead. How do I make a phpMyAdmin query that will just delete any posts over 400 days old, from that particular category. I am looking for the exact query that I can use; so that all I need to do with an answer is ensure the category id is correct and, then, run it. I do have database backups. note: My wordpress database contains nearly 300,000 posts; so, I have encountered too many problems, which resulted in failure, trying to delete the posts from within the dashboard of wordpress.


Very slow query with meta_query on large database

I have a blog with about 200k posts and each one have 20 custom fields. I've been using WordPress Transients_API to cache queries, in the few cases where it can be used, but it can't be used in some other queries due to the nature of the blog. My blog is http://fixapk.com There is a problem when accessing applications (`single.php`). My code to retrieve the relevant articles using the custom field *'_similar_apps'*, is as follows:               $args = array(       'showposts' => 10,       'post_type' => 'post',       'meta_query' => array(         'relation' => 'OR',          array(            'key' => '_similar_apps',            'value' => $mainlink,            'compare' => 'LIKE'          ),        ),     );     $q = new WP_Query( $args );          if ( $q->have_posts() ) : while( $q->have_posts() ): $q->the_post();       // Do something....      But it is very slow. You can visit following link to open an article and see its speed http://fixapk.com/chrome-samsung-support-library/ ...it takes about 6-10 second to load. So, how can I optimize queries with `meta_query`? Thank you very much!


include script that depends on modernizr?

first time i am trying to include script to wordpress,but after several hours reading wordpress codex and answers all over the web ,i still dont success to link the script to modernizr, they both show in the head of the page as if they were registerd correctly but the script still ignores modernizr. here is the code in function.php               function childtheme_script_manager() {     wp_register_script('new_service', get_template_directory_uri() .'/js/modernizr.custom.79639.js', array('jquery'), true, true);     wp_enqueue_script('new_service');     }          add_action('wp_enqueue_scripts', 'childtheme_script_manager');          function twentyfourteen_child_scripts() {          wp_enqueue_script('twentyfourteen_child_scripts',   get_template_directory_uri().'/js/jquery.swatchbook.js');     }          add_action( 'wp_enqueue_scripts', 'twentyfourteen_child_scripts' );


How can I sort posts by the date and a custom meta field?

I have `custom meta field` that I use for the post `rating`. So I want to display posts by the `date` and the `rating`, but only for the posts that have specific rating. For example, I want to display posts with rating above 3, and in this order: by the rating (highest first), but grouped by the date (today's best rated, then yesterday's best rated, etc.). Can I do it with `WP_Query($args=array())` class?


How to create tag.php

How do I create a tag.php template that will work for every post that contain tags? I created few Tags like = Food, Drink and Fruit > post 1 have Food and Drink tags > > post 2 have Food and Fruit tags How do I create a single page for those post of the tags? My code looks like this, but it didn't show anything.               function get_tags_post($tag_name){         $original_query = $wp_query;         $wp_query = null;         $brand_name= $tag_name;         $args=array(             'posts_per_page'=>5,              'tag' => $brand_name         );         $wp_query = new WP_Query( $args );         if ( have_posts() ) : while (have_posts()) : the_post();             echo '<li>';             single_tag_title();             echo '</li>';         endwhile; endif;         $wp_query = null;         $wp_query = $original_query;         wp_reset_postdata();     }      Please, if anyone knows which part of the code is wrong, tell me.


Remove old custom field after import

I have imported a set of posts to a new Wordpress install recently. This OLD set of posts had a set of custom fields attached to it (via post_meta using the ACF plugin). The new installation has almost the same fields, with a couple of exceptions. On the posts that have the old (no longer used) custom fields the back-end is still showing those fields when I go to edit the post, even though I do not have them set up in the CURRENT Wordpress installation. I can only assume this is because the values are in the database (via the import) so Wordpress is displaying them. How would I go about removing these custom fields and values from the database safely so they do not show up in the post edit screen anymore on the new install?


How to create an Single-Portfolio page?

I created a portfolio page to show my works for my theme Everything is ok on my portfolio page, but when I click on an link to go to the portfolio object page, it uses the template's single.php page. I would like it to use the template page I created "single-portfolio.php". How do I do this?


How to update BuddyPress xprofile fields programmatically?

I update user info using `wp_update_user` function. I also need to update the table `wp_bp_xprofile_data`. Is there any function, where I can update data on `wp_bp_xprofile_data` table?


Fetching Gravatar

How can I fetch anyone’s gravatar image? I need to show users gravatar image on a custom profile page that am making. I have so far integrated the option of Facebook Profile Pic (which automatically gets grabbed) and also am allowing user to assign his/her own photo (on wish). What I need to do is, if person do not comes from FB, then maybe his email or something should be used to see if he/she has a gravatar, if yes then display it. How can I do that? Thanks.


Cannot modify header form resubmits data on refresh

I have a contact form that each time I refresh the page I get a prompt to resend all the data, I have added a header("location: location.php"); to the bottom of the form function to try and prevent this. However all I get is a Cannot Modify Header Information - Headers already sent error. Here is my code               <?php     /*     Template Name: form-test.php     */     include_once( ABSPATH . 'wp-admin/includes/plugin.php' );     include_once(ABSPATH. 'wp-content/themes/fiftyfityNew/contact-form.php');     get_header(); ?>                         <?php function make_user_feedback_form() {         global $wpdb;         global $current_user;                  $ufUserID = $current_user->ID;                  if ( 'POST' == $_SERVER['REQUEST_METHOD'] && !empty( $_POST['action'] ) && $_POST['action'] == 'updateFeedback' ) {                 $ufDataUpdate = $wpdb->insert( 'wp_user_feedback', array( 'date' => current_time('mysql'), 'responses' => $_POST["test"]) );             }             }?>

             <form method="post">
Pick a date Babe:<input type="text" id="datepicker" name="test" value="" />

<input name="submit" type="submit" id="submit" class="submit button" value="Send feedback" />
                 <?php wp_nonce_field( 'updateFeedback' ); ?>                 <input name="action" type="hidden" id="action" value="updateFeedback" />             </form>

         <?php           add_action('the_content','make_user_feedback_form');          header("location: http://localhost:8888/fiftyfity/?page_id=90");          ?>          <?php     make_user_feedback_form();     ?>          <?php get_sidebar(); ?>     <?php get_footer(); ?>


Running a function on post content and CPT meta

As per this thread I'm scheduling a `wp_cron` every hour which runs a function. The function I'm running is reasonably lengthy and I didn't want authors to have to deal with the waiting times. My question is this - when creating a function which runs from the following code (`$ids` is a list of post IDs):               $ids = unserialize( get_option( 'my_updated_posts' ) );     foreach( $ids as $v ) {         YOUR_FUNCTION_HERE( $v );     }      How do I **a)** retrieve content if the `id` relates to a `Post` type and then update it, or **b)** update meta fields if said `id` is actually a `species` Custom Post Type? For **b)** , will I have to update each meta field individually or is there a filter I can apply? Thanks in advance,


Plugin recommendation - StackExchange style Q&A

Happy to spend a bit of money to get this right. I'm looking for a comprehensive Q&A plugin which has the following features:   * Can be used with my very customised theme   * Ability to ask questions   * Ability to post answers   * Ability to ask comments on both questions and answers   * Reputation and voting system, similar to WPSE etc.   * Ability to attach images in questions and answers   * Rich text editor (preferably `wp_editor` style but I'll put up with something else if I have to). Italic text is _mandatory_ for writing scientific names. I'd also _like_ the following:   * Badges which I can rename/add descriptions to   * Bounties I paid a fair amount of money for the Q&A Plugin subscription and it was hopeless. Looks good on the outside, but no comments or media attachment which makes the system useless in my eyes. Nor does it have anything above reputation for engagement. I know there have been other Questions on this subject and I've looked into those, but I have quite specific requirements where the others appear not to. I've seen AskIt which appears not to have a rich text editor or the facility to attach media. I've also seen Sofa Q&A which appears to be an entire theme rather than just a plugin, though I have asked the author if it would work with my site. Does anyone have any other suggestions? There must be something out there!


how to get posts by custom post type then display Custom fields?

I have custom posts types for Recipes, and within that I have set up Advanced Custom Fields (from the plugin.) Within, that custom post type, I have several categories. Two questions: 1.) How do I get all posts from a custom category? I get how to display the custom fields, but not sure how to call all the posts from a custom category, then I can display it's title, image, and link. 2.) In a custom post type scenario am I better off setting up custom categories as well or use the generic post categories? I've tried the get_posts, then tried by getting posts by custom category. for example               <?php     $args = array(          'posts_per_page' => 8,          'orderby' => 'rand',          'post_type' => 'recipes',          'type' => 'side-dishes',          'post_status' => 'publish'     );     $show_albums = get_posts( $args );     ?>      I don't know the exact implementation, since post_type is a custom post, and figure I would have to do some for-each probably to then use the_field (from ACF) =========================================================== Ok after taking suggestion below here is what I have please let me know if I am doing this correct? here is the query - which seems to work:               <?php          // The Query     $the_query = new WP_Query($args = array(         'post_type' => 'recipes',         'custom_cat' => 'side-dishes'     ) );          // The Loop     if ( $the_query->have_posts() ) {             echo '
';         while ( $the_query->have_posts() ) {             $the_query->the_post();             echo '
' . get_the_title() . '
';         }             echo '
';     } else {         // no posts found     }     /* Restore original Post Data */     wp_reset_postdata();?>      I registered the taxonomy, but what's confusing me is that, my registered post-type is recipes, shouldn't register_taxonomy be "recipes" and not 'custom_cat?"               register_taxonomy( 'custom_cat',              array('recipes'), /* if you change the name of register_post_type( 'custom_type', then you have to change this */             array('hierarchical' => true,     /* if this is true, it acts like categories */                 'labels' => array(                     'name' => __( 'Recipe Categories', 'bonestheme' ), /* name of the custom taxonomy */                     'singular_name' => __( 'Recipe Category', 'bonestheme' ), /* single taxonomy name */                     'search_items' =>  __( 'Search Recipe Categories', 'bonestheme' ), /* search title for taxomony */                     'all_items' => __( 'All Recipe Categories', 'bonestheme' ), /* all title for taxonomies */                     'parent_item' => __( 'Parent Recipe Category', 'bonestheme' ), /* parent title for taxonomy */                     'parent_item_colon' => __( 'Parent Custom Category:', 'bonestheme' ), /* parent taxonomy title */                     'edit_item' => __( 'Edit Custom Category', 'bonestheme' ), /* edit custom taxonomy title */                     'update_item' => __( 'Update Custom Category', 'bonestheme' ), /* update title for taxonomy */                     'add_new_item' => __( 'Add New Custom Category', 'bonestheme' ), /* add new title for taxonomy */                     'new_item_name' => __( 'New Custom Category Name', 'bonestheme' ) /* name title for taxonomy */                 ),                 'show_admin_column' => true,                  'show_ui' => true,                 'query_var' => true,                 'rewrite' => array( 'slug' => 'custom-slug' ),             )         );      here is the registered post type:               function create_recipe() {          // creating (registering) the custom type          register_post_type( 'recipes', /* (http://codex.wordpress.org/Function_Reference/register_post_type) */             // let's now add all the options for this post type             array( 'labels' => array(                 'name' => __( 'Recipes', 'bonestheme' ), /* This is the Title of the Group */                 'singular_name' => __( 'Recipe', 'bonestheme' ), /* This is the individual type */                 'all_items' => __( 'All Recipes', 'bonestheme' ), /* the all items menu item */                 'add_new' => __( 'Add New Recipe', 'bonestheme' ), /* The add new menu item */                 'add_new_item' => __( 'Add Recipe', 'bonestheme' ), /* Add New Display Title */                 'edit' => __( 'Edit', 'bonestheme' ), /* Edit Dialog */                 'edit_item' => __( 'Edit Recipe', 'bonestheme' ), /* Edit Display Title */                 'new_item' => __( 'New Recipe Type', 'bonestheme' ), /* New Display Title */                 'view_item' => __( 'View Recipe', 'bonestheme' ), /* View Display Title */                 'search_items' => __( 'Search Recipes', 'bonestheme' ), /* Search Custom Type Title */                  'not_found' =>  __( 'Nothing found in the Database.', 'bonestheme' ), /* This displays if there are no entries yet */                  'not_found_in_trash' => __( 'Nothing found in Trash', 'bonestheme' ), /* This displays if there is nothing in the trash */                 'parent_item_colon' => ''                 ), /* end of arrays */                 'description' => __( "Recipes section for It's Just food", 'bonestheme' ), /* Custom Type Description */                 'public' => true,                 'publicly_queryable' => true,                 'exclude_from_search' => false,                 'show_ui' => true,                 'query_var' => true,                 'menu_position' => 4, /* this is what order you want it to appear in on the left hand side menu */                  'menu_icon' => get_stylesheet_directory_uri() . '/library/images/custom-post-icon.png', /* the icon for the custom post type menu */                 'rewrite'   => array( 'slug' => 'recipes', 'with_front' => false ), /* you can specify its url slug */                 'has_archive' => 'recipes', /* you can rename the slug here */                 'capability_type' => 'post',                 'hierarchical' => false,                 /* the next one is important, it tells what's enabled in the post editor */                 'supports' => array( 'title', 'editor', 'author', 'thumbnail', 'excerpt', 'trackbacks', 'custom-fields', 'comments', 'revisions', 'sticky')             ) /* end of options */         ); /* end of register post type */


Permalinks of New Pages and their Parents

I am running into a new issue where when I attempt to create a new page, the permalink is not being auto generated. ### For instance On the 'Add New Page' page, I select 'Our Club' as the parent (which has a slug of 'club'). I then type in 'Membership' as the title. However, the permalink that is generated below the text input says `www.coolclub.com/membership` (instead of `www.coolclub.com/club/membership` as expected). If, instead of select 'Clubhouse' as the parent of my new page (which is itself already linked as a child page of 'Our Club'), then the permalink is generated successfully. Any ideas?


Single, unzipped PHP file as plugin?

WordPress plugins commonly come in the form of a "zip" file, which can contain multiple files of PHP source code. Can a plugin come in the form of a single, unzipped, PHP source code file, with a ".php" extension? I tried to upload a single, ".php" file as a plugin to an ancient WP 2.9.2 test blog I have lying around (not connected to the Internet), and that failed. It looks like WP 2.9.2 only accepts .zip files. If modern WP installations accept unzipped ".php" files, when did that change take place?


wp_dropdown_categories Not Loading SEF URLs for All Categories

I have the following code listing my latest post categories in a dropdown:                <?php wp_dropdown_categories ( 'show_option_none=Select Category' ); ?>                              <script type="text/javascript"><!--                             var dropdown = document.getElementById("cat");                             function onCatChange() {                                 if (dropdown.options[dropdown.selectedIndex].value > 0) {                                     location.href = "<?php echo get_option('home');                             ?>/?cat=" + dropdown.options[dropdown.selectedIndex].value;                                 }                             }                             dropdown.onchange = onCatChange;                             --></script>      I have about 20 categories and when you switch between them it works and loads the archive pages. HOWEVER on 4 of the categories instead of loading the SEF URL (e.g. site.com/category/sports/ ) it loads them like site.com/?cat=80 . So the page loads HOWEVER the PAGINATION wont work on non SEF urls. I have compared the categories that are not loading the SEF urls and there is nothing different with them. They are not parents/child if i click 'view category' from admin it loads the SEF URL etc. Anyone have any ideas on how I can fix this? Highly annoying as pagination breaks. Thanks.


Get all children page ID's including parent by title

So I am getting all the children ID's as well as the parent ID to show content only for that page and all its sub-pages. This is the following function I created, but was wondering if there is a better way to do it?               function get_all_pages( $page_title ) {              $page = get_page_by_title( $page_title );              $pages = get_pages( array( 'child_of' => $page->ID, 'sort_column' => 'post_date', 'sort_order' => 'desc' ) );              $array = array();              $array[] = array( 'ID' => $page->ID );              foreach( $pages as $page ){                  $array[] = array( 'ID' => $page->ID );              }              return $array;          }          $allpages = get_all_pages( 'Page Title' );          foreach( $allpages as $page ) {              if( is_page( $page['ID'] ) ):                  // Show stuff only on these pages              endif;          }


Change archive link to single post

i do menu with this code but links redirect me too archive.php
         <?php         $all_posts = get_posts(array(           'posts_per_page' => -1 // to show all posts         ));              // this variable will contain all the posts in a associative array         // with three levels, for every year, month and posts.              $ordered_posts = array();              foreach ($all_posts as $single) {             $year  = mysql2date('Y', $single->post_date);             $month = mysql2date('F', $single->post_date);             // specifies the position of the current post             $ordered_posts[$year][$month][] = $single;         }         $classplus = 0;             // iterates the years             foreach ($ordered_posts as $year => $months) { ?>
                 <a class="lever year<?php echo $classplus; ?>"><?php echo $year ?>
                 <?php foreach ($months as $month => $posts1 ) { // iterates the moths ?>                 <?php foreach ($posts1 as $single ) { // iterates the posts ?>
                         <a href="<?php echo get_permalink($single->ID); echo '#post-'.$single->ID;?>"><?php echo get_the_title($single->ID); ?>

                 <?php } // ends foreach $posts ?>                      <?php } // ends foreach for $months ?>

 <?php             } // ends foreach for $ordered_posts             ?>
      I want link too single.php not archive.php. Help me... :)


Software to run on server checking outdated wordpress installations

Is there any software that I can run on either a Linux or a Windows server to check for domains that have out dated WordPress installations. I have seen a rise in hacked WordPress sites and in all the cases it was because the clients had not installed updates.


Using esc_html with HTML purifier and CSSTidy: Overkill?

Currently my text area input (which accepts custom CSS input from a user) in the Wordpress theme options panel are sanitized by esc_html function in Wordpress http://codex.wordpress.org/Function_Reference/esc_html However I am thinking a secure approach, so I would like to add HTML purifier and CSSTidy like it's illustrated here: http://stackoverflow.com/questions/3241616/sanitize-user-defined-css-in-php Is this necessary? Or Wordpress core function like esc_html already uses HTML purifier so this is not anymore needed. Please advise. Thanks.


wp_list_pages doesn't work in hierarchical custom post type

I've been bashing my head against my desk all afternoon trying to figure this out. I've got a custom post type all set up, with hierarchical set to "true" and I can assign parents and see the relationship in the back end. Which is great. Except I want to list the children (and siblings) of my special new post type. I found this code               <?php if($post->post_parent)     $children = wp_list_pages("title_li=&child_of=".$post->post_parent."&echo=0");     else     $children = wp_list_pages("title_li=&child_of=".$post->ID."&echo=0");     if ($children) { ?>
         <?php echo $children; ?>
     <?php } ?>      which works perfectly when I put it into a page template for pages. But it returns squat for the custom post template. I thought "$post->post_parent)" might be the issue -- but it's not:
<a href="<?php echo get_permalink($post->post_parent) ?>" title="<?php printf( __( 'Return to %s', 'your-theme' ), wp_specialchars( get_the_title($post->post_parent), 1 ) ) ?>" rev="attachment">« <?php echo get_the_title($post->post_parent) ?>
      (lifted from an attachment template) does give me a back link to the parent. -- so maybe it has something to do with wp_list_pages? Maybe it's something else? I'd appreciate any ideas. Thanks in advance, Martin


JS news ticker is not working on home page but working on other pages. How to solve this?

I created this news ticker: http://jsfiddle.net/riffaz/92s92k1d/ and it's working fine in fiddle. I am trying to add this ticker to the site. For that I put this code on a **PHP widget**               <?php         $paged = (get_query_var('paged')) ? get_query_var('paged') : 1;         $author_id=$post->post_author;         $args = array('cat'=> 7, 'posts_per_page' => 5, 'paged' => $paged, 'orderby' => date, 'order' => ASC );                 query_posts( $args);?>
                 <?PHP while (have_posts()) : the_post();?>

                         <a class="upcomnig" href="<?php the_permalink() ?>" title="<?php the_title();?>">                             <?php echo get_upcoming_date();?>                              <?PHP echo get_upcoming_title(); ?>

                    <?php   endwhile;?>
         I put this line into child theme **style.php**               .ticker {         height: 75px;         overflow: hidden;     }      Then on child theme footer.php : I put following code(right above the tag):               function tick(){             $('.ticker li:first').slideUp( function () { $(this).appendTo($('.ticker')).slideDown(); });         }         setInterval(function(){ tick () }, 5000);      It does nothing on my home page. It stays where they are on the home page. But if I go to any pages it's working fine. weird. Any ideas how to fix this? http://www.ldjf.org/ look at the bottom right area.. Footer area **upcoming events**


Query posts by custom post type and custom taxonomy

I am writing a custom loop query to filter through a custom post type and custom taxonomy. I have replaced any variables with static values for the purpose of showing you what result I want.               $args = array(         'manufacturer' => 'Keystone',         'post_type' => 'rv',         'category_name' => 'new',         'rvtype' => 'fifth-wheel'     );          $loop = new WP_Query($args);      When I run this loop, instead of showing, just fifth-wheels, all posts under the manufacturer type 'Keystone' are shown. Why is this? Shouldn't this query only show posts with the custom taxonomy requested, under the post-type = rv, with the new category, with the rvtype = fifth-wheel? Any insight would be greatly appreciated!


When is get_currentuserinfo() needed?

I know you usually call it inside functions after `global $current_user`, but sometimes it works whether you have it or not. So what are the conditions where is it needed? Sample code:               function plugin_admin_init(){         global $current_user;              // Make sure global is set, if not set it.         get_currentuserinfo();         /* ... */     }


Wordpress 3+ slow load times on Ubuntu 10.10

Running a test WP 3.0+ on Ubuntu 10.10 (Server & Desktop) MySQL, PHP 5.3, Apache. Installs fine and works ok, I installed a CentOS VM and wordpress is loading way too faster and its very quick as compared to the one on Ubuntu. I haven't got alot of plugins or anything on this wordpress install would be grateful for your insight / suggestions on it. Also, just today I realized that for some reason the WP 3.0.1 on Ubuntu won't show "`an update is available`" whereas on CentOS it was showing and updated fine. Any ideas ? Kind Regards


How can I show the post thumbnail from the most recent of a certain post type, in widget?

I'm using the excellent PHP Code Widget plugin, and want to create a widget that displays the post thumbnail (aka featured image) for the most recent 'project' post. Here's the code I have so far, but it isn't producing the desired result. This actually outputs nothing.               <?php     global $post;     $args = array(         'post_type' => 'project',         'posts_per_page' => 1,         );      $thumbnails = get_posts($args);     foreach ($thumbnails as $post)     {         setup_postdata($post);             ?>             <a href="<?php the_permalink(); ?>"><?php the_post_thumbnail( 'thumbnail' ); ?>             <?php              }      Any suggestions on what I need to change for this to work?


How do I set my Feedburner feed to use my favicon?

I'm not sure if this setting is handled in my wordpress installation or by Feedburner but right now my feedburner feed is displaying the feedburner favicon. How can I set it to use my blogs favicon?


Alter image meta fields in the Media Library

To improve user experience, I want to make changes to the image meta fields in the Media Library: ![Image Meta Fields](http://i.stack.imgur.com/rvmtQ.jpg) As demonstrated above, I want to change the `Caption` field to `Source` and remove the `Alt Text` and `Description` field. How can I achieve this?


Custom Permalinks and filters?

Ok, so I've added a custom permalink, which is mapping to my page fine. For some reaosn though the filters I've added aren't showing up. In the shortcode, they're just being returned as NULL. My code is;               function custom_rewrite( $wp_rewrite ) {     $feed_rules = array(         'local/(.*?)/(.*?)/?$'  =>  'index.php?page_id=41&trade=' . $wp_rewrite->preg_index(1).'&area=' . $wp_rewrite->preg_index(2),         'local/(.*?)/(.*?)?$'  =>  'index.php?page_id=41&trade=' . $wp_rewrite->preg_index(1).'&area=' . $wp_rewrite->preg_index(2),     );     $wp_rewrite->rules = $feed_rules + $wp_rewrite->rules;     }          function custom_wp_querystring() {     add_rewrite_tag('%trade%','([^&]+)');     add_rewrite_tag('%area%','([^&]+)');     }     add_action( 'init', 'custom_wp_querystring');     add_filter( 'generate_rewrite_rules', 'custom_rewrite' );          add_shortcode('rewrite_local', 'rewriteShortcode');          function rewriteShortcode() {     echo "vars are";     var_dump($wp_query->query_vars['trade']);     var_dump($wp_query->query_vars['area']);     }      Is it something simple I've missed?


Buddypress get data from wp_bp_groups_members table

I have added a new column to 'wp_bp_groups_members' table it's called 'relationship'. Now I want to get data from that column. I have to pass user_id and group_id to get that data.


What is the best way to get directory path for wp-config.php?

I am developer of the plugin mapsmarker.com which also offers several APIs which can be accessed directly (eg www.mapsmarker.com/wp- content/plugins/leaflet-maps-marker/leaflet-geojson.php?marker=1) For these APIs I initially wrote the absolut directory path to a file with the following function on plugin install:               file_put_contents(dirname(__FILE__).'/leaflet-wp-path.php', '<?php define(\'WP_PATH\',\''.ABSPATH.'\'); ?>');      In the API-files, the file leaflet-wp-path.php the got included by the following code:               include_once(dirname($_SERVER['SCRIPT_FILENAME']).'/leaflet-wp-path.php');     include_once(WP_PATH.'wp-config.php');     include_once(WP_PATH.'wp-includes/wp-db.php');     global $wpdb;     ...      I then noticed that on some hosting providers these kind of operation is not supported, causing the plugin install to fail. Therefore I switched to another method for determing the directory-path to wp-config.php:               //info: construct path to wp-config.php with fallback for subdirectory installations     $wp_path = $_SERVER["DOCUMENT_ROOT"];      if ( file_exists($wp_path . '/wp-config.php') ) {         include_once($wp_path.'/wp-config.php');         include_once($wp_path.'/wp-includes/wp-db.php');     } else {          $wp_plugin_path_modified = explode(DIRECTORY_SEPARATOR, dirname(__FILE__),-3);         $wp_path = implode(DIRECTORY_SEPARATOR, $wp_plugin_path_modified);         include_once($wp_path.'/wp-config.php');         include_once($wp_path.'/wp-includes/wp-db.php');     }      if ( !file_exists($wp_path . '/wp-config.php') ) {         echo __('Error: Could not construct path to wp-config.php - please check http://mapsmarker.com/path-error for more details.','lmm') . '
Path on your webhost: ' . $wp_path;     } else {     ...      This worked fine even on hosts that don´t allow the function file_put_contents() because the directory path is determined from the current dirname of the API-File. Now I got a bug report from a user, telling me that this method doesnt work on his host. He writes: * * * This is the example of the one of icon link. Looks entire plugin links are not correct. Only one thing is working now, it is admin panel configuration. Also it is making markers, but not showing in browsers. On Windows Web Host http://XXXXX/wordpress/wp- content/plugins/D:/Hosting/5465771/html/wordpress/wp-content/plugins/leaflet- maps-marker/img/logo-mapsmarker.png On Linux Web Host http://XXXXX/wordpress/wp- content/plugins/D:/inetpub/vhosts/XXXXX/httpdocs/wordpress/wp- content/plugins/leaflet-maps-marker/img/logo-mapsmarker.png * * * Does anyone know a better method for determing the directory path to wp- config.php to support this kind of hosting configuration?


How to customize default wordpress editor?

Good to hear that Sonny (wordpress3.3) has the new editor API **wp_editor()** that gives us the ability to use multiple instances of the editor in our custom fields with ease. But I needed to customize the default editor (for the main content) and couldn't figure out how to do it with this function. I needed to customize the editor for the my new custom post type called _baner_ for which I needed to change the size of the editor with fewer buttons. I know I could do it by simply using a custom field instead but for some reason I want to use the content for the description of the banner.


Ajax returning 0 when in shortcode, but working when i directly run the function

I have a very wierd problem, maybe very easy to fix for any of u, but im struggling with it for days now. I have a live search in my plugin, that works fine when i directly fire the function ( $this->function() ), but returns a 0 when i put it in a shortcode. Is there any communication that has to be changed? I've tested a alert and it reached the Ajax/jquery code. Hope someone can help me out!               $(document).ready(function(){     $(".search").keyup(function() {      var searchid = $(this).val();     var dataString = 'search='+ searchid;     if(searchid!='')     {         $.ajax({         type: "POST",         url: ajaxurl,         data: dataString,         cache: false,         success: function(html)         {         $("#result").html(html).show();         }         });     } return false;         });          jQuery("#result").live("click",function(e){          var $clicked = $(e.target);         var $name = $clicked.find('.name').html();         var decoded = $("<div/>").html($name).text();         $('#searchid').val(decoded);     });     jQuery(document).live("click", function(e) {          var $clicked = $(e.target);         if (! $clicked.hasClass("search")){         jQuery("#result").fadeOut();          }     });     $('#searchid').click(function(){         jQuery("#result").fadeIn();     });     });


Ajax call always returns 0

I have a problem with AJAX returning 0 always! I have done everything by the book and can't figure out what is wrong? Please help!! Here is my Ajax call:               //Pass data through AJAX     var amountToConvert = price;          jQuery.ajax({           type:"POST",           url: "../../wp-admin/admin-ajax.php", // our PHP handler file           action: "ajaxConversion",           data: {               amount: amountToConvert           },           success:function(data){           alert(data);           },           error: function(errorThrown){               alert(errorThrown);           }             });     return false;      And the function in functions.php is:               function ajaxConversion(){          $amount = mysql_real_escape_string($_POST['amount']);          echo $amount;          die();     };          add_action('wp_ajax_nopriv_ajaxConversion', 'ajaxConversion');     add_action('wp_ajax_ajaxConversion', 'ajaxConversion');


Jumbled writing under a post

> > > The websites we have are Wordpress ones. I add new things on okay but the > issue is a glitch that has always been on it. > > If you look on this page after the post the writing underneath is like two > lines on top of each other. > > http://westlancspositiveliving.org.uk/2012/01/reindeer-dash-important-news/ How can I fix this ? Thanks Edward.


How to add images to taxonomies?

**Q:** Is it possible to add images to all of my taxonomies (default and custom ones)? **Note:** I do not want to use any plugins (not my favourite solution for design related matters). **Usage:** I want to create really practical custom post type portfolio with custom taxonomies. For example, custom taxonomy - clients, so if multiple projects from same customer/client would be realted and at the same time I could use the taxonomy as showcase of my clients. The similar usage would go with almost of my taxonomies (whether to have taxonomy archive with image and description on). Any good practice advice here? Thanks in advance **Clarification:** I want to add images to the terms of my custom taxonomies. Example, custom post type 'portfolio' with custom taxonomy 'clients', where each 'client' term (lets say Adidas) would have its logo attached.


Looking for a Tournament Bracket plugin

I'm currently working on a website that I would like to implement a sort of "tournament bracket" that I could add my signed up users into, like this: http://i.stack.imgur.com/0bpZ5.jpg I haven't been able to find a lot of luck finding one on the plugin directory (bracket is a very common tag it seems), and I was wondering if anyone knew of something like this. Thank you for any assistance.


Only allow site url in text field using wp_kses/wp_filter_nohtml_kses?

I'm working on validation for a theme options page. Is there a built in way to add an argument to wp_kses/wp_filter_nohtml_kses that will allow a specific link to be entered(wrapped in a tags) but not all links? I only want the user to be able to enter a link to the main site in this particular text field. Thank You.


Projectmanager Internal Link Code Location

I'm working with the ProjectManager Plugin (by Kolja Schleich) and i've exausted myself trying to find the code that controles the Internal Link Form field. Does anyone out there in the magical world of the internet know where this code is located? UPDATE: http://wordpress.org/extend/plugins/projectmanager/ is the plugin UPDATE: The reason I wish to access the code is that it is currently displaying as a checkbox list of all of the fields in the linked table, I wish to modify it so that there is a dropdown option as an extra form field.


Show Posts in Vertical Tabs with Scrollbar

I have created CPT ( Custom Post Type ) called Recipes. I want to display all me recipe in Vertical Tabs. For Example; check the image below i have created. Image Example Click Here On the left hand side as in image i want to display Post title of CPT Recipes & on right hand side i want to display the content of that recipe. How can i do that in Wordpress ? Anyone please help. I have tried many tutorials, but all in vain. This is code which i am trying now. close but not perfect.

             <?php //WordPress loop for custom post type                  $my_query = new WP_Query('post_type=training_courses');                      while ($my_query->have_posts()) : $my_query->the_post();              ?>
                     <a href="#<?php the_ID(); ?> "><?php the_title(); ?>

                     <?php endwhile; ?>

                            <div id="<?php the_ID(); ?> ">                            <?php the_title(); ?>

                        <?php wp_reset_query();?>
                                           But On Right Side ( Content ), it show all the recipes content. Not the one selected. Please help me fix this or if you can suggest me to any tutorial. Thanks Appreciate your help. Rajiv


Removed jQuery script from header.php , any problems?

To avoid multiple jQuery calling from my theme and plugins, I removed `<script language="javascript" type="text/javascript" src="<?php bloginfo('template_url'); ?>/javascripts/jquery.js"></script>` .   Now my slider plugin starts working fine in the front end. I don't know whether it will it cause any problems to my website in future ?   Any suggestions.


Prevent authors from creating new posts of specific custom-post-type

The way I'm set up currently, I create a post for each user of the site, custom-post-type, Agent, then assign it to a user, and they can edit it however they like. What I want to remove or disable is in the admin side, Agents/Add New. Currently all users are set to Author, so if I could make it so if the user is an Author they can't create new posts of custom-post-type, Agent. I'd also like to remove the ability of the author to create standard wordpress posts. The caveat to all this is I need to allow authors to create as many posts as they like as custom-post-type, Property. Here is a pic of what I want to remove (in red) for agents custom-post-type, if the user is an author. ![enter image description here](http://i.stack.imgur.com/U64Bc.jpg)


Meta keywords and descriptions plugin for manually editing meta for each page/post

Can anyone recommend a simple plugin that allows me to add/edit meta tags for keywords and description on each page of my wordpress site? Just something that adds the fields to the page editor would be ideal. Not looking for SEO megapack or whatever. Thanks, John.


Uninstall, Activate, Deactivate a plugin: typical features & how-to

I'm making a wordpress plugin. What are typical things I should include in the uninstall feature? For example, should I delete any tables I created in the install function? Do I clean up my option entries? Anything else?


Any function to replace a media file?

I'm using this script to add a new media in the upload folder and meta database                   $uploadedfile = $_FILES['upload'];         $upload_overrides = array( 'test_form' => false );         $movefile = wp_handle_upload( $uploadedfile, $upload_overrides );         if ( $movefile ) {             $wp_filetype = $movefile['type'];             $filename = $movefile['file'];             $wp_upload_dir = wp_upload_dir();             $attachment = array(                 'guid' => $wp_upload_dir['url'] . '/' . basename( $filename ),                 'post_mime_type' => $wp_filetype,                 'post_title' => preg_replace('/\.[^.]+$/', '', basename($filename)),                 'post_content' => '',                 'post_status' => 'inherit'             );             $attach_id = wp_insert_attachment( $attachment, $filename, $_POST['developments']);             $attach_data = wp_generate_attachment_metadata( $attach_id, $filename );             wp_update_attachment_metadata( $attach_id, $attach_data );         } else {             echo "Possible file upload attack!\n";         }      The thing is that every time this script is running, it add a new file in the media library. I would like something that would add the file and if it exist, update.


How to display taxonomy images with wp_list_categories?

I am trying to display only sub taxonomies with images of current taxonomy in taxonomy page. I have created custom taxonomies for a custom post type and using the plugin Categories Images to add a images to taxonomies. I am using this code to display only sub taxonomies in taxonomy page...               <?php $current_term = get_term_by( 'slug', get_query_var( 'term' ), get_query_var( 'taxonomy' ) ); ?>     <?php $cats = wp_list_categories( array(             'child_of' => $current_term->term_id,             'taxonomy' => $current_term->taxonomy,             'hide_empty' => 0,             'hierarchical' => true,             'depth'  => 2,             'title_li' => ''             )); ?>     <?php if ($taxonomies) { ?>     <?php foreach (get_taxonomies() as $cat) { ?>
<img src="<?php echo z_taxonomy_image_url($cat->term_id); ?>" /><a href="<php get_taxonomy_link($cat) ?>" title="<php $cat->cat_name ?>">
     <?php } ?>     <?php } ?>      And it's working fine, but images are not showing. How to customize wp_list_categories output, to insert in li tag those category images? get_categories does not fit, because I need those categories are listed hierarchically.


manage calender event in wordpress via database post

I have integrated the custom calender event pattern , having all day and month with different posts and event. Can you please tell how i manage each and every post via admin panel. thanks


Prevent WordPress updates from overriding custom language translations?

my site's language is persian and persian is a right-to-left language. Wordpress has a default installation package for this lang but for some cases like very bad translation for dashboard or default rtl style for everything (that is really annoying for theming) i installed original Wordpress in English and then use a custom language file for my theme. everything is ok but as you know for doing this i should set following line in wp-config.php file for running my theme in persian:                 define('WPLANG', 'fa-IR');      but with changing this line of code in wp-config Wordpress think that i use persian version of Wordpress and say your Wordpress version is not update! > WordPress 3.9.2 is available! Please update now. with changing the line to its default, update message disappears! if i click the update button Wordpress installs persian package, something that i really don't want to! the only solution is change the line to its default, update wordpress and change it back to "fa-IR"! is there a better approach to do this? is there a better way? what if one of users accidentally click on update button? thanks.


How to fix pagination for custom loops?

I have added a custom/secondary query to a template file/custom page template; how can I make WordPress use my custom query for pagination, instead of using the main query loop's pagination? ### Addendum I have modified the main loop query via `query_posts()`. Why isn't pagination working, and how do I fix it?


Pagination not working for cpt

I'm using this script to catch posts from a custom post type               $paged = ( get_query_var('paged') ) ? get_query_var('paged') : 1;     $args = array(               'post_status' => array('publish', 'future'),               'post_type' => 'evento',               'orderby' => 'date',               'order' => 'DESC',               'posts_per_page' => 9,               'paged' => $paged          );      If I set Settings >> Reading >> Blog pages show at most to 6, site return 404 on the second page. If I set to 5, works fine. Why it happens? I'm using roots theme.


Displaying posts limit: can't get pagination to display

> **Possible Duplicate:**   >  Pagination not working with custom loop I'm creating a custom page for logged in current users to view their posts. I would like to limit the number of displayed post to 5, but cannot get pagination to display. This is what I'm using:               <?php    if ( is_user_logged_in() ):          global $current_user;     get_currentuserinfo();     $author_query = array('posts_per_page' => '5','author' => $current_user->ID);     $author_posts = new WP_Query($author_query);     while($author_posts->have_posts()) : $author_posts->the_post();     ?>         <a href="<?php the_permalink(); ?>" title="<?php the_title_attribute(); ?>"><?php the_title(); ?>            <?php                endwhile;          else :          echo "not logged in";          endif;     ?>      I'm by no means professional, just enjoy creating my own sites, and so I be making a very silly nooby mistake. Please be gentle with me? Thank you for your help!


Custom Post Type Pagination loading index.php

Been searching around the web for hours and I still can't find an answer to this. I have a custom post type called events, I have created this using the Custom Post Type UI plugin. Everything is working as it should be but I can't get pagination to work. When I try to view gordonrigg/the-hub/events/page/2/ it just throws a 404 error. I'm working in a sub folder called the-hub as you can see. My blog posts are working fine with pagination just not my custom post. If anyone can shed any light on this I'd be very grateful. My code: (which is in a page called page-events.php)               <?php      $temp = $wp_query;      $wp_query = null;      $wp_query = new WP_Query();      $wp_query->query('showposts=6&post_type=events'.'&paged='.$paged);           while ($wp_query->have_posts()) : $wp_query->the_post();      ?>          <?php the_title(); ?> <br>          <?php endwhile; ?>          <nav>     <?php previous_posts_link('« Newer') ?>     <?php next_posts_link('Older »') ?>     </nav>          <?php      $wp_query = null;      $wp_query = $temp;  // Reset     ?>


Pagination in custom query not working

hi im trying to output pagination without any success. below is my code in a page-products.php template               <?php $products_query = new WP_Query(array(         'post_type' => 'product',         'posts_per_page' => 4,         'paged' => (get_query_var('page') ? get_query_var('page') : 1),     ));?>          <?php if($products_query->have_posts()) : while($products_query->have_posts()) : $products_query->the_post();?>          <?php the_content; ?>          <?php endwhile; ?>     <?php posts_nav_link();?>     <?php endif; ?>      i cant seem to output my pagination links. can anybody help spot whats wrong?


Archive Navigation with CPT and Taxonomy

Need your help to find how can i put post navigation working on the taxonomy archive page. This code is in taxonomy-custom_name.php . What i need to show on this page is all posts (custom post types = product) that have the $product_goals taxonomy. I tried different methods but none allowed the pagination to work. Can anyone give me a help with this? Thanks a lot.
                  <?php                 $term = get_term_by( 'slug', get_query_var( 'term' ), get_query_var( 'taxonomy' ) );                 $paged = get_query_var('paged') ? get_query_var('paged') : 1;                      $args = array(                     'post_type' =>  'product',                     'product_goals' => $term->slug                     'posts_per_page' => 1,                     'paged' => $paged                 );                      $wp_query = new WP_Query($args);             ?>                  <?php if ( $wp_query->have_posts()) : while ( $wp_query->have_posts() ) : $wp_query->the_post(); ?>                  <article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>                                       <?php if ( has_post_thumbnail()) : ?>                     <a href="<?php the_permalink(); ?>" title="<?php the_title(); ?>">                         <?php the_post_thumbnail('product-list');  ?>                                      <?php endif; ?>
<a href="<?php the_permalink(); ?>" title="<?php the_title(); ?>"><?php the_title(); ?>

<?php the_excerpt(); ?>

                  <?php endwhile; ?>

<?php next_posts_link('« Older Entries'); ?>

<?php previous_posts_link('Newer Entries »'); ?>

                  <?php else: ?>

Nothing to display.

                  <?php endif; wp_reset_postdata(); ?>


Pagination on Single page doesnt work

I am trying to have a list of other/previous posts with pagination on single page under the main post, But the below code doesn't work. Can someone point out where am I getting wrong here?
       <?php  while(have_posts()): the_post()?>
<?php the_title(); ?>
             <?php the_time(' j/m/y'); ?>
             <?php  echo wp_get_attachment_link($image->ID, 'large');?>              <?php the_content(); ?>            <?php endwhile;?>       <?php wp_reset_query();?>

         <?php  $page_num = $paged;          if ($pagenum='') $pagenum =1;          $wp_query = new WP_Query('paged='.$page_num);          while($wp_query ->have_posts()) : $wp_query ->the_post(); ?>

<a href="<?php the_permalink();?>">                         <?php the_title(); ?>

                        <?php $content = get_the_content();                        echo string_limit_words($content,30);?>

        <?php endwhile; ?>       <?php wp_paginate(); ?>