pagenavi shows alot of pages calculated from all posts in the site with query_posts

I need to excute posts from 2 seprated keywords using `s=keyword` with `get_posts`, but only searching in titles. I found this answer. I created a custom template to use it in single page. Then I used a merged `get_posts` in my answer using this So, my custom template code is:               <?php /* Template Name: custom template posts */ ?>          <?php get_header(); ?>     <?php add_filter( 'posts_search', '__search_by_title_only', 500, 2 ); ?>     <?php     //first query     $blogposts = get_posts(array(         's' => 'keyword1', 'showposts' => -1,         ));     //second query     $authorposts = get_posts(array(         's' => 'keyword2', 'showposts' => -1,         ));     $mergedposts = array_merge( $blogposts, $authorposts ); //combine queries     $postids = array();     foreach( $mergedposts as $item ) {     $postids[]=$item->ID; //create a new query only of the post ids     }     $uniqueposts = array_unique($postids); //remove duplicate post ids     $mypostcount = count($posts);     $posts = get_posts(array(                 //new query of only the unique post ids on the merged queries from above         'post__in' => $uniqueposts,         'posts_per_page' => 12,         'paged' => $paged,         ));?>     <?php remove_filter( 'posts_search', '__search_by_title_only', 500 ); ?>     <div class="post-listing">     <?php foreach( $posts as $post ) : ?>     <?php setup_postdata($post); ?>     // layout code here     <?php endforeach; ?>     </div>     <?php query_posts('paged='.$paged.'&posts_per_page='. $cat_query); ?>     <?php if(function_exists('tie_pagenavi') ) { tie_pagenavi(); } ?>     <?php wp_reset_postdata();?>     </div>     <?php get_sidebar(); ?>     <?php get_footer(); ?>      When I go to wordpress admin, create new page change the default template for it, every thing is okay, but one problem my pagination showing a lot of pages which empty after the last page the number of all pages calculated from all posts in my database. I am using a custom theme which has an internal pagenavi in it called `tie_pagenavi()`. I also tried the `wp_pagenavi` plugin. **Note: I am using`$mypostcount = count($posts);` to calculate the number of posts. I tested it by echo. It is really returned by the actual posts number in this loop but I am not sure how to use it to limit the pagination numbers.** You can check every thing by your self in `http://elnhrda.com/e/sisi2posts/page/56/`. 56 is the last page which has posts. **Edit:** After searching and testing more, the problem is coming from this line query_posts('paged='.$paged.'&posts_per_page='. $cat_query); If I remove it the pagination disappears. If I add `'&showposts=2000'` to it the pages numbers changed the total number of my posts divided into 2000.


Remove line breaks from <code>?

This code form HTML editor:               [shortcode]         [bar]foo[/bar]         [bar]foo[/bar]         [bar]foo[/bar]     [/shortcode]      Returns:               [shortcode]
        [bar]foo[/bar]
        [bar]foo[/bar]
        [bar]foo[/bar]
     [/shortcode]      Codes white-space is set to pre-wrap in css (and I want it this way) and I'm using this piece of code (works for shortcodes, usually):               remove_filter( 'the_content', 'wpautop' );     add_filter( 'the_content', 'wpautop' , 99 );`enter code here`      I don't want to use plugins or delete these line breaks using JavaScript. Any ideas? I can't edit WP core files too (only theme's). I know it's doable because I've seen many premium themes with pretty & clean code sections. [edit] Using `<code><pre>contents</pre></code>` somehow deletes all the `<br/>` tags from code (why?), but I don't want to add `<pre>` every time I write some code.


Add action to create new post after wp_insert_post fires? Think it's creating an infitnite loop

I need to take the post meta from a post, and create a custom post type post. I'm using the code below but think it's creating an infinite loop. When wp_insert_post fires I have create_cptpost function execute which gets the PID of the post created `$post_id` gets a custom field `ac_1` then I need to create a new post in the cpt post type and update the post meta. Is there another way to do this? I'm basically trying to copy the first normal post content to a new custom post type post.               function create_mycpt( $post_id ) {          $post = get_post($post_id, ARRAY_A);              if ( wp_is_post_revision( $post_id ) )             return;               $ac1 = get_field('ac_1',$post_id);          $my_post = array(       'post_title'    => 'The title',       'post_type' => 'mycpt'     );          $pid = wp_insert_post( $my_post );          update_post_meta($pid, 'ac_1', $ac1);               }     add_action( 'wp_insert_post', 'create_mycpt' );


how bbPress and buddypress add their own page templates to the page template drop down on the page editing screen

Im writing a plugin and need to know how to add a page template in the edit page screen from within a plugin. bbPress and Buddypress both add page templates to this drop down and I can't figure out how they do it. Not looking for template_redirect solution, needs to work in the backend. I am already making use of template_redirect and don't need any help with it! Any assistance would be appreciated.


How to hook into the quick edit action?

I found this solution to automatically assign parent terms when a child term is selected, which is working fine for the **save_post** hook:               add_action('save_post', 'assign_parent_terms');          function assign_parent_terms($post_id){     global $post;          if($post->post_type != 'product')         return $post_id;          // get all assigned terms        $terms = wp_get_post_terms($post_id, 'product_cat' );     foreach($terms as $term){         while($term->parent != 0 && !has_term( $term->parent, 'product_cat', $post )){             // move upward until we get to 0 level terms             wp_set_post_terms($post_id, array($term->parent), 'product_cat', true);             $term = get_term($term->parent, 'product_cat');         }       }     }      As I have a large number of posts, I need to hook into the **quick edit action** , not just into the save-post action. Anybody has a solution of this hook?


How to define  a term for custom taxonomy

I have a custom post type called `q-questions`, and it has a custom taxonomy that called `q-categories`.   I insert post via `wp_insert_post` and I want to define some terms for the taxonomy   My code is:                 $my_post = array(     'post_title' => 'Custom-tax',     'post_content' => 'This is my post.',     'post_type' => 'q-questions',      );          $post_id = wp_insert_post( $my_post );      What should I do to define the `q-categories` for this post as `my-category`?


Multiple loops on index page with sticky post and pagination

First post on this site. Hope to get some help from you guys. Probably a simple answer for you experts. I have two category's (news & work). I want to show on my index page (wordpress startpage/blog) the five latest news at the top (cat. news). Below that i want to show my post (cat news & work). I also have sticky posts in the work cat, that I want to only on the first page. I think this means three loops. one for news, one for sticky in work & news, and then one for work & news, none sticky. I can get this to work, but the problem is that my sticky post shows up first on all the pages when I paginate on the index-file (eg. press the read prev post, /page/2, /page/3 etc.. How can I make the sticky post to be sticky only on the first page (index.php)? Here is my code:
          <?php $wp_query = new WP_Query(array('category_name' => News, 'posts_per_page' => 5)); ?>          <?php while ($wp_query->have_posts()) : $wp_query->the_post(); ?>              <?php get_template_part( 'loop', 'index' ); ?>          <?php endwhile; ?>          <?php wp_reset_postdata(); ?>

                    <?php if ( $paged != True ): ?>          <?php $wp_query = new WP_Query(array('post__in' => get_option('sticky_posts'), 'category_name' => Work)); ?>          <?php while ($wp_query->have_posts()) : $wp_query->the_post(); ?>              <?php get_template_part( 'loop', 'index' ); ?>          <?php endwhile; ?>          <?php wp_reset_postdata(); ?>          <?php endif ?>                                        <?php $wp_query = new WP_Query(array('post__not_in' => get_option('sticky_posts'), 'category_name' => Work, 'posts_per_page' => 8, 'paged' => $paged)); ?>          <?php while ($wp_query->have_posts()) : $wp_query->the_post(); ?>                  <?php get_template_part( 'loop', 'index' ); ?>              <?php endwhile; ?>          <?php wp_reset_postdata(); ?>
      Thanks /K My pagination code:               function pagination() {        global $wp_query;      $total = $wp_query->max_num_pages;      // Only paginate if we have more than one page      if ( $total > 1 )  {          // Get the current page          if ( !$current_page = get_query_var('paged') )               $current_page = 1;          // Structure of “format” depends on whether we’re using pretty permalinks         $permalinks = get_option('permalink_structure');         $format = empty( $permalinks ) ? '&page=%#%' : 'page/%#%/';         echo paginate_links(array(               'base' => get_pagenum_link(1) . '%_%',               'format' => $format,               'current' => $current_page,               'total' => $total,               'mid_size' => 2,               'prev_next' => False         ));     }     }


How to Remove the Custom Theme Panel from a Theme?

How does one remove the custom theme admin panel from a theme that has the options to change colours, layouts, etc? Thanks. K


Rewrite /category/cars into /topics/cars

I know there are plenty of question and posts about this out there, however I couldn't find a solution or existing thread to my specific question. If I list my categories and click on "cars" the url looks like this `url/category/cars` Is it simply possible to use some function in functions.php to change the word `category` into e.g. `topics` `url/topics/cars` Any ideas on that? Thank you in advance!


What types of files can I upload with the Wordpress Uploader?

I have a domain with Wordpress 3.4.2 installed on it. (This is NOT a Wordpress.com site) What kind of files can I upload? I know .jpeg, .gif, .png, .mp3, etc. are accepted, but where can I find a complete list of the accepted file types? Basically, what can I upload via this screen: ![enter image description here](http://i.stack.imgur.com/22Y4g.jpg)


How can I use "getarchives_where" to get monthly archives for static pages?

I would like to get monthly archives for static pages. I tried to use the next code:               add_filter('getarchives_where','my_archives_filter');     function my_archives_filter($where_clause) {     return "WHERE post_type = 'page' AND post_status = 'publish'";     }      and in the sidebar I write:               add_filter('getarchives_where','my_archives_filter');                    wp_get_archives('type=yearly');     remove_filter ('getarchives_where','my_archives_filter');      But it doesn't work. Can you help me? Thanks.


Wrong user registration date in wordpress

I have this funny problem and I'm not able to locate where it happens.   The problem is when a user registers on my site his/her registration date is wrong (not just wrong but total rubbish, even if I add them manually from the admin panel).   I tried deactivating every plugin and theme installed on wordpress to no avail.   The problem persists no matter what. Here is a screen shot from phpmyadmin.   ![enter image description here](http://i.stack.imgur.com/qtPOj.png)   Help me, please.


Long permalinks get split with multidots and get broken

I have pages which are nested in 3 levels, i.e:               www.example.com/cinema-in-our-country/our-festivals/first-festival-with-very-long-name As you can see the permalink gets quite long. If I go to the TinyMCE editor, write festival name and try to add a link on it to direct to that festival page, I get such generated link (notice three dots):               www.example.com/cinema-in-our-country/our-festivals/first-f...l-with-very-long-name And the link does not work, it directs to 404 page. If I update the link with the correct, it saves well. Actually I cannot repeat this behavior all the time. Sometimes this works just fine from the beggining. Any ideas what can couse this?


Detect what page was linked-from

Is there a Wordpress way of detecting which post or page on the site you linked-from? The aim is to display custom content, in this case a category archive grid at the bottom of the current page, depending on which page you were last on. If not a directly Wordpress way, then a best-practices php way of doing this, like an easily-accessible place in the database?


Single.php different behaviour from admin to non-admin

For the same post, I have suddenly a weird behaviour of `single.php` file between normal user and administrator. In the beginning of the loop, I perform:               echo '
';     print_r($GLOBALS['wp_query']);     echo '
';      And the result is different. **In the case of administrator:**               [queried_object_id] => 603         [request] => SELECT   wp_posts.* FROM wp_posts  WHERE 1=1  AND wp_posts.post_name = 'test' AND wp_posts.post_type = 'aya-bi-aya'  ORDER BY wp_posts.post_date DESC       **In the case of non-administrator:**               [queried_object_id] => 0         [request] => SELECT SQL_CALC_FOUND_ROWS  wp_posts.ID FROM wp_posts  WHERE 1=1  AND wp_posts.post_type = 'aya-bi-aya' AND (wp_posts.post_status = 'publish')  ORDER BY wp_posts.post_date DESC LIMIT 0, 10      I spent one day and a half trying to figure out what can be the reason behind this dysfunctionning, but in vain. Your time is really invaluable.


Add custom content to nonexistent page

I am trying to add content to what would otherwise be a 404 page. For example I want to define post content for mysite.com/existing-page/imaginary-page instead of showing the 404 page. I've tried several different approaches and none work, so I greatly appreciate your help. My actual structure is this: mysite.com/personal-development/class. mysite.com/personal-development exists but mysite.com/personal-development/class does not. mysite.com/personal- development/class will display altered content from mysite.com/personal- development if seems like add_rewrite_rule would work if the class page actually existed.               add_action( 'init', 'dynamic_classes_class_type_rewrite' );     function dynamic_classes_class_type_rewrite()     {         global $wp_rewrite;         add_rewrite_tag( '%personal-development%', '([^&]+)' );         add_rewrite_rule(             '^personal-development/([^/]*)/?',             'index.php?page_id=17318&class_type=$matches[1]',             'top'         );         }      This one catches the page and cancels the 404. It then shows the home page content but does not use the template style-sheets or allow me to change the content. The example below is my attempt to get the appropriate content and display it. I also tried displaying a different template. I was able to display the template, but was still not able to display any content.               add_filter('template_redirect', 'dynamic_classes_class_type_redirect' );     function dynamic_classes_class_type_redirect()      {     //for best seo I am setting up a redirect for pages.         global $wp, $wpdb, $wp_query;         if(!$post_title=get_post($post)->post_title)//looks like we hit a 404         {             $url=explode('/',dynamic_classes_page_url());//see if its one of our dynamically created pages.             if(count($url)>4)//we need to make sure this long enough             {                 $db_prefix= $wpdb->prefix;                 $sql='SELECT ID                       FROM '.$db_prefix.'posts                       WHERE post_name=\''.implode('',array_slice($url,-2,1)).'\' /*get the second to last*/                       LIMIT 1';                 $rs_class = $wpdb->get_results($sql);                 if($rs_class)                 {                     status_header( 200 );                     $wp_query->is_404=false;                     wp_reset_query();                     setup_postdata(get_post($rs_class[0]->ID));                 }             }         }     }      add_action and 'the_post' will allow me to alter content as I need to, but not for 404s - even if I cancelled the 404 as in the above example.               add_action( 'the_post', 'my_the_post_action' );     function my_the_post_action( $post_object ) {         $post_object->post_content='Programmer test.';     }


WP_LINK_PAGES Generating Unnecessary </p> Tag

This is the current output for my WP_LINK_PAGES, notice the unnecessary `</p>` tag at the end. My code for my custom WP_LINK_PAGES can be found here.
 1 2 3 4 Next page


Why can't I click on my content or highlight text with my tooltip?

The front page works, but I can't seem to click on any content within the site. I can click on my header/footer fine to access the pages, but I can't seem to do anything with the content between header and footer. For example, if I click on "Business Models", I can't click on "Affordability", or highlight the text with my tool tip. I don't know what I did wrong! It was working before. I disabled all my plugins, so you'll see a lot of short codes through out the content if you venture out that far. http://knowledex.org/stella/energymap/ Thank you beforehand for the support! I'm on Chrome and have tested on multiple computers on Safari/Chrome.


check if wordpress is updating or publishing a post

Very simple question: How can I check when wp is doing an update or a publishing to a post? Because I have to check a postmeta value which could be only true if the post is actually being published and so it has not to be already present in the system. E.g. if( defined('DOING_AUTOSAVE') && DOING_AUTOSAVE ) it's defined when wp is doing an autosave. Is there anything like this when it's doing an update? Thank you!! ok so               add_action('save_post', 'fields_news_save');     function fields_news_save($post_id){     $errors = false;            if(get_check_key($_POST['checks_news'])==0){         $errors = true;              update_option('custom_token', $errors);         update_option('custom_admin_errors', $txt_err=error_text($errors, 2));              remove_action('save_post','fields_news_save');         wp_update_post(array('ID' => $post_id, 'post_status' => 'draft'));         add_action('save_post', 'fields_news_save');              return false;     }     }      The "if" clause check if there are meta post values set as $_POST['checks_news'] and this is the function which does the quer: `function get_check_key($checker){ global $wpdb; $data = array(); $wpdb->query(" SELECT * FROM $wpdb->wp_postmeta WHERE`meta_value`= $checker; "); return $wpdb->num_rows; }` Now what i would like to do is the "if" at the beginnig checks if the number of rows is 0 AND wp is doing a publish not an update.


Exclude parent category when getting category posts by slug

I have the following category layout:               Resources         -- Documents      I want to list the posts in the documents category, and have the following code:               $args = array(             'posts_per_page' => '-1',             'orderby'          => 'ID',             'order'            => 'DESC',             'category-name'    => 'documents'                          );     $surveys = get_posts($args);      This returns the posts in both documents AND resources categories. I only want those in 'documents'. I know there is ways to exclude categories by ID but I need to use the category slug as my dev and live databases do not match.


Is get_permalink also the canonical URL?

The question says it all. Does permalink equal canonical URL? Or is there another way to get the canonical URL?


Multisites - Select homepage based on location

Would it be possible to have index.php of domain.com to be a dropdown to choose the homepage based on whether the user is in city x or city y? I'd then like a cookie to be set that remembered the user's choice.


Closing WP_LINK_PAGES DIV ID w/After Argmuent

In my code below I need to close the div "link_wrap" which I created with `$args['before'] = '<div id="link_wrap">';` When I try to paste `$args['after'] = '</div>';` _above_ `return $args;` it adds the appropriate closing div but also renders the rest of my code, which allows _both_ previous/next links and pagination, completely useless. How do I properly close the div while maintaining the functionality of the rest of my code?               // WP_LINK_PAGES: Add prev and next links to a numbered link list     add_filter('wp_link_pages_args', 'wp_link_pages_args_prevnext_add');              function wp_link_pages_args_prevnext_add($args)     {         global $page, $numpages, $more, $pagenow;              $args['before'] = '
';         $args['link_before'] = '';         $args['link_after'] = '';              if($page-1) # there is a previous page             $args['before'] .= ' '. _wp_link_page($page-1)                  . $args['link_before'] . $args['previouspagelink']  . '' . ' '             ;              if ($page<$numpages) # there is a next page             $args['after'] = ' '. _wp_link_page($page+1)                . $args['link_before'] . $args['nextpagelink']  . ''             ;              return $args;          }


Nav menu items disappearing (but not immediately)

I'm working on a site where some of the nav menu items disappear (from the front end, the back end, and the database). However, debugging is extremely difficult since they don't disappear immediately! As a result, I'm unable to figure out what's triggering the deletion. More info:   * It seems as though nav menu items that are of the 'custom' variety (e.g. to an arbitrary url, rather than a post/page/category etc.) might be safe. I'm not 100% sure about that yet.   * At one point, new nav menu items were not being saved - I'd add several to a menu, click "Save Menu", and the menu would be saved with no menu items. Any suggestions on how to debug this particularly frustrating problem? This is on 3.4.1. I've just updated to 3.4.2, but I can't verify yet today that it's still happening (although I've no reason to believe it won't). Edit: I have confirmed that "custom" nav items (links to arbitrary url, vs. a WP page/category/etc.) do not get deleted.


Removing "Noindex, follow" from pages

I am using WordPress SEO plugin written by Yoast. This plugin, by default, shows "noindex,follow" on every page. I am sure I know the file that displays "noindex, follow" but after much "tweaking" I can't seem to remove the code. Here's the file: https://plugins.svn.wordpress.org/wordpress- seo/tags/1.2.8.3/frontend/class-frontend.php I'd really appreciate if you can let me know which line needs to be commented out, or what needs to be edited. :)


Entry page for a wordpress multisite

I am quite new too WP multisite, so forgive me for my ignorance on things. I have set up multisite ok and have setup 4 sites (i am using subdomains) >   * mysite.com // the root site >   * london.mysite.com // subsite >   * oxford.mysite.com // subsite >   * manchester.london.com // subsite > All the subsites are using the same template, well child templates of the main template so i can change the background colour of the site for each particular subdomain. on the `mysite.com` doamin, I would like to have a really simple page, could be static html for all i care, simply with links to each of the subdomains, there is to be no other content in this main domain just images or something similar so the visitor can go to the subsite they require. Whats the best way of doing this? i take i i cant just upload a static `index.php` as this will break the subsites. and as i have the default page for the site set to this i guess i have to load in the main wordpress index.php whatever i do. thanks for your time and suguestions


outlook calendar event from form post

After someone fills out a form on my site (using gravity forms) is there any known integration/widget that would allow me to have an "Add this event to my Outlook Calendar" link in the submission email/text? Thanks


How to query for most viewed posts and show top 5

Here is how I am getting the views for one post:               function getPostViews($postID){             $count_key = 'post_views_count';             $count = get_post_meta($postID, $count_key, true);             if($count==''){                 delete_post_meta($postID, $count_key);                 add_post_meta($postID, $count_key, '0');                 return "0 View";             }             return $count.' Views';         }      Let's say I want to find the most viewed posts from 5,000 posts and I want to show the top 5 most viewed posts. How can I make a query to achieve this?


Why doesn't WP_PLUGIN_DIR definition use DIRECTORY_SEPARATOR?

Whilst writing some code that backs-up a plugin, I hit a problem with 'the wrong kind of directory slash' on my windows dev environment. Tracking it through I find in default-constants.php:91               define( 'WP_PLUGIN_DIR', WP_CONTENT_DIR . '/plugins' );      which is based on the following in default-constants.php:46               define( 'WP_CONTENT_DIR', ABSPATH . 'wp-content' );      and hence to the config file definition...               define('ABSPATH', dirname(__FILE__) . '/');      So my question is: Q. Why are both ABSPATH and WP_CONTENT_DIR, which are intrinsically file system specific (ie can't be interpreted for URL's), definied using explicit forward slashes, rather than PHP's own DIRECTORY_SEPARATOR ?


How to prevent upload of a multiple sizes of images

on my theme, i found this script               add_image_size( 'slider', 464, 249, true );     add_image_size( 'fmenu', 306, 280, true );     add_image_size( 'teamthumb', 138, 207, true );     add_image_size( 'imlink', 286, 140, true );     add_image_size( 'albmlink', 274, 274, true );     add_image_size( 'fppost', 90, 90, true );      add_image_size( 'fslide', 520, 280, true );        i have disabled this, but when i upload another image, its generates 3 more images... like this:               original_file.jpg     origiinal_file-100x100.jpg     origiinal_file-109x109.jpg      i need only to upload the original file, there's a way to solve this?? I can't find where is this another 2 images sizes...


Permissions for installing themes and files in general?

www.net2ftp.com shows my permissions to be               rwxr-xr-x      for the top level directory which I aptly named wordpress ( test site ). This would be for ( user | group | other ) and ( read | write | execute ) so that I have write permissions if I am " user ". I am of course logged into wordpress with the only account that was setup at the beginning of the installation process. Because wordpress would not install unless I copy pasted the config file over manually...it seems it differentiates between manual editing of files and software copying/editing of files. Not to sure why? When I do an install I get the error:               Unable to create directory /home/domain/public_html/wordpress/wp-content/uploads/2012/03. Is its parent directory writable by the server?


Disabling Comment Notifications for Post Author

I am trying to disable comment notifications for post authors (or anyone else besides the site's admin) for a client's site. I've attempted to create a plugin that uses the pluggable function `wp_notify_postauthor`, but it does not seem to have an effect. Here's the plugin code:               <?php     /**      *      *      * @package   Disable_plugin_notifications      * @author    Me      * @link      <hidden>           *      * @wordpress-plugin      * Plugin Name:       Disable Comment Notifications      * Plugin URI:        <hidden>      * Description:       <hidden>      * Version:           1.0.0      * Author:            <hidden>      * Author URI:        <hidden>      */               // Disabling comment notifications for post authors     if ( !function_exists( 'wp_notify_postauthor' ) ) {         function wp_notify_postauthor() {             return;         }     }      I've also tried it without the 'return' in the function.


How to add category to: 'wp-admin/post-new.php'?

I want to have a link to create a new post that sets the category also. I have tried `wp-admin/post-new.php?post_category=12` and `wp-admin/post- new.php?cat=12`, but neither worked. I also tried using the name rather than the id of the category; which also had no affect. **How do I create a link to a new post with a default category?**


Hyperlink to create new post with predefined category

Complete WordPress novice here. I have created a site for my workplace. Items are sorted by category. On the dashboard (I have installed a custom dashboard plugin) I want to have a link which says "Upload Newsletter". When clicked, the user will be taken to a new post page on which the "Newsletter" category has already checked. I've read about hooking into various features to be able to do this but I have no idea what it all means. I need an idiots guide! Step by step please! :)


Trying to use wp_register_script/style and enqueu them from an array - getting an error

here is what i got so far:                 // my array     $this->headersArray = array(         array('handle' => 'buy_mobile_funcs', 'src' => 'jsFunctions', 'extention' => 'js', 'deps' => '', 'media' => ''),              array('handle' => 'css_main_style', 'src' => 'main_style', 'extention' => 'css', 'deps' => '', 'media' => 'screen')     );          // registering      foreach($this->headersArray as $singleHeader){         if($singleHeader['extention'] == 'js'){             wp_register_script(                 $singleHeader['handle'], plugins_url('scripts/'.$singleHeader['src'].'.'.$singleHeader['extention'],__FILE__),                  (!empty($singleHeader['deps']))? $singleHeader['deps']  : ''             );         }else{             wp_register_style(                 $singleHeader['handle'], plugins_url('css/'.$singleHeader['src'].'.'.$singleHeader['extention'],__FILE__),                  (!empty($singleHeader['deps']))? $singleHeader['deps']  : ''             );         }     }          // enqueuing      foreach($this->headersArray as $singleHeader){         if($singleHeader['extention'] == 'js'){             wp_enqueue_script($singleHeader['handle']);         }else{             wp_enqueue_style( $singleHeader['handle'], '', '', '', $singleHeader['media'] );         }     }      I know i could combine the 2 foreach. however i have a reason to keep it as it is now which is not relevant to the questions. Error:               Notice: wp_register_script was called incorrectly. Scripts and styles should not be registered or enqueued until the wp_enqueue_scripts, admin_enqueue_scripts, or login_enqueue_scripts hooks. Please see Debugging in WordPress for more information. (This message was added in version 3.3.) in /home1/stodeckc/public_html/orgadsite/wp-includes/functions.php on line 3012      Thanks in advanced.


I created this theme and it worked on my site without any problem. When I moved it to another server, I get `wp_register_script was called incorrectly.` error. I scanned my source code and I didn't use any wp_register_script ... however I am suspecting that it is reacting to this ...               function add_script_code() {         wp_deregister_script('jquery');          wp_enqueue_script('jquery', base_url('source/js/jquery-1.4.1-vsdoc.js'), false, '1.3.0', TRUE );         wp_enqueue_script('less', base_url('source/js/less-1.3.0.min.js'), false, '1.3.0', TRUE );         wp_enqueue_script('vars', base_url('source/js/vars.js'), false, '1.3.0', TRUE);         wp_enqueue_script('function', base_url('source/js/function.js'), false, '1.3.0', TRUE );     }          //add_action('admin_init', 'add_script_code');     add_action('wp_footer', 'add_script_code')      My code base is in github. The functions folder contains my functions for the theme. https://github.com/abarcenas29/dmp-v4 Base url is a function I created.               function base_url($url) {             return get_bloginfo('template_url').'/'.$url;         }


Change the background of each post according to the category

I am using the Hueman Theme. What I want to do is that the background of all the posts should change according to the category of the post. Please suggest something


Processing Forms with Paypal Framework plugin

Can I use the PayPal Framework Plugin to process a form and send the data to Paypal as a purchase. I am not even sure where to start If I can, but I want to know it this is what it is for.


Add submenus to Theme options menu

My theme currently has a single menu on the left hand sidebar of WP admin. I want to include submenus on that menu. How can I add, for example, a single submenu item to the "Theme Options" menu below?               add_menu_page(         "My Theme Options",          "Theme Options",          'edit_themes',          basename(__FILE__),          'my_admin',          get_bloginfo('template_directory') .'/img/favicon.png'         );


Wordpress Media Library - how to "uncache" images

When doing a recent Google search we noticed that some of our images are being cached by Google but the link that is attached to them is the actual media library link. So when you click on that link, it shows a really "ugly" page because this page is not really published and is the template. Is there any way to make images that we upload to our Media Library unsearchable or keep them out of being cached by Google?


When Installing a Plugin Where do I Move Template Files to?

I just installed a WP plugin cron-view I can't find where it is or what it's actually done. When going to the install directions though - http://wordpress.org/extend/plugins/cron- view/installation/ I get: "Upload your post template files (see the Description for details on configuring these), and choose them through the new menu." But that assumes that you know where (relative to the root directory) this is supposed to be put. Thoughts would be appreciated


post-new.php?post_type=product is not loading properly

Background: I have installed Jigoshop along with my custom theme. When I go to 'Add product' there is no featured image box showing. So I've added the code               add_theme_support( 'post-thumbnails' );      To functions.php, but the problem is still not resolved. Inspecting `post-new.php?post_type=product` brings up 3 errors:               Uncaught TypeError: Cannot call method 'appendChild' of null post-new.php:1112     Uncaught TypeError: Object [object Object] has no method 'datepicker' write-panels.js:119     Uncaught TypeError: Object [object Object] has no method 'select2' post-new.php:736      Also, the admin menus on the left of the page don't show any sub-menus, and when I click screen options it won't open. I need some help in working out what is happening to cause those errors and I think that is what is causing a knock on effect to prevent featured images displaying on my admin page. Your help/advice is much appreciated!


Adding a css style to the main nav menu in child pages

I have a WordPress site where I am adding a custom style to the main navigation based on whether the user is on that page. The articles section of my site has several articles within it that users can visit. I use this css style as seen below which has the desired effect when the viewer is on the articles page, WordPress helpfully adds the current-menu-item class to the html markup:               #navigation li a:hover, #navigation li.current-menu-item a {     text-shadow: 1px 1px 2px red;     -webkit-transition: color 0.5s, text-shadow 0.5s;     -moz-transition: color 0.5s;     -o-transition: color 0.5s;     }      However I would like to keep this style applied to that top level item if the user is in a single article page. Is there a way of achieving this?


How to restrict user to choose 1 category for a post

I wish to restrict the user posting a new article to select only 1 category for that post. It doesn't matter which category he chooses as long as he chooses just one. This way posts are maintained under a hierarchy (and I want to avoid users clicking all categories so that their posts appear everywhere). I don't want to restrict the user to a specific category, I just want to limit the number of categories the user can choose for a post to 1. Is there any way to achieve this in Wordpress?


Display last login time

I am using this script to get the last time a user logged in               function get_last_login($user_id) {         $last_login = get_user_meta($user_id, 'last_login', true);         echo human_time_diff($last_login) . " " . __('ago');         }      I am calling it in author.php with `<p>Last login: <?php get_last_login($userdata->ID); ?></p>` I am trying to output like "last login X days ago" but I can't get it working. $last_login output is `2011-05-13 18:00:06` but the final output I get is `last login 15108 days ago`


Website Opened at http:// but after updation website crashed

My website which earlier opened at http://yeshuvandana.com after my client notified me that it didn't opened at the previous address , So I went to change the WordPress address and Site address in the wordpress admin panel through general options panel , I updated it to http://www.yeshuvandana.com but as I updated it my website crashed and cant open it now . :( Now , I want to restore those settings and change my website address to ideal web addresses but in order to do so I have to recover what I did and how can I fix the above errors , Please help I dont want to create that website again and do the coding !


Get URL of Post You Are Editing

I can't seem to find this anywhere, Is there a way to retrieve the URL of the post (which is of a custom post type) you are editing. Basically I want to somehow get the same URL that shows up like this: Permalink: (link to post) on the edit screen.


Problem with Custom Post Types, Taxonomy, permalink, Archive

I set up 2 custom post types: beats and tracks. And I set up the taxonomy 'tags' and 'style' for both custom post types. the permalinks for the custom post types are set in functions.php: beats/%style%/%postname% and tracks/%style%/%postname% I have a problem, when the url is /beats/%style% and /tracks/%style% without the postname (archive). Then, all 'beats' and 'tracks' posts whiches are in the %style%, are visible. Not only the beats or only the tracks from the style tax. When I make an echo of get_post_type(), the echo always is 'beats'. Even when the url is /tracks/%style%. Here is my code:               <?php          add_action('init', 'reg_music');          function reg_music() {         register_taxonomy(         'style',         array (         0 => 'beats',         1 => 'tracks',         ),         array(             'label' => 'Styles',             'singular_label' => 'Style',             'hierarchical' => true,             'query_var' => true,             'rewrite' => array('slug' => 'beats','slug' => 'tracks'),         )     );          $labels = array(         'name' => _x('Beats', 'post type general name'),         'singular_name' => _x('Beat', 'post type singular name')     );          $args = array(         'labels' => $labels,         'public' => true,         'publicly_queryable' => true,         'show_ui' => true,         'show_in_menu' => true,         'query_var' => 'beats',         'capability_type' => 'post',         'hierarchical' => true,         'menu_position' => null,         'supports' => array('title','editor','excerpt','trackbacks','custom-fields','comments','revisions','thumbnail','author','page-attributes',),         'rewrite' => array(             'slug' => 'beats/%style%',             'with_front' => false         ),         'has_archive' => true     );           register_post_type( 'beats' , $args );           $labels = array(         'name' => _x('Tracks', 'post type general name'),         'singular_name' => _x('Track', 'post type singular name')     );          $args = array(         'labels' => $labels,         'public' => true,         'publicly_queryable' => true,         'show_ui' => true,         'show_in_menu' => true,         'query_var' => 'tracks',         'capability_type' => 'post',         'hierarchical' => true,         'menu_position' => null,         'supports' => array('title','editor','excerpt','trackbacks','custom-fields','comments','revisions','thumbnail','author','page-attributes',),         'rewrite' => array(             'slug' => 'tracks/%style%',             'with_front' => false         ),         'has_archive' => true     );             register_post_type( 'tracks' , $args );       // flush_rewrite_rules();     }          add_filter('post_type_link', 'music_permalink_structure', 10, 4);     function music_permalink_structure($post_link, $post, $leavename, $sample)     {     if ( false !== strpos( $post_link, '%style%' ) ) {         $event_type_term = get_the_terms( $post->ID, 'style' );         $post_link = str_replace( '%style%', array_pop( $event_type_term )->slug,         $post_link );     }     return $post_link;     }          register_taxonomy('tags',array (     0 => 'beats',     1 => 'tracks',     ),array( 'hierarchical' => false, 'label' => 'Tags','show_ui' => true,'query_var' =>     true,'rewrite' => array('slug' => 'tag'),'singular_label' => 'Tag') );          ?>


link to single most recent post, regardless of category

I have a landing page that, among other things, features an excerpt from the most recent post with a "Continue Reading" link that should take the reader to the most recent post. In my search, I've found a lot of guides on how to link to the most recent post within a specified category, but not much on the most recent post regardless of category(because it will vary). ETA:

Growing Edge Blog
                         <?php                         // Get the most recent post                         $the_query = new WP_Query( 'posts_per_page=1' );                              // Pull the excerpt                         while ( $the_query->have_posts() ) : $the_query->the_post();                             the_excerpt();                         endwhile;                              // Reset Post Data                         wp_reset_postdata();                          ?>
                              <?php                         $latest = new WP_Query( array( 'posts_per_page' => 1 ) );                         while( $latest->have_posts() ) :                             $latest->the_post();                             echo '' . get_the_title() . '';                         endwhile;                         ?>

      Any ideas? Thanks.


Create a WP page - does it automatically create at a forwarded domain?

If I have a WP site at mydomain.com with domain forwarding from `mydomain.co.uk` to `mydomain.com` and if I create a page at `mydomain.com/page-name` will `mydomain.co.uk/page-name` automatically be created? If not, is there a way to make it so pages are automatically created in this way?


Trying to pull tag on image attachment for a containers class

So here is my query:                       <?php                 $page = (!empty($_GET['myp'])) ? $_GET['myp'] : 1;                 $per_page = 20;                 $base = get_queried_object();                 // var_dump($base);                 if (null === $base) {                   $base = site_url();                 } else {                   $base = get_permalink($base->ID);                 }                 $all_work = new WP_Query(array(                     'post_type' => 'work',                     'tax_query' => array(                         array(                             'taxonomy' => 'type',                             'field' => 'slug',                             'terms' => array('case-study', 'portfolio')                         ),                     ),                     'posts_per_page' => '20',                     'orderby' => 'title',                     'order' => 'ASC',                     'update_post_term_cache' => false,                     'nopaging' => false,                     'paged' => $page                     )                 );                      $total = $all_work->found_posts;                 //var_dump($total);                      while ( $all_work->have_posts() ) : $all_work->the_post();                      $terms = get_the_terms($post->ID, 'post_tag');                  ?>      and here is my container:               <ul class="<?php echo $terms[0]->slug; ?>">      What I am trying to achieve it having the tag that has been assigned to the displayed attachment show up for my ul class, but I am not sure how to query the attachments post_type and not pull from the "work" post_type that is in my query. I also found wp_get_object_terms in the codex but they both render out the tag of the post and not the tag of the image being pulled in.


update_user_meta duplicates entry

I have a very simple code in my themes footer               if (is_user_logged_in()) {      $user = wp_get_current_user();      $aka2 = get_user_meta($user->ID, 'last_visited_blogs', true);      $aka2[] = 'blog4';      update_user_meta($user->ID, 'last_visited_blogs', $aka2);     } ?>      What it does is, gets meta value, inserts new entry and updates meta with new a array. like if it contain something: [0] => 'blog1', [1] => 'blog2', [2] => 'blog3' and after function it should look like [0] => 'blog1', [1] => 'blog2', [2] => 'blog3', [3] => 'blog4' but, what it does is, it inserts two values on execution even when it's empty [0] => 'blog4', [1] => 'blog4' and on every next execution it inserts two values


Show a custom field instead of username in the backend author area

I'm building a new WP site with about 1200 authors(which are actually companies, pulled from my client's existing site), each attached to at least one custom post type. My problem is the admin(our client) is used to seeing the company name as the 'Author' instead of the username (which is an email address). Is there a way in the backend to make the normal 'Author' field (ie: in post columns, and in the post editor author metabox) into a custom field (which currently exists in our system) that is the company name(lets call the field 'wp_organization')?? And all this without editing core WP files that could be overwritten during an upgrade(ie: use the functions.php instead?)... I'd assume its a simple function to call the custom field instead of author, but haven't been able to find it yet...


Getting WordPress Flexslider Item Number

I add flexslider to my theme home page via this code.how can I get number of per item? **as 1 2 3 4 ......**                   <?php             $args = array( 'post_type' => 'try', 'posts_per_page' => 3 );             $query = new WP_Query( $args );             while ($query->have_posts()) : $query->the_post();              ?>
             <?php the_post_thumbnail('featured'); ?>
                 <?php the_title();?>                 <?php the_excerpt(); ?>                 Play Now

              <?php             endwhile;         ?>


Invalid Taxonomy in template

I have looked through the posts here that involve this same error, without any luck. I have a Custom Post Type (Staff) and a custom taxonomy for it. Making Staff posts and assigning terms is working fine, but I'd like to list all of the Staff in groups based on the taxonomy terms. But **the terms do not come through**. The Template File is here: http://pastie.org/4372363 The (relevant parts of the) functions.php file is here: http://pastie.org/4372367 Any reason why I wouldn't be able to do this? The result looks like this:

Array

...

...

...

...

...

...

Array

...

...

...

...

...

...

      With the content of the array being another Array with one item in it, being the "Invalid Taxonomy" error (a string). Thanks!


Using post type archive page for taxonomy archive

I have separate post type archive and taxonomy archive page. eg. `archive- product.php` and `taxonomy-price.php`. So when i goto `example.com/product/?price=100` it redirect to `example.com/price/100` and using the `taxonomy-price.php` to display the posts. It seem the wp take the priority of taxonomy to display to posts. So what I want is using the `archive-product.php` to display the posts,how can I do this?


Submitting posts from the front end - sanitizing data

I have a form that allows any registered user to submit a post (it's a custom post type - forum related), and I'm using `wp_insert_post()` to insert it into the db. From what I've seen in this function a sanitize_post() function is run automatically, but I think this only handles db escaping and such. So how do I sanitize the input data the same way as the wp-admin editor does? I mean apply the kses filter and all the other stuff...


How to create an edit media button for slideshow plugin?

I want to create an edit media button for my plugin, right now you can easily upload images using the WordPress 3.5 media uploader but I want the user to be able to edit the uploaded images, something like this: ![example of uploader](http://i.stack.imgur.com/LY4fZ.png) Any ideas on how that can be achieved? Here is the code that I am using to open the media uploader right now:                   var file_frame;     jQuery('#asp_slides_upload').live('click', function(event){              event.preventDefault();              if (file_frame) {             file_frame.open();             return;         }              file_frame = wp.media.frames.file_frame = wp.media({             title: jQuery(this).data('uploader_title'),             button: {                 text: jQuery( this ).data('uploader_button_text'),             },             multiple: true         });              file_frame.on('select', function() {             var selection = file_frame.state().get('selection');             var postID = jQuery('#asp_gallery_id').attr('value');             attachments = selection.toJSON();             printableAttachment = JSON.stringify(attachments, null, 2);             jQuery.ajax({                 type: "POST",                 dataType: "JSON",                 url: aspAdminUrls.ajaxurl,                 data: {                     action: 'asp_save_slides',                     content: attachments,                     postID: postID                 },                 success: function(data) {                     jQuery('#asp_slides_holder').append(data);                 }             });              });              file_frame.open();     });


Is it possible to add a superscript trademark symbol to a menu?

Is it possible to add a superscript trademark symbol to a WordPress menu?


How to set a Maximum Image size to a Field in WordPress

I have a customized frontend form in WordPress that allows to set a featured image to a post before publishing it. I want to set a maximum-allowed "width" as well as a "height" to the "upload image" field so that image resolutions that are lesser than the required resolution get uploaded and resolutions more than the set value get rejected with an error. Currently I have the following code on the field, but it ain't working :               $tmpName = $_FILES[$file]['tmp_name'];                     list($width, $height, $type, $attr) = getimagesize($tmpName);                      if($width!=100 || $height!=100)                 {                     $error .= "Image is to small<br />";                     unlink($_FILES[$file]['tmp_name']);                  }      As you see above the width and height are specified. What change I should go ahead with so that the above values become the maximum allowed resolution.


How can I disable sorting/dragging of a menu item in the custom menu admin?

I think my problem is partially a javascript problem, but if someone knows of a better way to do this I'd love to hear it. Basically the goal is to "save the client from themselves" by not allowing them to move around certain menu items in the custom menu. For SEO reasons. Whether that makes sense or not is beside the question :) I'm trying to disable the item from being sortable by adding a script doing this: `jQuery("#menu-item-10 dt").sortable("destroy");` The dt is the "handle" for the sortable method called in nav-menu.js from WP core. I'll be making some changes to dynamically get the correct menu item ID but basically this is what I'm trying. I've also tried .sortable({disable: true}) without luck. I always get an error: `Uncaught Error: cannot call methods on sortable prior to initialization; attempted to call method 'destroy' I've tried a bunch of different things. My script is in a document.ready wrap and I've got it running in the bottom of the admin footer using the admin_footer-hook_suffix hook (hook_suffix is nav-menus.php in this case). I have put it in a setTimeout to make sure it runs after everything else is already loaded. Any ideas on what I'm doing wrong or how I can do this better? Or what other info I can provide to help make this clearer? Thanks!


Custom post type meta box empty after save

I'm trying to make a meta box to include a date picker but my initial attempt to have the textbox data seems to fail as each time its either posted or saved again the text disapears                   <?     /*     Plugin Name: Mobilisation     Plugin URI: http://www.seriadesign.com     Description: Plugin servant a gerer la mobilisation     Version: 0.01     Author: Christophe Rudyj     Author URI: http://www.seriadesign.com     License: Seria-CSN     */      // Create out post type         add_action( 'init', 'csn_mob_register' );         function csn_mob_register() {         $labels = array(         'name' => _x( 'Mobilisations', 'mob' ),         'singular_name' => _x( 'Mobilisation', 'mob' ),         'add_new' => _x( 'Ajouter', 'mob' ),         'add_new_item' => _x( 'Ajouter une Mobilisation', 'mob' ),         'edit_item' => _x( 'Editer une Mobilisation', 'mob' ),         'new_item' => _x( 'Ajouter une Mobilisation', 'mob' ),         'view_item' => _x( 'Voir une Mobilisation', 'mob' ),         'search_items' => _x( 'Rechercher une Mobilisations', 'mob' ),         'not_found' => _x( 'Aucune mobilisations trouvée', 'mob' ),         'not_found_in_trash' => _x( 'Aucune mobilisations trouvée dans la Corbeille', 'mob' ),         'parent_item_colon' => _x( 'Parent Mobilisation:', 'mob' ),         'menu_name' => _x( 'Mobilisations', 'mob' ),         );         $args = array(         'labels' => $labels,         'hierarchical' => false,         'supports' => array( 'title', 'editor' ),         'taxonomies' => array( 'category' ),         'public' => true,         'show_ui' => true,         'show_in_menu' => true,         'menu_position' => 5,         'show_in_nav_menus' => true,         'publicly_queryable' => true,         'exclude_from_search' => false,         'has_archive' => true,         'query_var' => true,         'can_export' => true,         'rewrite' => true,         'capability_type' => 'post'         );                 register_post_type( 'mob', $args );         register_taxonomy_for_object_type( 'category', 'mob' );         }           function important_category( $id, $post ) {     if ( 'mob' === get_post_type( $id ) ) {      $category   = get_term_by( 'slug', 'important', 'category' );      $categories = wp_get_object_terms( $id, 'category', array( 'fields' => 'ids' ) );      if ( !in_array( $category->term_id, $categories ) ) {       wp_set_object_terms( $id, ( int ) $category->term_id, 'category', true );      }     }     } add_action( 'wp_insert_post', 'important_category' );          /* meta box */     add_action( 'add_meta_boxes', 'mob_date_add');     function mob_date_add() {              add_meta_box( 'mob_datebox','Date de Fin', 'mob_dateshow', 'mob','side', 'default' );     }          function mob_dateshow() {     global $post;           $values = get_post_custom( $post->ID );           $text = isset( $values['mob_datetext'] ) ? $values['mob_datetext'] : '';          wp_nonce_field( 'my_meta_box_nonce', 'meta_box_nonce' );         ?>           <label for="mob_datetext">Date de fin</label>           <input type="text" name="mob_datetext" id="mob_datetext"  value="<?php echo $text; ?>" />            <?     }          add_action( 'save_post', 'mob_datebox_save', 1, 2);       function mob_datebox_save( $post, $post_id )       {           // Bail if we're doing an auto save           if( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ) return;               // if our nonce isn't there, or we can't verify it, bail          if( !isset( $_POST['meta_box_nonce'] ) || !wp_verify_nonce( $_POST['meta_box_nonce'], 'my_meta_box_nonce' ) ) return;               // if our current user can't edit this post, bail           if( !current_user_can( 'edit_post', $post_id ) ) return;       }                 // now we can actually save the data           $allowed = array(                'a' => array( // on allow a tags                   'href' => array() // and those anchors can only have href attribute               )           );                // Make sure your data is set before trying to save it           if( isset( $_POST['mob_datetext'] ) )               update_post_meta( $post_id, 'mob_datetext', wp_kses( $_POST['mob_datetext'], $allowed ) );                           ?>


Do I need to use a new WordPress.com account for each Jetpack installation

I manage lots of WordPress.org installations for different clients. Typically they do not manage the posts or pages themselves, preferring to stay out of things and let me do it. JetPack functionality is great, but obviously you need to sign into a WordPress.com account within the installation to access it. My question is - is it recommended to create new WordPress.com accounts for each client, or shall I just sign in to mine on each installation? What are the pros / cons e.g. are the WP-stats merged (this would obviously be bad)? Many thanks


Looking for a simple checkout plugin

I want to sell tickets to an event on my wordpress site. I don't want to use a huge shop or partner up with ticketmaster etc. What I want is let the customer decide how many tickets of a certain category they want and make a reservation, no payment involved. It should be able to display the total amount due and a nice message on submit. Is there a simple plugin without much overhead? What should I use?


How to style current page menu item when using a walker

I have designed a custom menu and would like to be able to style the individual li dependent whether it is the current page or not? I believe this is normally pretty straightforward using a class such as current-menu-item. I however am also using a walker in my nav to show an extra description field - this appears to disable it, can anyone please help??
              <?php          $walker = new My_Walker;          wp_nav_menu(array( 'menu' => 'nav','walker' => $walker ) );          ?>
      UPDATE:               class My_Walker extends Walker_Nav_Menu     {         function start_el(&$output, $item, $depth, $args) {             global $wp_query;             $indent = ( $depth ) ? str_repeat( "\t", $depth ) : '';                  $class_names = $value = '';                  $classes = empty( $item->classes ) ? array() : (array) $item->classes;                  $class_names = join( ' ', apply_filters( 'nav_menu_css_class', array_filter( $classes ), $item ) );             $class_names = '';                  $output .= $indent . '
ID . '"' . $value . $class_names .'>';                  $attributes  = ! empty( $item->attr_title ) ? ' title="'  . esc_attr( $item->attr_title ) .'"' : '';             $attributes .= ! empty( $item->target )     ? ' target="' . esc_attr( $item->target     ) .'"' : '';             $attributes .= ! empty( $item->xfn )        ? ' rel="'    . esc_attr( $item->xfn        ) .'"' : '';             $attributes .= ! empty( $item->url )        ? ' href="'   . esc_attr( $item->url        ) .'"' : '';                  $item_output = $args->before;             $item_output .= '';             $item_output .= $args->link_before . apply_filters( 'the_title', $item->title, $item->ID ) . $args->link_after;             $item_output .= '' . $item->description . '';             $item_output .= '';             $item_output .= $args->after;                  $output .= apply_filters( 'walker_nav_menu_start_el', $item_output, $item, $depth, $args );         }     }


Plugin screenshots not showing in the repository

I'm having major trouble getting the screenshots to show in my plugin. I have validated the readme file and placed the screenshots in both the `/trunk` and `/tags/1.0` directories (1.0 is stable). I have looked at many search results and quite a few existing plugins to see what I'm doing different but I'm failing to see what, if anything, I am doing wrong. The output of running pngcheck is               $ pngcheck trunk/*.png     OK: trunk/screenshot-1.png (1418x761, 24-bit RGB, non-interlaced, 98.4%).     OK: trunk/screenshot-2.png (699x373, 24-bit RGB, non-interlaced, 77.6%).     OK: trunk/screenshot-3.png (370x701, 24-bit RGB, non-interlaced, 70.1%).     OK: trunk/screenshot-4.png (935x331, 24-bit RGB, non-interlaced, 93.8%).          No errors were detected in 4 of the 4 files tested.      The plugin repo is at http://plugins.svn.wordpress.org/tel-link-obfuscate/   The screenshots section of the WP plugin page just displays the description of the plugin      Obviously any help is appreciated and until then I'll just have to live without screenshots on my plugin page.


Pagination 404 on Index with custom query

On my wordpress index, I use a custom query:               $paged = (get_query_var('page')) ? get_query_var('page') : 1;          $project_query = new WP_query(array(       'post_type' => 'project',       'paged' => $paged,       'posts_per_page' => 5     ));      I am using wp-paginate to setup page numbering, but regardless, as soon as I try to go to the next page, eg: `http://domain/page/2` I get a 404 error. I really cannot for the life of me figure out what is happening. I've set the wordpress reading option to the same number, and my permalink structure is set to `Post name`. Any tips greatly appreciated, I know pagination 404's are a common issue with a lot of people but I haven't been able to find someone who had the same issue with the index.


Lead/contact form export to XML

I have a lead form that I want to send leads to an external CRM in XML format when someone fills it out. Ive looked at most of the popular solutions documentation (Contact form 7, gravity, Wufoo) and cannot seem to find a solution to this issue. They seem to only offer email notifications.. Anyone know of an easy way to do this?


SQL / wp_update_post: change post custom field to CPT post taxonomy

the setup is as follow: I have posts with a custom field: `actor = 'tom hanks'` for advanced management I created a custom post type (actors) and added "tom hanks" as a post within that actors taxonomy. Via plugin 'Advanced custom fields' I connected the custom taxonomy (actors) to the default posts so I can select 'tom hanks' on the regular post page. This can be done manually (check the custom field value and click the according actors category) but there are way more than 1500 posts and many other similar custom field values. Do you have any idea how that can be solved via SQL query or function? in one line: **get value from customfield 'actors' and move to taxonomy('actors') for that post.** the custom field value could be used as the taxonomy slug. I think it's also possible with the wp_update_post function but I have no idea how to call all posts, the custom fields and taxonomy. If somebody can please help me out with the query for a mysql or similar you would definitely make my day :) EDIT: I think `wp_update_post` is a good way to accomplish this task.               // get all post IDs     $post_ids = get_posts(array(         'post_type' => 'post',         'post_status' => 'publish',         'numberposts'   => -1, // get all posts.         'fields'     => 'ids', // Only get post IDs     ));          // info: custom field 'actor' = 'Tom Hanks'          // Update all posts     foreach ($post_ids as $id) {            $excerpt =  get_post_meta($id, 'excerpt', true);  // for testing purpose I added a customfield 'excerpt'         // info: custom field 'actor' = 'Tom Hanks'       $customfield_value = get_post_meta($id, 'actor', true);       // change the custom field values to slug format:  'Tom Hanks' > 'tom-hanks'       $customfield_value = sanitize_title_with_dashes($customfield_value);                 $post = array(         'ID' => $id,      // select all posts         'post_excerpt' => $excerpt, // update the excerpt field with the customfield 'excerpt'         'tax_input'      => array(           'actor' => array(             $customfield_value           )         )       );            wp_update_post( $post );            // delete the old post meta after we moved it to the taxononmy       //delete_post_meta($id, 'actor');          }


Custom field within shortcode

I'm currently using the 'WP Simple Paypal Shopping Cart' plugin to get up a simple paypal e-commerce site, it's super easy to use, but to save the client having to write shortcode, I've set up custom fields in the back-end to input the product name and price.   The `Add to Cart` button is generated using a simple piece of shortcode like so:                 <?php echo print_wp_cart_button_for_product('Product Name', Product Price); ?>      Obviously replacing `Product Name` and `Product Price` with the name and price you're adding to the site. I have 2 custom fields set up like so:                 <?php the_field('product_name' ); ?>     <?php the_field('product_price' ); ?>      I'm trying to figure out if there's anyway to put those custom fields inside the shortcode, replacing `Product Name` and `Product Price` and thus allowing people to add products to the site without having to write any shortcode. Any suggestions would be greatly appreciated!


Better WP Security : dashboard doesn't work any more

Just installed Better WP Security (with File Change Detection feature activated), then logged out. Now wp-login.php is blank with the message : Notice: unserialize() [function.unserialize]: Error at offset 0 of 93 bytes in /home4/mysite/public_html/wp-content/plugins/better-wp-security/inc/secure.php on line 20 What can I do do access the dashboard again?


An action hook where a comment meta is updated

By analogy to the hook on post meta update, I use the following code for hooking when comment meta value is updated. My comment meta key is "consider" and can have 2 values: 0 and 1. My Goal is to count number of comments with `consider=1`, and when this count reaches 10, perform some operations.                           add_action( 'update_comment_meta', 'ten_considered_comments_badge');                      function ten_considered_comments_badge($meta_id, $comment_id, $key, $value)                     {                         if ( 'consider' != $key or 1!= $value)  return;                              $com=get_comment($comment_id);                         if ( !$com  )  return;                         $args = array(       'type' => '',       'user_id' => $com->user_id,       'meta_key' => 'consider',       'meta_value' => '1',     );     $com2= get_comments($args);                  $count = count($com2);                               if( $count%10==0) {               $number_of_bronze_badges= get_user_meta($com->user_id,'user_number_of_bronze_badges',true);             $number_of_bronze_badges= $number_of_bronze_badges + 1;                  update_user_meta($com->user_id, 'user_number_of_bronze_badges', $number_of_bronze_badges);             }             }      What I am missing in this code . Your help is highly appreciated.


Hyphens vs. periods in the script slug in wp_register_script?

I have seen script and style handles written in two different ways in `wp_register_script` and `wp_enqueue_script` (the same applies to `wp_register_style` and `wp_enqueue_style`):   1. `wp_register_script( 'jquery-someplugin', $location );`   2. `wp_register_script( 'jquery.someplugin', $location );` #1 uses a hyphen, #2 uses a period. What is the best practice here? Which should I be using?


Showing the custom taxonomy parent term and child term of a post

Is there any way that you can show a custom taxonomy's parent term and child of a post? I'm currently using `get_the_term_list()` to display the custom tax terms of the post. The only problem is the order or arrangement of the terms, is alphabetical. What I want is to display the parent term first before the child terms. Is it possible to manipulate/customize the HTML tags of the output? What I want to display is something like this:   * Parent Term      * Child Term 1     * Child Term 2


WP Customizer - what types of fields is it capable of supporting?

I just found this reference of WP Customizer types of data input: https://gist.github.com/Abban/2968549 But I wonder if there's an option to have for instance a range slider? Something that would allow users to pick a value between `50px` and `200px` or between `1em` and `2em`? Ideally it should also allow switching units - like from `px` to `%` and vice versa. Is this possible at all or does it require some custom extension? I also noticed that textarea isn't there.


Article Template

have a little problem. I'm currently creating a theme, where the article page is not on the home page. The trouble now is that on the home page below are three content boxes and they should not appear on the article page. I created a blog page template (blog.php) and created a new page and inserted the blog page template there. The blog page template references in the source to a loop (loop-blog.php) where the content to be displayed is. Neither the blog.php or the loop-blog.php have anything from the code that is responsible for the content boxes but still I see the content boxes on the article page. Content of blog.php:                   <?php /* Template Name: Blog */ ?>     <?php get_header(); ?>

                  <?php if ( ! have_posts() ) : ?>
Nicht gefunden!

Sorry, leider konnte der gewünschte Artikel nicht gefunden werden. Vielleicht hilft dir die suche ja weiter!
                  <?php endif; ?>                  <?php while ( have_posts() ) : the_post(); ?>                  <?php get_template_part( 'blog', 'loop-blog' ); ?>                       <?php endwhile; ?>                  <?php if(function_exists('wp_paginate')) {             wp_paginate();             } ?>

          <?php get_footer(); ?>      Content of the loop-blog.php

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

<?php the_time('j. F Y'); ?> | <?php the_author_posts_link(); ?> | Veröffentlicht unter: <?php the_category(', ') ?> | <?php comments_popup_link('keine Kommentare', '1 Kommentar', '% Kommentare', 'comments-link', 'Kommentarfunktion deaktiviert'); ?>

                 <?php if ( is_archive() || is_search() ) : // Only display excerpts for archives and search. ?>                     <?php the_excerpt(); ?>                 <?php else : ?>                     <?php the_content('Weiterlesen'); ?>                 <?php endif; ?>

      The categories was made in the same way, and here it works as it should. The content boxes are not displayed. I'm a bit stumped here, where is the mistake?


Change taxonomy to metabox?

I created a custom taxonomy, but I need the taxonomy values in a metabox within the same post. How can I archive this? I tried several plugins for taxonomy management, but none of them could do what I wanted.


TwentyThirteen theme Posts page shows posts instead of page content

Under: > Settings -> Reading -> Front page displays -> A static page -> Posts page I can choose the name of a WordPress page from the drop-down menu. How come WordPress takes the page title, displays the page title in the menu on the front page, and then, when I click on the page title I am shown the blog posts, instead of that page's content? This makes me think pages are not suitable for use in this area as once I designate a page as the posts page, its content becomes hidden and is no longer visible. Could someone please explain why WordPress works in this way? The way the > Settings -> Reading -> Front page displays -> A static page -> Front page works on the other hand is clear. When the user goes to the URL corresponding to the WordPress document root or clicks on the text in the header, WordPress displays this page.


Prevent users from going to wordpress profile after login

I've got a custom role for my site and users can only access their profile page, this appears to be the minimum for wordpress. However, the accounts are managed by us and this is a private site, we do not want users to be able to change their username, email or password using wordpress. The only issue we have right now is logging in. The inner pages all require you to be logged in. We have a landing page with a link to the login page, for this link we apply `redirect_to=/blog/` and after logging in you go to the blog. This works well enough for us. However, if a user links to an inner page (or recieves the link in an email automatically, from subscription setting) then the link will require them to login, taking them to the login screen **without the redirect_to parameter**. This means they will go right to the profile page. Why it goes to the profile page instead of the page they requested is beyond me, but we need to redirect them back to the blog. Here is a function I set up with the intention that after logging in, you will get taken to the blog. At this point we don't care if a permalink doesn't work on first visit (of course they will once you log in). But this function does not work. wp_signon is not triggered _after a user logs in_ , but instead is used to log a user in. What should I do?               function login_redirect() {         wp_redirect( get_bloginfo( 'url' ) . '/blog/' );     }     add_action('wp_signon', 'login_redirect');`


WP_Query Date Filtering Inclusive Being Ignored

I'm currently working on a plugin that contains a shortcode which allows users to filter a custom post type by date. They could choose "Date From", "Date To", and "Date From with Date To". When using the inclusive flag, it ignores the inclusive flag and does not select the date that is entered in the shortcode. For instance if I had selected `datefrom=1/10/2013` and `dateto=05/16/2014` it selects only the posts between 1/10/2013 and 5/15/2014. If I want to select 5/16/2014 I have to make `dateto=5/17/2014`. What is the proper usage? Here is what I currently have:                 //both datefrom and dateto         if (($datefrom != "") && ($dateto != "")){             $args['date_query'] = array(                 array('after' => $datefrom,                 'before' => $dateto),                 'inclusive' => true);         }      Thanks for your time!


wp_head rel=next and rel=prev on certain pages only

I'm trying to hook the wp_head() to add the rel=prev and rel=next only in certain pages, but I'm not sure this can be done. I was expecting the do_action to be able to help me on this, but apparently I was wrong. I would like to avoid as much as possible customised code inserted with functions that are not part of the core. Any help? Thanks Andrea


Multiple SERPs using WordPress Multisite with additional Multilanguage support

I am wondering about proper choice for multiple WordPress installation making it easy to maintain and achieve best SEO, more precisely best SERPs with also Multilanguage support. By SERPs I mean this layout: ![enter image description here](http://i.stack.imgur.com/XNJ2z.png) My scenario is like below:   * main site about overall company group description   * sub site about company department (branch) specialized in services A   * sub site about company department (branch) specialized in services B   * sub site about company department (branch) specialized in services C **Each subside has its own menu structure, content and only link to company group description.** I would like to use Multisite Mode in WordPress to achieve this. However additional requirement for me is to make it multilingual. It is possible by combining:   1. **WordPress MultiSite**   2. WPML **or** qTranslate **or** Polylang   3. All in One SEO Pack **or** WordPress SEO plugin by Yoast To achieve SERPs like these? I. For **main site** SERPs ( **default language** used):               domain.net         domain.net/about        domain.net/clients         domain.net/news         domain.net/contact      I.a) For **main site** SERPs ( **custom language** used):               en.domain.net         en.domain.net/about     en.domain.net/clients         en.domain.net/news      en.domain.net/contact      II. For **sub site** SERPs ( **default language** used):               domain.net         domain.net/services-A/about     domain.net/services-A/clients         domain.net/services-A/news      domain.net/services-A/contact      II.a) For **sub site** SERPs ( **custom language** used):               en.domain.net         en.domain.net/services-A/about      en.domain.net/services-A/clients         en.domain.net/services-A/news       en.domain.net/services-A/contact      As asked before is it possible to:   1. Have different SERPs based on multiple WordPress installation each SERP separate by each installation (different services) inside WordPress Multisite? If so, is it possible using subfolder like in my example or it must be subdomain for Multisite?   2. Have different SERPs based on multiple WordPress language plugins each separate by each translated page?    3. Have possibility to optimize SEO separately to each translated page inside WordPress Multisite?   4. If overall is possible, what plugins from mentioned at the beginning use to achieve this combo (which one are compatible with others)? **UPDATE:** If I drop idea of Google sitelinks overall, is it still possible to achieve different SERPs for Multisite WordPress with Multilingual support, like:   * domain.net   * en.domain.net (only translation)   * domain.net/services-A/ (sub site in WordPress Mutlisite)   * en.domain.net/services-A/ (sub site in WordPress Mutlisite + translation) ... so overall achieving 4 different SERPs ?


Bootstrap Scrollspy Incorrect Highlighting

I have a WordPress site that integrates bootstrap scrollspy. Scrollspy is activated when you scroll but it highlights the first two items incorrectly in the navbar. It seems there is an offset problem due to the first content box being bigger than the other ones, but I have added an offset in the body tag and through `jQuery('.navbar').scrollspy()`. I also added `padding-top: 100px` to the first content box on the page. None of these solutions work. What am I missing here? The working page


How to use custom taxonomy checkboxes to filter a taxonomy archive?

So my site features two custom taxonomies:   * Topics (Economics, politics, literature, etc. )   * Post Type (Reviews, Analysis, Essays, etc. ) On the homepage I display a menu with topics, and once on the taxonomy archive page (e.g. site.com/topics/economics), I want the user to be able to filter the post snippets through checkboxes (one for each Post Type). I already created the checkboxes using `get_terms('types')`. I thought of using a GET parameter and then using `pre_get_posts` hook to do the filtering but I was wondering if there is a Wordpress out-of-the-box solution?


wordpress pagination problem with page templates

just now i found that pagination depends on permalink structure.I am using wp 3.8 version. For pagination in page template I used               <?php     $paged = (get_query_var('paged')) ? get_query_var('paged') : 1;     query_posts('posts_per_page=1& post_type=product &paged=' . $paged);      ?>      For paginating                 <?php       global $wp_query;            $big = 999999999; // need an unlikely integer            echo paginate_links( array(     'base' => str_replace( $big, '%#%', get_pagenum_link( $big ) ),     'format' => '?paged=%#%',     'current' => max( 1, get_query_var('paged') ),     'total' => $wp_query->max_num_pages,     'prev_next'    => False,              ) );         ?>      I have noticed that for default permalink structure pagination works fine but if i change permalink structure it no longer works.It shows first page result but on next pagination it moves to index.php Why?


WP Template Hierarchy - Need help choosing the correct templates

Please see this image to get a better understanding of what I would like to achieve. ![enter image description here](http://i.stack.imgur.com/DQRho.jpg) Please pay attention to point #3 and #4 (notice the permalink structure).   * The "Homepage" is static (front-page.php).   * The "Resort" page provides an overview Aspen (page-aspen.php).   * The "Property Type" page should list all properties in Aspen.   * The "Property Name" page is a landing page for the property. What template do you recommend I use for point #3 and #4? Thanking in advance!


How to use if statements to check and echo terms by hierarchy in a post?

I'm seeing a lot of posts on here with helpful snippets to resolve my problem, but nothing has been specific enough to help me - or I just don't understand how to make those solutions work for my issue as I'm still pretty new to custom taxonomy. What I have is a custom taxonomy for a custom post type, with two "levels" of terms. So in a template, I'm creating a loop for the custom post type, looking for the terms within each post, and then if the term is a parent, I need to echo out that term and it's children. If the term is not a parent, then I just need to echo out that term alone. I'm using these terms to determine what post content I'm spitting out and the content is organized either as a stand alone topic or a topic with sub-topics. I've looked at these questions here to try and figure this out: How to only list the child terms of a taxonomy and not their parents? Get the Term List - Ordering As well as this forum topic: http://wordpress.org/support/topic/if-current- taxonomy-has-child-andor-parent This seemed useful but since it requires IDs, I feel like it's not dynamic for where the terms can be changed and won't always have the same IDs: http://codex.wordpress.org/Function_Reference/term_is_ancestor_of This is the code I have so far, I feel like either a) I'm going about this wrong and need to re-think how I'm building this or b) I'm almost at the solution, but I just don't have it yet. Here is what I have in a page template:               <?php     $tutGroup = 'tut_group'; //taxonomy          $mainTopicsArgs = array(         'post_type' => 'tut_page',//custom post type         'orderby' => 'menu_order'         );      $mainTopics = get_posts($mainTopicsArgs);           foreach( $mainTopics as $mainTopic ):         $taxArgs = array(             'tax_query' => array(                 array(                     'taxonomy' => $tutGroup,                     'field' => 'slug',                     'terms' => $mainTopic                 )             )         );              $series_query = new WP_Query( $taxArgs );         foreach( $series_query->posts as $post ):                  //this is getting all terms             $allTerms = get_the_terms( $post->ID, $tutGroup );             foreach( $allTerms as $singleTerm ):                     //this gets current term and checks for parent/child                 $thisTerm = get_term_by( 'slug', get_query_var( 'term' ), get_query_var( 'taxonomy' ) ); // get current term                 $parent = get_term($thisTerm->parent, get_query_var($tutGroup) ); // get parent term                 $children = get_term_children($thisTerm->term_id, get_query_var($tutGroup)); // get children                      if( ($parent->term_id!="") && (sizeof($children)==0) ) {                      echo 'This is the child term with one parent and no children';                 }                      if( ($parent->term_id=="") && (sizeof($children)>0) ) {                      echo 'This is the parent term with only one level of children';                 }                      if ( term_is_ancestor_of( 6, 2, $tutGroup ) ) {                     echo 'true'; //this specifically sees if a term is a parent and if the second integer is a child of the first integer                 } else {                     echo 'false';                 }             endforeach;              endforeach;          endforeach;      ?>      Can someone tell me what I'm missing or if I need to re-build this a bit if there is a better way to arrange this? Thanks in advance.


remove_shortcode('gallery') version 3.8.1 vs 3.6.1

I've developed a plugin for my own needs on version 3.8.1. Fully tested. I've copied the files to version 3.6.1 on my hosting machine, and it doesn't work. The first error I got, was that the class I've programmed isn't found. This class was in the plugin php file. I moved the class to the functions.php, but the plugin still didn't work. Tried an number of other things, but no cigar. At this moment, the remove_shortcode works when I add it to the functions.php, but the only effect is that I see "[gallery ...]" instead of my desired output. The output generated by the class is correct, however. The class is called in the header.php and footer.php. So, to me, it seems that the remove_shortcode/add_shortcode isn't called when placed within the plugin.php At this moment, my plugin.php is as follows:               <?php     /**      * @package MyGallery      * @version 0.1      */     /*     Plugin Name: MyGallery     Plugin URI: http://.../plugins/MyGallery/     Description: My gallery     Author: GUI Junkie     Version: 0.1     Author URI: http://     */     remove_shortcode('gallery');     add_shortcode('gallery', 'MyGallery_');          function MyGallery_()     {     return "Hey!";     }      The original function in my plugin is this:               function MyGallery_()     {         $MyGallery = new MyGallery();         if( !$MyGallery->has_gallery )             return;         return '

';     }     ?>


Data Validation, dynamically generated fields (select for example)

Working to secure my plugin, I'm not sure what (if anything) to do about output such as dynamically generated select fields. For example, I have a country code select generated on the backend via PHP which is 200+ options long, but is stored - in its entirety - simply as `$ctry_code_sel`. Of course, I get the sentiment that "Everything is Suspect", and I get using wordpress's native `esc_url` and `esc_attr_e` etc. in response, but it seems that `esc_html_e` et.al. are of no use in cases such as this. When the time comes - on any given page - that I want to output my select field (e.g `echo $ctry_code_sel;`) is there something I can/should be doing there to guard against cross-site-scripting attack etc.?


each user having category with their name and can add sub categories post in that category

I am looking for help or plugin for the following conditions of my site I am using wordpress 3.0+ version. my site is about School where students will get register and post their experience and share knowledge. **User Registration:** Once the user is created automatically a new Category should be created with its Reg. ID and user name which will be displayed as below **mysite.com/jan2345** **User Blog:** each user will be able to create new blog which will be the sub category that user's category for example: jan wants to post his expedition to Europe so he will create new blog from frontend but in backend that will be a category with atleast single post which will be the default post and have default parent category as jan2345. This post url will look like **mysite.com/jan2345/europetour** **user Page** User will log in and be able to see only his Blogs and post for edit. if there is any more suggestions and any way i could do this please reply me **FYI:** i am not able to use Wordpress multisite functionality bec that creates a 9 new tables so, if there are 1000 users with their site details so there will be more than 9000 tables in database .... **If there is any other solution where i can create site and that will not increase my tables in data base** Thank you all in advance Nikhil J.


Displaying Posts Using a Custom Query with a Custom Field and a term_id

I'd like to display a list of posts in a category of a taxonomy using a Custom Field. Here's my code:               if($current_term->term_id=='143') {             $querystr = "  SELECT wposts.*             FROM $wpdb->posts wposts, $wpdb->postmeta wpostmeta, $wpdb->terms wpterms             WHERE wposts.ID = wpostmeta.post_id             AND wpostmeta.meta_key = 'apecard'             AND wpostmeta.meta_value = 'on'                  AND wpterms.term_id  =  '143'             AND wposts.post_status = 'publish'             AND wposts.post_type = 'locali'             ORDER BY wposts.post_date DESC ";      .....      The results display all posts that have meta_key='apecard' in every category of the taxonomy. But I want to display that posts only in the category with term_id=143. Thanks you!!!


How to use permalink query to go to specific tabs in posts

I'm not really sure how to phrase the questions, but hope it's not too confusing. Basically I've create a plugin which inject custom tabs into the posts content when displaying. For now, just assume I'm using DomTab, and I have permalink configured as `/%category%/%postname%/`. Now I would like achieve 2 things with the tabs.   1. Beautify the url by appending the tab name to the url according to the tab highlighted. e.g. If tab "Detail" is clicked/highlighted, the url should change from `http://myhost/catgegory/post1/` to `http://myhost/catgegory/post1/detail/` without requiring to refreshing the page, much like how google did it. The content of all the tabs are preloaded and hidden.   2. When url with the tab name are access directly, say from a bookmark, the tab should be highlighted automatically. e.g. If user access `http://myhost/catgegory/post1/comment/` then the "Comment" tab should highlighted instead of the default tab when displayed. I don't really need a full solution to this, but hints of where to start. As I understand query, but not sure how to access it with permalink enable. Thanks EDIT: Currently accessing `http://myhost/catgegory/post1/comment/` ends up in 404


What is the cleanest way to extract custom variables from a post

At the moment I am doing something like the following from inside the main loop;               $custom_values = get_post_custom_values('tenderfields');     $custom_values = unserialize($custom_values[0]);     $custom_values = $custom_values[0];      Then accessing them with `$custom_values['my-custom-value']` This works fine but feels a little clunky, it feels like something there is probably already an internal call for that I am just missing? I have looked through the docs and couldn't find anything.


How to break down importing of feeds

I am attempting to update a large array of feeds into WordPress, using fetch_feeds. As can be expected, when going over 50 feeds the server is starting to time out. I would still like to update the feeds in bulk but without crashing the server. Can you suggest a method through which I can break things down? Maybe using AJAX? Is that the best technique? Any examples I can look at?


Passing the JQuery string to Worldpress URL

I have already followed the tutorial here: http://www.rlmseo.com/blog/passing- get-query-string-parameters-in-wordpress-url/ But it still doesn't work. In the function.php, my code is                   //decode wordpress url to jquery string         function add_query_vars($aVars) {         $aVars[] = "lastName";          return $aVars;         }              // hook add_query_vars function into query_vars         add_filter('query_vars', 'add_query_vars');              function add_rewrite_rules($aRules) {         $aNewRules = array('^physician-profile/([^/]*)/?' => 'physician-profile?lastName=$matches[1]');         $aRules = $aNewRules + $aRules;         return $aRules;         }         // hook add_rewrite_rules function into rewrite_rules_array         add_filter('rewrite_rules_array', 'add_rewrite_rules');      I would like my link from                   physician-profile?lastName=Rae-Lee       to                   physician-profile/Rae-Lee.      In the pysician-profile page, my code is: but I don't know why I put it here. It seems like just return the value of lastName.                    if(isset($wp_query->query_vars['lastName'])) {          $lastNameS=(urldecode($wp_query->query_vars['lastName']));       In the main page,I linked the physician link as                   physician-profile/Rae-Lee,       but it keep going to the home page.When I tried changed the link as                   physician-profile?lastName=Rae-Lee,       it goes directly that page, but the URL doesn't change. As a wordpress beginner, could you point it out which part I did wrong? Or do I need other codes? Thank you for your help!


SQL Statement - Mass Delete Custom Post Types

This website lists a nice way of deleting posts based on category http://www.tripwiremagazine.com/2010/06/how-to-effectively-bulk-delete-many- posts-in-wordpress.html The relevant code is:               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 =<category id>      where `<category id>` needs to be replaced with the relevant number. I need to modify this code to mass delete custom post types based on their taxonomy. By pressing on the edit button in wordpress admin i can retrieve the following information:               http://www.domain.com/wp-admin/edit-tags.php?action=edit&taxonomy=estate_agents&tag_ID=9098&post_type=os_estate      So i will need to modify the SQL code above to take:               post_type= os_estate     taxonomy= estate_agents     tag_ID= 9098      Any help with this would be much appreciated.


Function to grab specific image IDs from media library.

I want to grab images 161 thru 166 without having to calling my entire media library array and having to splice those up. In time, the more I have in there the more it's going to slow my site down. Here is what I have so far, I use array_reverse to reverse the IDs so the most recent uploads are last and I use array_splice to find the images I need to extract. Is there a more direct way for me to find images with ID 161 thru 166?               function get_images_from_media_library() {                     $args = array(                         'post_type' => 'attachment',                         'post_mime_type' =>'image',                         'post_status' => 'inherit',                         'posts_per_page' => -1,                     );                     $query_images = new WP_Query( $args );                     $images = array();                     foreach ( $query_images->posts as $image) {                         $images[]= $image->guid;                     }                     $images = array_reverse($images);                     $images = array_splice($images, 3,6);                     return $images;                 }                      $img = get_images_from_media_library();                 foreach($img as $image){                     echo "<img src='$image'/>";                 }


How to throw the "We need ftp info" at a user

I recently asked a question about an error I was getting for doing theme updates where the user did not have permission. I would like to write a credential check, much like how wordpress does theirs. essentially when you update WordPress you either have the worlds most insecure set up and it will just update when you click the button or it will do the smart thing and ask you for your ftp credentials. My theme is built on the same concept except I don't know how to ask you for your ftp credentials. Now I know there are wordpress functions that do the update of themes for you, except I check my version number in a custom way, I also get the zip from my hosting and I don't use wordpress theme repo for any of this, so the one quick fix function won't work. So my question is: **How do you write a custom credential check function that basically checks if you need ftp or not.**


Show infos only to the author in the author.php

I need to be able to show some informations only to the author in his profile viewable in the front end, for istance I need to add a text under the avatar that only the author, if logged in, can see. This text will inform them that they can change the avatar anytime by adding it in their profile page... I could also add some more details... Is there a way to achieve this? Thanks!


How is the WordPress.org plugin download history calculated?

I'm interested to know how the download history of plugins is calculated on WordPress.org. I'm noticing that one of my plugins is displaying a small percentage of users using a version which I haven't released yet via WordPress.org. Is it because I have installed it manually on a couple of my sites for testing?


Create custom page and add it in nav menu by code

I am creating a plugin, and this time it should: create a page and add it to the nav menu, all by code ... Here is an example: http://img823.imageshack.us/img823/8531/09072012205520.png


What is the right way to set up a one-page portfolio theme?

I would like to create a simple one-page portfolio theme for my own use. Most of the content will be static. The main reason I want to make it in WordPress at all is to make use of Contact Form 7 and include blog posts from another site of mine. My questions:   * I'll create a page template for the main content. What needs to be in the `index.php` file, considering that I won't actually use it (but WordPress still requires it)?   * What is the right way to pull in blog posts from my other site?


How do you set the default page in WordPress?

Assuming I have a page with the URL `http://papermepress.com?page_id=2` that I want to set as the default, what do I need to do so that when a user types in just `http://papermepress.com` they see that page? Is it a simple configuration option or do I need a plugin of some sort?


hfeed CSS class in Twentyeleven Theme

The twentyeleven theme has hfeed class attached with the main container #page. I could not find any definition of hfeed in style.css. Does it have any purpose or its just a random class name given?