Query multiple taxonomies plugin with ajax, archive loading posts outside filters

I have a custom post type called jobs and within I have several taxonomies: Job type (full-time, part-time, practice, etc), Country, Job Area (design, development, etc). I'm using the plugin from Scribu Query multiple taxonomies. My template is this:               <?php      /*Template Name: Jobs List*/     get_header();      ?>

             <?php dynamic_sidebar('Jobs-1');?> /*The sidebar with the Query Multiple Taxonomies Plugin*/ ?>

                 <?php                     $temp = $wp_query;                     $wp_query= null;                     $wp_query = new WP_Query();                     $wp_query->query('post_type=jobs&posts_per_page=10'.'&paged='.$paged);                     while ($wp_query->have_posts()) : $wp_query->the_post();                      $terms = get_the_terms( $post->ID, 'campo' );                 ?>

                 <?php endwhile; ?>
                     <?php if(function_exists('wp_paginate')) {                         wp_paginate();                     } ?>

      Then the archive template is a regular Wordpress Loop:                    <?php          if (have_posts()):         while (have_posts()) : the_post(); ?>

     <?php endwhile; ?>
             <?php if(function_exists('wp_paginate')) {                 wp_paginate();             } ?>
         <?php else : ?>                      <?php endif; ?>      and this is my js file with the AJAX for the search:               $(document).ready(function() {     $('.taxonomy-drilldown-checkboxes').submit(function() {             // catch the form's submit event             target_el = $('div.target');             target_el.empty().html('');             $('.status').html(' Loading Jobs based on your filters').animate({"height":"30px"}, 800, "easeOutCubic");             $.ajax({ // create an AJAX call...                 data: $(this).serialize(), // get the form data                 type: $(this).attr('method'), // GET or POST                 url:  $(this).attr('action'), // the file to call                 success: function(response) { // on success..                          // update the DIV - uses the "archive" template.                          target_el.html($(response));                                          $('.status').animate({"height":"0px"}, 800, "easeOutCubic");                     $('.job').animate({"opacity":"1","max-height":"100px","padding":"15px 8px"}, 800, "easeOutQuad");                 }             });             return false; // cancel original event to prevent form submitting         });          });      The issues I have are two, if you go to the 2nd page on the default listing and then you filter, nothing will be showed (I think because the url). I solved that partially implementing Infinite Scroll. The second issue is that when you've filtered stuff (the archive-jobs.php template is applied to the .target div) when you scroll down and infinite scroll starts working it will show jobs that are outside the filter terms specified. / _--------------------------UPDATE-------------------------------_ / I just found that if I remove the dash from taxonomy slug (I had one dev-it) I don't have the issue of getting posts from other taxonomies. The issue I'm facing now is that when infinite scroll activates when scrolling (once you applied a filter) the posts after pagination are not being showed.


Custom post types - Use post_id in permalink structure

I'm registering my CPT like so:               $args = array(         'labels' => $labels,         'public' => true,         'hierarchical' => false,         'rewrite' => array(             'with_front' => false,             'slug' => 'news/events'         ),         'supports' => array( 'title', 'editor', 'thumbnail' )     );     register_post_type('events',$args);      Now that will generate post permalinks like so: `/news/events/{post_name}/` but I want the following permalink structure: `/news/events/{post_id}/{post_name}/`. How do I do this?


PHP Fatal error when using plugin_basename

I am in the process of writing my first plugin and my call to the `plugin_basename(__FILE__)` function results in a: PHP Fatal error: Call to undefined function plugin_basename() My plugin resides in a directory of its own under the standard wp- content/plugins/. I am also using wordpress 3.3.1 and have looked at the codex but cannot see anything wrong. The code block where it fails is shown below:               <?php     /*     Plugin Name: Send Invitation     Plugin URI: http://w3boutique.net     Description: Emails a the link of the current page to a friend     Author: Nandakumar Chandrasekhar     Version: 0.1wp-includes/plugin.php     Author URI: http://w3boutique.net/about-nanda.html     License: GPL2     */          define( 'SEND_INVITATION_VERSION', '0.1' );          define( 'SEND_INVITATION_REQUIRED_WP_VERSION', '3.3.1' );          // Check if following are required          if ( ! defined( 'SEND_INVITATION_PLUGIN_BASENAME' ) ) {         define( 'SEND_INVITATION_PLUGIN_BASENAME', plugin_basename(__FILE__) );      }          if ( ! defined( 'SEND_INVITATION_PLUGIN_NAME' ) ) {         define( 'SEND_INVITATION_PLUGIN_NAME', trim( dirname(     SEND_INVITATION_PLUGIN_BASENAME ), '/' ) );     }          if ( ! defined( 'SEND_INVITATION_PLUGIN_DIR' ) ) {         define( 'SEND_INVITATION_PLUGIN_DIR', WP_PLUGIN_DIR . '/' . SEND_INVITATION_PLUGIN_NAME );     }          if ( ! defined( 'SEND_INVITATION_PLUGIN_URL' ) ) {     define( 'SEND_INVITATION_PLUGIN_URL', WP_PLUGIN_URL . '/' . SEND_INVITATION_PLUGIN_NAME );     }          // Version check     global $wp_version;          // Message to send if version is below the required version     $exit_msg = 'Send Invitation requires WordPress or newer' .   SEND_INVITATION_REQUIRED_WP_VERSION . ' Please update!';          if ( version_compare( $wp_version, SEND_INVITATION_REQUIRED_WP_VERSION, "<" ) ) {         exit( $exit_msg );     }          function add_send_invitation_link() {         wp_enqueue_script('jquery');         wp_enqueue_script( 'show_form.js', SEND_INVITATION_PLUGIN_URL . '/js/show_form.js' );         wp_enqueue_style( 'send-invitation.css', SEND_INVITATION_PLUGIN_URL . '/css/send-invitation.css' );              # TODO Put this in another file and include it         $invitation_form = '
Send Invitation
         <form id="invitation-form" method="post" action="javascript:void(0);">
                 Your Email Address
                 <input type="text" name="email" />

                 ' . "Friend's Email Address" . '
                 <input type="text" name="email" />

                 Subject
                 <input type="text" name="subject" />

                 Message
                 <textarea rows="10" cols="20"></textarea>

<input type="submit" name="submit" value="Send" />
          </form>          ';             return $invitation_form;     }          function send_email() {          error_log("Inside send email", 0);          $subject = 'test';          $message = 'this is a test from send invitation';          $to = 'navanitachora@gmail.com';          wp_mail($to, $subject, $message);     }          ?>      I would appreciate any pointers you may have to what I might be doing wrong here. Thanks in advance.


Stripping and/or altering the content of a custom field (video URL)

I’m making a theme where some posts have an associated video, from either Vimeo or YouTube. At the moment, users can add this to a post by adding a video ID into one of two custom fields, called (surprisingly enough), 'YouTube' and 'Vimeo'. My theme then takes this info and adds it to the standard embed code for these sites, and outputs it on the post page. However, I’d like to make things easier for the users of the site, if possible. I’d like to replace these two fields with a single custom field, and also allow them to enter the full URL of the video on Vimeo or YouTube (instead of the ID). I presume that this would require two things: firstly, that the URL is recognised as coming from either Vimeo or YouTube, and secondly, that the rest of the URL is stripped, so that I can use the ID to output the embedded video nice and clean on post pages. I know that there are plenty of plugins that do this kind of thing (and other similar things) automatically, but I’d prefer to have this built-in, if at all possible. I’m not a PHP wizard so I haven’t ventured into doing anything about it yet, but I’m hoping that this could be made to happen via some functions.php magic. Anyone have any ideas about the best way to proceed? Thanks.


Category as Class for Custom Post Type

I've only just realised that custom post types don't appear to output the category as a class in the loop, via `post_class` and I wonder if anyone can suggest a work around. Is this something that should be declared when I establish my post type or is this an extension of `post_class`? For example, on a post of type `post` the class outputs something like: `class="post-50434 post type-post status-publish format-standard hentry category-my-lovely-category tag-some-ace-tag"` but for my custom post type the category doesn't appear. -- EDIT -- Here's a bit of my code which might help to clarify what I'm trying to do - firstly though, I'm not actually trying to get the class onto the body but onto the article in my loop:               <?php $cat = get_the_category();     $parentCatName = get_cat_name($cat[0]->parent); ?>          <article id="post-<?php the_ID(); ?>" <?php post_class(); ?> data-category="<?php echo $parentCatName; ?>" data-title="<?php the_title(); ?>">     [...]     </article>      The trouble that I'm having is retrieving the custom post type category info in the same way as I can for the default post type. -- EDIT -- Sorry, perhaps a little background to what I'm trying to achieve will help - I'll try to keep it brief:   * I'm using Isotope masonry layout   * I wish to filter results by a 'data-category' attribute added to each post during the loop   * My categories for several post types (post, product, course) are grouped under common parent categories   * In my loop I therefor want to populate that 'data-category' field with the parent category My problem arises as I can only get the category, and in turn the parent category, for the default custom post type, using get_the_category. I hope this is making sense.


frontend user with custom profile pages

i am building a website where the frontend users can register and they need to have custom profile pages - not the standard WordPress backend pages that the admin sees. There they can see their profile (image, name, email, ...) and change it, as well as some site specific pages like: statistics, severals lists, ... . is there a plugin for this? or if not could you please point me to some documentation or other links that might help? Thanks.


Clean URL permalink for custom post type

I have a custom content type of `photo_group` which is a collection of photos. I want to be able to go to `mysite.com/photos` and have that page dump out all of my photo groups. How can I do this without making a "page" and setting the template? Or is that the approach I'll have to take? Thanks


What content types are shown at a search page?

I have created several custom content types. My question: What about showing things of different content types in search.php? Are different post types shown in search.php? if not how to make them shown? How should I configure the search code in order to show these content types which I want to show?


Custom sortable columns ordered by meta-value?

I have no idea why my sortable function does not sort my "events" my a custom post-meta. I have a custom-post-type named `wr_event`… I have my custom columns set up and my post-meta is shown in the columns, just like I want. The "Event-Date" handle even is already a sortable link! Only thing if I click on the sort-link for the event date the list doesn't update. The function is fired as I see the page reloading however it doesn't sort anyhing. Even though the url toggles between those two states if I click the sort-link … `http://url/wp- admin/edit.php?post_type=wr_event&orderby=event_date&order=desc` `http://url/wp-admin/edit.php?post_type=wr_event&orderby=event_date&order=asc` However the list always looks the same! Here is my entire code for the custom columns:               add_filter("manage_edit-wr_event_columns", "wr_event_edit_columns");          function wr_event_edit_columns($columns) {         $columns = array(             "cb" => "<input type=\"checkbox\" />",             "title" => "Event",             "event_date" => "Event Date",             "type" => "Type",         );              return $columns;     }          add_action("manage_posts_custom_column",  "event_custom_columns");          function event_custom_columns($column) {         global $post;              switch ($column) {             case "event_date":             $custom = get_post_custom();             echo $custom['_wr_event_date'][0];             break;             case "type":             echo get_the_term_list($post->ID, 'event_type', '', ', ','');             break;         }     }          add_filter("manage_edit-wr_event_sortable_columns", "wr_event_sortable_columns");             function wr_event_sortable_columns( $columns ) {         $columns['event_date'] = 'event_date';         return $columns;     }          add_filter("request", "event_column_orderby");          function event_column_orderby( $vars ) {         if ( isset( $vars['orderby'] ) && 'event_date' == $vars['event_date'] ) {             $vars = array_merge( $vars,                 array(                     'meta_key'  => '_wr_event_date',                     'orderby'   => 'meta_value_num',                     'order'     => 'asc'                 )             );         }              return $vars;     }


Is it possible to create a shortcode that will query a post based on taxonomies?

I am working on a site that will be listing a few hundred products and we wanted to be able to quickly/easily show specific products on a page based on taxonomies. I have been doing some research and thought I was on the right track. First, I found this article on digwp.com which I thought was going to work great. I can not get it to pull the posts based on taxonomy though - just post_type. The Post Type is "Used Items" and I created a taxonomy named Color where one of the slugs was Red.               [loop the_query="post_type=used-items&color=red&ord=ASC"]      I also found this plugin for doing a query by shortcode, but same situation with it not pulling by taxonomy. **My question** Does anyone know what I can do to pull posts based on post type/taxonomies (would be using multiple each query) directly from a WordPress page. We want to be able to quickly query products without having to program the query into a page template for each possible option.


How can I allow the Editor Role to change Theme Settings?

I've just setup a new Blog for a friend and thought it's better to not give him Administrator Access right away as a pre-caution. I created a new user as Editor therefore. But then I saw that this user can not change the Theme Settings like Background and Header. Is there an easy way to allow the Editor Role to edit any theme settings in Twenty Ten or a Child or it? He should basically be able to do anything an Adminsitor can do reg. the Theme, probably even changing themes.


Paginated Archives or Loop by Month

I'm trying to figure out a way to do a loop / archive page with posts organized by month. So where each page displays post from 1 month. Then the previous and next links would be labeled February 2011 and April 2011, for example. I'm thinking it would possibly use the date.php file, but I feel like I may run into problems when paginating from one year to the next... Anyone have any ideas, or documentation on where to look further? Thanks!


Hirerarchical side bar menu

i am new to wordpress and i have to show the my menus in side bar in hierarchial way like               Home page         --menu1         -------menu1-submenu1         -------menu1-submenu2         --menu2         -------menu2-submenu1         -------menu2-submenu2      and they should be collapsible in starting and when i click on main menu of it will show me the sub menus . my test enviorment URL is http://178.236.226.168/reseller-hosting/ and the html who's copy i have to do in my menu is http://servercentre.net/small-and-medium-business/email-and-apps/hosted- exchange-2010.html any plugin who fullfill my requirement really very much help full to me. and i already tried some plugin's like collapsing-pages.0.6.1.zip,gd-pages- navigator.zip,flexi-pages-widget.zip but none of them giving me that effect. thanks


show posts under subcategory only when in that subcategory

I have a list of subcategories in a sidebar (children of top level category) and I also get a list of posts underneath each category. I only want to show those posts when we are under that subcategory or when we are viewing one of the posts. Each post comes under top level category and subcategory and I don't know how to get current subcategory id/name. I understand you get a category ID like this: $category = get_the_category(); $catID = $category[0]->cat_ID; but what about when a post belongs to subcategory and category and I just need a subcategory id I believe? Current code:               <?php  $cats = get_categories('child_of=6');      $this_category = get_category($cat);          //echo $parent_category;        foreach ($cats as $cat) :         $args = array(         'category__in' => array($cat->term_id)          );         $my_query = new WP_Query($args);              if ($my_query->have_posts()) : ?>
<a href="<?php echo get_category_link($cat); ?>"><?php echo $cat->name; ?>                       <?php if ($this_category->category_parent != 0) { ?>
              <?php while ($my_query->have_posts()) : $my_query->the_post(); ?>                  <?php /*general loop output; for instance: */ ?>
- <a href="<?php the_permalink() ?>"><?php the_title(); ?>
                  <?php endwhile; ?>
             <?php } ?>
                  <?php else :              echo 'No Posts for '.$cat->name;                             endif;


is_page() or is_single not working

Im trying to clean up my scripts and I'm using a function to but ran into a problem with using both !is_page or !is_single to only show certain scripts on singles and pages. What did I do wrong here.               add_action( 'wp_print_scripts', 'my_deregister_javascript', 100 );     function my_deregister_javascript() {     if ( !is_page() ) {     wp_deregister_script( 'thickbox' );     wp_deregister_script( 'shutter' );     wp_deregister_script( 'swfobject' );     wp_deregister_script( 'ngg-slideshow' );     wp_deregister_script( 'ngg_script' );     wp_deregister_script( 'jquery-shuffle' );       }     elseif ( !is_single() || !is_page()) {     wp_deregister_script( 'autosize_js' );     wp_deregister_script( 'admin_js' );      }     }


What is the best Captcha plugin for registration?

I'm suffering from the issue of lots of fake registrations for my site.   I'd like to add a captcha for registrations. What is the best plugin that will require a captcha at registration? Recommendations based on real installs are most appriciated! Also: I'm using the most up-to-date install of WP.


Bulk edit custom excerpt text in WordPress

Is there a way to bulk edit the custom excerpt text without going to each post and open it? When we have 300 posts it can be a very time consuming process.


Rename files during upload using variables

I'd like to rename files during upload and set their names to the post slug the files are being attached to, plus some random characters (a simple incremental counter will de just fine) to make the filenames different. In other words, if I'm uploading/attaching images to the post whose page slug is "test-page-slug", I'd like for the images to be renamed on the fly to `test-page-slug-[C].[extension]`:   * test-page-slug-1.jpg   * test-page-slug-2.jpg    * etc, it doesn't matter what the original filenames were. There's this plugin, Custom Upload Dir: > With this plugin you can construct paths from additional variables like: > post title, ID, category, post author, post date and much more. How can I do the same to filenames?


Wordpress network vs Separate installs

I am contemplating hosting all my client sites on one wordpress network. So far I've been installing a new wordpress installation for every site. Is it a good idea (compared to standalone installation) to have all sites hosted in one network in terms of scalability?


How to put a Custom Folder under one sub-site of Multisite WP?

I have a multisite wordpress and i'm now trying to have a custom directory under 1 of the sites of the multisite. Example:               http://apple.example.com     http://banana.example.com/myfolder     http://candy.example.com      That means `/myfolder` should not be available under `apple` and `candy` but just under `banana` site. But it is totally **non-wordpress** related folder and will be totally different web folder, having another html contents. Can assume as **a small html website**.   * How to allow my custom uploaded folder `/myfolder` to be available **only under** the one specific sub-site (under multisite)? Thanks!


How to force content refresh of a page that has been loaded previously by the user?

How can any page on the site be forced to refresh or load content by ignoring anything in cache, everytime a visitor visits the page for the second time? The website uses twentyeleven & w3tc (browser caching disabled at the moment).


How can I display my featured image correctly inside my single posts?

Here is what I have tried: 1) Added `add_theme_support('post-thumbnails');` in functions.php. 2) Added `<?php the_post_thumbnail(); ?>` inside single.php which looks like this:               <?php     /**      * The Template for displaying all single posts.      *      * @package WordPress      * @subpackage Twenty_Eleven      * @since Twenty Eleven 1.0      */          get_header(); ?>

                              <?php the_post_thumbnail(); ?>                     <?php while ( have_posts() ) : the_post();  ?>                         <?php get_template_part( 'content-single', get_post_format()  ); ?>                          <?php endwhile; // end of the loop. ?>

          <?php get_footer(); ?>      My featured image is added but above the article and not inside the article, how it should be. To get a better understanding, here's a picture of the issue I'm having:![enter image description here](http://i.stack.imgur.com/y8IsZ.png) How can I make that featured image appear below the "Test post" article? Like here for example: Thank you in advance!


Endless loop with wp_insert_post and wp_update_post

I have an array `$unqiues` which contains URL's, I loop over the array with the code below to get the URL titles, insert a new post, update the post meta. Then I change the the posts title and name to the $pid which was returned by wp_insert_post. This created an endless loop, I have about 600 or fewer URL's in the $unique array. I just hit 75,000 queries within an hour on my host and have to wait an hour for the limit to reset. What caused the endless loop? This code worked when I tested with 10 URL's in the array. How can this be written more efficiently? Thanks               foreach($uniques as $unique){           $pagetitle = getTitle($unique);           $new_post = array(                 'post_title' => $unique,                 'post_status'   => 'publish',                 'post_type' => 'websites'             );             $pid = wp_insert_post($new_post);                  update_post_meta($pid,'title', $pagetitle);             update_post_meta($pid,'url',$unique);                         $my_post = array(                   'ID'           => $pid,                   'post_title' => $pid,                   'post_name' => $pid               );                    wp_update_post( $my_post );     }


how do i make the "contact us" on a page created not to display

when creating pages, the title normally show as a link and as a title on the page it displayed when click on. My question is how do i remove the title from displaying on my page. for example when a page like "contact us" is created, the page itself will have "contact us" display in either h1 or h2 tag. how do i make the "contact us" on the page not to display.


Using the_excerpt() some posts are truncated and some are not

I have a template that pulls three posts query_posts() loop. Two of the posts and are truncated to 10 words like I have it set in a filter. The third decided to ignore the filter and is spitting out 33 words. I can't see a difference between the posts. Does anybody know why this would happen?               while (have_posts()) : the_post();       $img = get_post_meta($post->ID, 'Featured Thumbnail', true);                         ?>       <div style="width:237px; float:left; margin-right:20px;" <?php post_class(); ?> id="post-<?php the_ID(); ?>">
         <img style="margin-bottom:10px;" src="<?php echo $img; ?>"/>

           <a href="<?php the_permalink(); ?>" title="<?php the_title(); ?>"><?php the_title('
', '
'); ?>
           <?php the_excerpt(); ?>

       <?php endwhile; ?>


Is there a wordpress function that I can use to retrieve the current page that is loaded?

Suppose that I create a page in the admin section (under 'Pages') and I have permalinks turned on and this pages slug is 'my-new-page', then is there a WordPress function that will work outside the (blog) Loop that I can use in that page's template on my theme that will retrieve that page's permalink?


Problems with jQuery and is_admin()

I've created a plugin.   In this plugin I have a function that will display some data.   In this function I use `is_admin()` to determine if the function is being called from the backend, because then I can add some additional information. In an admin page, the function is loaded normaly. After an update using jQuery, the function is called to display new data. The problem is that when the function is called through jQuery, the `is_admin()` is **false** , even if I am backend in admin mode. Why isn't `is_admin` working whne called through jQuery? **Update** The code for `is_admin()` is called when I click the save button for a new event (or updating existing event). After clicking save / update, the calendar list is updated through jQuery. Here are parts of the plugin code.               // create custom plugin settings menu     if ( function_exists('add_action') ) {       add_shortcode('eventcal', 'shortcode_display_event');     }          function shortcode_display_event($attr) {       include_once('eventcal.class.php');       $ec = new EventCalendar();              extract(shortcode_atts(array(             'type' => 'simple',             'parent_id' => '',             'category' => '',             'count' => '10',             'link' => ''         ), $attr));            $data['events'] = $ec->getMultipleEvents($cal_type, $count, $parent_id, $category);       $data['link'] = $link;       $data['type'] = $type;          $ec->displayCalendarList($data);      }      This is the bit that is added if I'm in admin mode:               function extendedList( $data ) {       (...)       if(is_admin())          $eventList .= '	';       $eventList .= '

';       (...)     }      And here is the code for updating calendar list after update.               // New event - Form Submit     jQuery('#formNewEvent').live('submit' ,function() {              var formData = jQuery('#formNewEvent').serializeArray();              //Event ID is only given a value when an event has been clicked.         if(jQuery('#event_id').val() != '')         {                // UPDATE EVENT           jQuery.post("/wp-content/plugins/wp-eventcal/eventcal_jquery.php", { instance: 'updateEvent', formData : formData, eventID : jQuery('#event_id').val() },           function(data) {             if(data.status == 'success') {               // Here we update calendar list after data has been updated               jQuery.post("/wp-content/plugins/wp-eventcal/eventcal_jquery.php", { instance: 'getEventList' },               function(list) {                 jQuery('#eventListContainer').html(list);                                 });             }                 }, "json");         }         else {           // ADD NEW EVENT           jQuery.post("/wp-content/plugins/wp-eventcal/eventcal_jquery.php", { instance: 'addNewEvent', formData : formData },           function(data) {             // Here we update calendar list after new event have been added                      if(data.status) {               jQuery.post("/wp-content/plugins/wp-eventcal/eventcal_jquery.php", { instance: 'getEventList' },               function(list) {                 jQuery('#eventListContainer').html(list);                        });             }            }, "json");                 }       return false;     });


Problem in getting user comments permalinks

i am trying to display comments by specific users at a custom area. i am successful to do that, but the problem is the permalink structure . this code gets the url as permalinks disabled, if i enable the permalinks from my settings , then these urls starts giving a 404. here is the code im using :               <?     if(get_query_var('author_name')) :     $curauth = get_userdatabylogin(get_query_var('author_name'));     else :     $curauth = get_userdata(get_query_var('author'));     endif;     $querystr = "         SELECT comment_ID, comment_post_ID, post_title, comment_content         FROM $wpdb->comments, $wpdb->posts         WHERE user_id = $uid         AND comment_post_id = ID         AND comment_approved = 1         ORDER BY comment_ID DESC LIMIT 5      ";      $comments_array = $wpdb->get_results($querystr, OBJECT);     if ($comments_array): ?>
     <? foreach ($comments_array as $comment):         setup_postdata($comment);         echo "
comment_ID."'>Comment on ". $comment->post_title. "
". $comment->comment_content . "
";     endforeach; ?>
     <? endif; ?>      So this gets the url as www.mysite.com/p?=xxxx .. if permalinks are enabled as mysite.com/post-perma-links/ it starts giving 404 on these links generated via the above code. rest of the function is workign fine, SO possible to get the permalink url in this case instead of the p?=xxx ? help is appreciated cheers


Version 3.04 or 3.5?

I am a first time user and about to build a website with wordpress and depending on guides for version 3.0. Should I install version 3.04 or 3.5?


Creating a page for custom taxonomy archive

I have a custom taxonomy called 'news'. Inside it I have two categories called 'news-releases' and 'competition-news'. Going to 'mydomain.com/news/competition-news' gives the expected result and displays all of the news for that category. On the page 'mydomain.com/news' I'd like to list items from both categories but at the minute I get a 404 error, I think that WordPress is probably looking for a page called news. Is the only way to get around this to create a static page called 'news' with a custom template? Doing it this way seems a little messy and I already have a template file called taxonomy-news.php that displays the news the way I want it that I'd rather not duplicate it if possible. Even a plugin that would create this page automatically would be better than nothing.


Error "Trying to get property of non-object" with Custom Walker for wp_nav_menu

I am trying to add some ARIA related stuff to the wp_nav_menu function. I use a custom walker class for this purpose:               class Walker_Nav_Menu_With_Aria extends Walker_Nav_Menu {             function start_lvl( &$output, $depth = 0, $args = array() ) {                     $indent = str_repeat("\t", $depth);                     $output .= "\n$indent
\n";             }                  function end_lvl( &$output, $depth = 0, $args = array() ) {                     $indent = str_repeat("\t", $depth);                     $output .= "$indent
\n";             }                  function start_el( &$output, $item, $depth = 0, $args = array(), $id = 0 ) {                     $indent = ( $depth ) ? str_repeat( "\t", $depth ) : '';                          $class_names = $value = '';                          $classes = empty( $item->classes ) ? array() : (array) $item->classes;                     $classes[] = 'menu-item-' . $item->ID;                          $class_names = join( ' ', apply_filters( 'nav_menu_css_class', array_filter( $classes ), $item, $args ) );                     $class_names = $class_names ? ' class="' . esc_attr( $class_names ) . '"' : '';                          $id = apply_filters( 'nav_menu_item_id', 'menu-item-'. $item->ID, $item, $args );                     $id = $id ? ' id="' . esc_attr( $id ) . '"' : '';                          // Add attributes for
                     $li_attributes  = ' role="treeitem"';                     $li_attributes .= ' aria-expanded="false"';                          $output .= $indent . '
';                          $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        ) .'"' : '';                          // Add attributes for                      $attributes .= $depth == 0 ? ' tabindex="0"' : ' tabindex="-1"';                          $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_output .= $args->after;                          $output .= apply_filters( 'walker_nav_menu_start_el', $item_output, $item, $depth, $args );             }                  function end_el( &$output, $item, $depth = 0, $args = array() ) {                     $output .= "
\n";             }     }      I just copy-pasted the original Walker_Nav_Menu class and added stuff, but I am getting errors because the $args variable treated like an object is really an array. But the really weird thing is that this error persists, even if I pass in the original walker like this:               wp_nav_menu( array(         'theme_location' => 'main-nav',         'walker'         => new Walker_Nav_Menu,     ) );      These are the error messages I get:               NOTICE: TRYING TO GET PROPERTY OF NON-OBJECT IN /USERS/RUDOLF/SITES/LOCALHOST/WP/WP-INCLUDES/NAV-MENU-TEMPLATE.PHP ON LINE 88     NOTICE: TRYING TO GET PROPERTY OF NON-OBJECT IN /USERS/RUDOLF/SITES/LOCALHOST/WP/WP-INCLUDES/NAV-MENU-TEMPLATE.PHP ON LINE 90     NOTICE: TRYING TO GET PROPERTY OF NON-OBJECT IN /USERS/RUDOLF/SITES/LOCALHOST/WP/WP-INCLUDES/NAV-MENU-TEMPLATE.PHP ON LINE 90     NOTICE: TRYING TO GET PROPERTY OF NON-OBJECT IN /USERS/RUDOLF/SITES/LOCALHOST/WP/WP-INCLUDES/NAV-MENU-TEMPLATE.PHP ON LINE 92      The lines look like this (In the original file!):               (88) $item_output = $args->before;     (89) $item_output .= '';     (90) $item_output .= $args->link_before . apply_filters( 'the_title', $item->title, $item->ID ) . $args->link_after;     (91) $item_output .= '';     (92) $item_output .= $args->after;


My Custom Widget does not save in sidebar

I created a custom widget, but it's not saving if I click on save. When I refresh the page it is not saved. My code looks like follows                    <?php      /**  * Plugin Name: Sending a          Contact SMS  * Plugin URI:          http://www.test.co.za  * Description:          Allows you to send a contact SMS to          website owner  * Author: test  *          Version: 1.0  * Author URI:          http://test.co.za          */               class sendSMS extends WP_Widget {                   function sendSMS() {                    $widget_ops = array(                        'classname' => 'sendSMS',                        'description' => 'Allows you to add a small contact form that will send out an sms to the user.',                    );                    $control_ops = array( 'id_base' => 'smsForm-widget' );                    $this->WP_Widget( 'smsForm-widget', 'Send SMS', $widget_ops, $control_ops);  }                   function form ($instance) {                  $defaults = array('title'=> __('Example', 'example'), 'name' =>  __('John Doe', 'example'), 'number' => __('+27825656994', 'example'), 'message' =>  __('Tell Us', 'example') );                  $instance = wp_parse_args( (array) $instance, $defaults );                  ?>
                             <label for="<?php echo $this->get_field_id( 'title' ); ?>"><?php _e('Title:', 'hybrid'); ?>                             <input id="<?php echo $this->get_field_id( 'title' ); ?>" name="<?php echo $this->get_field_name( 'title' ); ?>" value="<?php echo $instance['title']; ?>" />

                             <label for="<?php echo $this->get_field_id( 'name' ); ?>"><?php _e('Your Name:', 'name'); ?>                             <input id="<?php echo $this->get_field_id( 'name' ); ?>" name="<?php echo $this->get_field_name( 'name' ); ?>" value="<?php echo $instance['name']; ?>" />

                             <label for="<?php echo $this->get_field_id( 'number' ); ?>"><?php _e('Your Cellphone Number:', 'number'); ?>                             <input id="<?php echo $this->get_field_id( 'number' ); ?>" name="<?php echo $this->get_field_name( 'number' ); ?>" value="<?php echo $instance['number']; ?>"  />

                             <label for="<?php echo $this->get_field_id( 'message' ); ?>"><?php _e('Your Message:', 'message'); ?>                             <textarea id="<?php echo $this->get_field_id( 'message' ); ?>" name="<?php echo $this->get_field_name( 'message' ); ?>"><?php echo $instance['message']; ?></textarea>
                            <?php                   }                   function update ($new_instance, $old_instance) {                 $instance = $old_instance;                      /* Strip tags (if needed) and update the widget settings. */                 $instance['title'] = strip_tags( $new_instance['title'] );                 $instance['name'] = strip_tags( $new_instance['name'] );                 $instance['number'] = $new_instance['number'];                 $instance['message'] = $new_instance['message'];                      return $instance;                   }                   function widget ($args,$instance) {                 extract( $args );                      /* Our variables from the widget settings. */                 $title = apply_filters('widget_title', $instance['title'] );                 $name = $instance['name'];                 $number = $instance['number'];                 $message = $instance['message'];                      /* Before widget (defined by themes). */                 echo $before_widget;                      /* Display the widget title if one was input (before and after defined by themes). */                 if ( $title )                         echo $before_title . $title . $after_title;                      /* Display name from widget settings if one was input. */                 if ( $name )                         printf( '
' . __('Hello. My name is %1$s.', 'example') . '
', $name );                      if ( $number )                         printf( '
' . __('Hello. My number is %1$s.', 'example') . '
', $name );                      if ( $message )                         printf( '
' . __('Hello. My message is %1$s.', 'example') . '
', $message );                      /* After widget (defined by themes). */                 echo $after_widget;  }                  }                  function load_sms_form() {  register_widget( 'sendSMS' ); }                  add_action('widgets_init', 'load_sms_form');                   // register the widget                  ?>


Is it possible to add a child post into the parent page? Basically I have a 1 parent page and it has 2 child page that has a simple content , and I want the child page content to put also in the parent page ,BUT making it an as a excerpt, not output all content (just a teaser). Havent clue yet how to pull that.. any help will do


Is it possible to have controls side by side on the Theme Customizer?

The theme customizer presents all the controls one after other in a vertical order. Is it possible to have them side by side? From:               --------------------     |    control 1     |     --------------------     --------------------     |    control 2     |     --------------------      To:               -------------------    ------------------     |    control 1    |   |    control 2   |     -------------------    ------------------


how to move a wordpress blog to my static site

I am sorry in advance for the noob question. I am just looking for direction. I have read the codex and scoured this site for help and cannot find anything useful. Here's the situation. My client has an old wordpress site. I am building her a new HTML5 site but want to carry her old blog posts and comment structure over. So right now I have www.testsite.com which is her wordpress site and the only part I want to take is /blog. I have my new site under testsite.com/new and the new wp installation under testsite.com/new/blog If this makes sense to anyone can you think of the best way to do this? Thanks!


Most efficient use of custom taxonomies, categories, and pages

I've been researching the difference of taxonomies vs. categories vs. custom post types vs. etc. and have been beginning to pickup on the differences. However I still can't wrap my head around when it is the best time to use these elements for my current site. _Background:_ I am creating a travel-review website where people can review different places around the world. Restaurants, tours, sight seeing, or whatever else people like, can be reviewed.Since there are a ton of places around the world, this site will have a ton of content which makes good permalink structure very important. So far I have only used categories to display my content. I'm shooting for a permalink structure like this:               site.com/destinations/continent/country/city/       Continent is a subcategory of destinations, country is a subcategory of continent, and city is a subcategory of country. As of now I'm having trouble **forming a permalink structure with subcategories** since some posts will have extra categories beside the 1 (either cont,country,or city) like restaurants, travel-logs, etc. Am I doing this right? Should I be using all categories and sub categories or is there a better approach? If this is the right way, how do I get a permalink structure like the one above?               /%category%/%postname%      is not working for me and only displays the parent category. Thanks in advance.


Howto control custum taxonomy order?

I have a site with custom taxonomy. I want to give the client the ability to control the taxonomy order. How can I do that ?


"Medium" size image displayed instead of "thumbnail" in only one post, other posts are fine

Please take a look at this cicada photo - http://photo.aseev.com/stock- photo/cicada-exuviae/ - below you will see 5 thumbnails, all of them are squared, except one (a bug on white background). It is rectangular and it is actually the "medium" size (unlike 4 other thumbnails, which have correct paths to the "thumbnail" size image). Removing the post and the image from media gallery and recreating the post doesn't help. The thumbnail image for this file exists in the right directory and it is squared (*-150x150.jpg). In mySQL sizes are defined correctly for the thumbnail, from what I understood. In media library, each photo has a thumbnail in front of its title, all of them squared except the one I have the problem with. I upload images programmatically with wp_handle_upload, so maybe there was a mySQL input error. Don't know where else to look. Anyone else experienced this? Is there a way I can fix it manually in the mySQL db?


wp_query order by title

I have post titles which begin with a price, eg: $199,900 - 123 Street. I am using the code below, and I'm unable to get the order by title ascending to work properly. Any suggestions please.               <?php     $paged = (get_query_var('paged')) ? get_query_var('paged') : 1;     $args = array(      'cat' =>21,      'posts_per_page' => 999999,      'paged' => $paged,      'orderby' => 'title',      'order' => 'ASC',      );     $the_query = new WP_Query($args);     ?>
          <?php if ($the_query->have_posts()) : ?>          <?php while ($the_query->have_posts()): $the_query->the_post(); ?>             <div <?php post_class() ?> id="post-<?php the_ID(); ?>">
                     <?php                     if (in_category('6')) {                     the_title();                     } else {                     ?>                          <a href="<?php the_permalink() ?>" rel="bookmark"><?php the_title(); ?>                     <?php                     }                     ?>

<?php the_post_thumbnail('thumbnail'); ?>

<?php the_excerpt(); ?>
                          <?php                     if (in_category('6')) {                     ?>
                     <?php                     } else {                     ?>      <a href="<?php the_permalink() ?>" rel="bookmark"> View Details
                     <?php                     }                     ?>
              <?php endwhile; wp_reset_postdata();?>          <?php else : ?>
Not Found

Sorry, but you are looking for something that isn't here.
         <?php get_search_form(); ?>          <?php endif; ?>


Broken Images After DB Name Change

I have a problem I have been unsuccessful in troubleshooting or finding other questions and answers for. My site was displaying fine. I changed the name of my database from "mydomain_beta" to "mydomain_live" and suddenly the image links were broken. I changed the name back to "mydomain_beta" and the links remain broken. This began days days ago and persists. I've checked that I didn't somehow change my file directory affecting the path to the images, I've cleared my browser cache, I've updated my permalinks, I've called my host for support and they can't tell what is wrong. I have no idea how to fix what should be a simple fix. Does anyone have any guesses?


Plugin Hooks Not Shown in WP Cron Jobs

I have installed a WordPress backup plug-in. This plug-in has several hooks. Some of those hooks should activate right after I trigger the backup tasks. But the problem is, after I start that plugin backup tasks, its related hooks are not shown on the WordPress Cron. As a result of that, it's not working as we expect. Why are those hooks not registering in WordPress Cron? Are the issues on my side or the plugin side?


Are self-hosted videos a good idea?

I was wondering if I should use a service like Vimeo or instead choose to host my video on my server ? I built a family website: it's password-protected, not indexed by search engines, etc. It would be nice to have videos there too but I can't decide which way to go. Self-hosted videos   * Respect privacy   * I have plenty of space on my server (65GB)   * But I am concerned about bandwidth (they say it's unlimited but...)   * and about usability and ease of access for my family (they're not techies). They can't really use FTP and compress a video.   * Not sure there is a really good plugin for it Vimeo   * Easy to add videos and get the embed code   * We can set a password for videos   * But I don't want to go Pro   * And you can't get HD quality with embedded videos.  As I said, plenty of disk space, supposedly unlimited bandwidth but non-techie family. I guess we'll want to display videos from few seconds to 5 minutes max. But those videos may be in HD. Which way should I go ? Any plugin recommendation. Thanks guys.


Where to add css file that I want my forms to use?

Where and how should I add the css file that I want my forms to use? Thank you!


Remove "align" attribute on images

I'm trying to get rid of the non W3C compliant "align" attribute generated with any images. For that, I'm using the simple_html_dom library. Here's the code i'm using :               add_filter( 'post_thumbnail_html', 'clean_image_attributes', 10 );     add_filter( 'image_send_to_editor', 'clean_image_attributes', 10 );     add_filter( 'the_content', 'clean_image_attributes', 10 );          function clean_image_attributes($html)     {         $output = new simple_html_dom();         $output->load($html);              foreach ($output->find("img") as $img)         {             if (isset($img->align))             {                 $img->align = null;                 $img->class .= ' clearfix';             }         }              $html = $output->save();         return $html;     }      What the function does is just looking if the image has the align attribute and remove it. This works pretty well, except that when I call the_content(), the layout of my post is kinda broken, the got removed but I have no idea why...


Add custom text in the media library image meta area

I want to add some custom text in this area in the media library: ![enter image description here](http://i.stack.imgur.com/7hwBB.jpg) Is there a filter I could hook into or how can I add content there? If not, how do we do this using Javascript? I want the text to **ONLY** appear if the current user can edit the image (or is the uploader of the image).


How to create a list of terms who's posts also have a predefined external term?

I have a pretty extensive music collection and my friends are always borrowing my stuff. I would like to keep better track of my library so I'm building a sudo-checkout system using WP. The collection was already in WP using terms to sort everything. The main taxonomies are _artist_ , _year released_ , _label_ , and _genre_. I want to add a new taxonomy called _whereisit_. The post type used is called _album_. Because of the way that other plugins interact with the site (I'm a music geek) I can't easily use post meta for inventory status term. If it matters at the moment I'm using Scribu's plugin to autogenerate taxonomy search fields. > _The question:_ > > How can I display a list of terms who's related posts also match another > fixed term? For example: Show a list of terms for _artists_ who's _whereisit_ term is _ihaveit_. If all of the artist's albums have an _whereisit_ term of _idonthaveit_ , do not display the _artist_ term in the list. Or more simply: If all of my albums by a particular artist are loaned out to someone else, don't display the artist's name in the Artist list. Would something like this have to be done through wpdb? Filtering a loop is easy enough, but translating that to a list is over my head. :) **Edit:** I replaced the terms _inhouse_ with _ihaveit_ , _checkedout_ with _idonthaveit_ , and the taxonomy named _inventorystatus_ with _whereisit_ for better clarity.


How to display Custom Taxonomy of Custom post type

I have created Custom Post type called "places" For that I created Custom Taxonomy Category called "Music". Here is the code:               add_action( 'init', 'register_taxonomy_music' );          function register_taxonomy_music() {          $labels = array(          'name' => _x( 'Music', 'music' ),         'singular_name' => _x( 'Music', 'music' ),         'search_items' => _x( 'Search Music', 'music' ),         'popular_items' => _x( 'Popular Music', 'music' ),         'all_items' => _x( 'All Music', 'music' ),         'parent_item' => _x( 'Parent Music', 'music' ),         'parent_item_colon' => _x( 'Parent Music:', 'music' ),         'edit_item' => _x( 'Edit Music', 'music' ),         'update_item' => _x( 'Update Music', 'music' ),         'add_new_item' => _x( 'Add New Music', 'music' ),         'new_item_name' => _x( 'New Music', 'music' ),         'separate_items_with_commas' => _x( 'Separate music with commas', 'music' ),         'add_or_remove_items' => _x( 'Add or remove music', 'music' ),         'choose_from_most_used' => _x( 'Choose from the most used music', 'music' ),         'menu_name' => _x( 'Music', 'music' ),     );          $args = array(          'labels' => $labels,         'public' => true,         'show_in_nav_menus' => true,         'show_ui' => true,         'show_tagcloud' => true,         'show_admin_column' => false,         'hierarchical' => true,              'rewrite' => true,         'query_var' => true     );          register_taxonomy( 'music', array('places'), $args );     }      Now, I want to display the categories in `single-places.php`. How can I display the categories "Music".


How to remove a column from the Posts page

In a previous question I asked how to add a column to the Posts page in the Administration section, and got a working answer. But now I need to know how to delete an existing column (e.g. the Date column) so that my customized Date column replaces it.


Why does the_date work in the first custom column, but not in the second, in a series of customized Posts columns?

Interesting challenge. I was given a piece of code earlier, which I have modified as follows for the Posts page.               /* add time stamp */     add_filter('manage_posts_columns', 'posts_columns', 5);     function posts_columns($defaults){         $defaults['your_date_col'] = __('Date');         $defaults['week_number'] = __('Wk#');         $defaults['week_in_quarter'] = __('Wk/Qtr');         return $defaults;     }     add_action('manage_posts_custom_column', 'posts_custom_columns', 5, 2);     function posts_custom_columns($column_name, $id){         if($column_name === 'your_date_col'){         echo the_date('d M'),' ',the_time('Ha');         }         if($column_name === 'week_number'){         echo 'Here: ',the_date();         }     }      Strangely, although the date format that I have given shows up in the first column ("your_date_col"), only "Here: " shows up in the second column ("week_number"). Any suggestions as to why the_date function doesn't work in the second column?


Filtering posts on Post Administration Page by Week Number instead of by Month

Has anyone written or can suggest a plugin that would replace the filter-by- month in the Post Administration screen with filter-by-week-number instead? e.g. a drop down option for "Week of 05/31-06/06, 2011"


Display custom comments field for first level only

I have simple fuction that adds additional comment form field called "Subject":               add_action( 'comment_form_logged_in_before', 'additional_fields' );     add_action( 'comment_form_before_fields', 'additional_fields' );           function additional_fields () {         echo '
'.         '' . __( 'Your subject' ) . ''.         '<input id="subject" name="subject" type="text" size="30"  tabindex="5" />
';     }      It works fine, but just now it adds "Subject" field to every comment form. I need to add this field only for first level/depth of comments. My goal is:   When user will reply directly to post, he will get "Subject" field in reply form. When user will reply to comment, he will not see "Subject" field in reply form.


Is there a way to change the color of a row in Post Administration based on the type of post?

What I'd like to do is have the entire row be a different color - for example, a light blue for draft posts. That way I can visually see at a glance what's a draft, what's scheduled, and what's published on a given time period (I am working on a system for scheduling posts out weeks in advance). It would seem the logical way to do this is to alter the row color, since there is a CSS class ("status-draft") for example. However, it appears that altering the row color doesn't work since the individual cells as well have overriding colors. Thoughts?


Wordpress Ajax not function as I expect... what's wrong?

In functions.php I have:               function testajax() {     echo "test";     exit;     }          add_action('wp_ajax_testthisajax', 'testajax');     add_action('wp_ajax_nopriv_testthisajax', 'testajax');      In scripts.js I have:               $("#thisformsid").submit( function() {             $.ajax({                 url: CustomAjax.ajaxurl,                 type: "POST",                 data: {                     action: 'testthisajax'                 },                 success: function(result){                         console.log('success: ', result);                     },                     error: function(xhr){                         console.log(xhr.status);                     },                     complete: function(result){                         console.log('complete: ', result);                     }             })         });      My form is using the correct id and I can reach the ajax submit in my scripts.js file The url is defined in scripts.js like:               var CustomAjax = {         ajaxurl: "/wp-admin/admin-ajax.php"     };      However this fails. In console I see an error and the value "0" returned. ANy ideas why this would not work? It seems like this, as basic as it is, should not error out but I don't see the problem. Any ideas? * * * **Update:** In console I see that the error is labeled as being on line 18 of my install of jquery (it's minified so i don't know what is actually at that line)? Why would there be an issue with jquery?


Gallery stripped from excerpt of post

I'm having trouble with galleries being stripped/filtered out of the content of the post excerpts before the "read more" click (the galleries load just fine when you click and read the post all by itself on a full page). Something in the template is stripping that out (there are lots of filters in the theme options, none of which have worked turning them off). Does anyone know what code to look for that might be stripping something like the standard wordpress galleries? I'm somewhat new to Wordpress and not great at php, so wondering if anyone knew what I should look for. Side notes: Other templates display it correctly, other gallery plugins do the same thing, there is an extra file content_gallery.php, I don't see any "filters" besides using functions to strip.


How does the default recent posts widget work with cache?

I am trying to build a widget based on the default wordpress recent posts widget. In wp-includes/default-widget.php , I noticed in `class WP_Widget_Recent_Posts` in function widget(), the recent posts are first looked for in cache and if not found, then output buffering is turned on and the result is generated and then stored back into the cache. Since I am using NuSphere IDE , I put a `DebugBreak();` inside the condition `if ( isset( $cache[ $args['widget_id'] ] ) )` (`DebugBreak()` causes a breakpoint exception to occur in the current process.) but the breakpoint was never executed pointing out that the cache wasn't set before. Now this shouldn't be the case as the cache does get set by `wp_cache_set('widget_recent_posts', $cache, 'widget');`. This is my first dilemma. Secondly, I would really appreciate if someone threw some light on how output buffering works. Cause as I mentioned before, the recent posts are first looked for in cache and if not present there then output buffering is turned on (`ob_start();`), result is fetched and then `ob_get_flush();` is performed like `$cache[$args['widget_id']] = ob_get_flush();` and the cache is set. So if no output is echoed to the browser, then how does the widget actually display the recent posts? PLEASE HELP!


Do pingbacks work with ?p=123 permalinks?

From what I've seen wp_extract_urls in pingback() function wp- includes/comments.php does NOT include query vars (ex: ?p=123) with the returned urls. But later in the function wordpress tests if there are query vars . Is this a mistake or I am missing something ? From debugging it seems query vars are LOST in "Step 2" in the function. Am I right ? If not how can I get pingbacks to work on ?p=123 permalink format ?


apply_filters('the_content', $content) alternative

"the_content" filter can get added with other filters from plugins and themes which could alter content, when you simply want this to format the post_content to HTML format. Is there a better solution for this that other plugins do not add filters to and can format the post content to HTML format just like this filter do?


Execute Shortcodes when submitting post

I'm using shortcodes to insert some image links to my posts I grab from XML files (by an ID). As this needs to be executed just once it's not necessary to this everytime a user loads the page. So how can I replace the Shortcode with the needed content as soon as i save/publish/update the page?


date.php shows only three posts' title. how to fix it?

my `archive.php`               <?php wp_get_archives( array( 'type' => 'monthly', 'limit' => 12, 'show_post_count' => 1 ) ); ?>
      my `date.php`               <?php get_header();                  while (have_posts()) : the_post();                  echo the_title() . '

';                 endwhile;                 wp_reset_query();     get_footer();?>      when I click **december 2013** form **myblog.com/archive** then it's goes to **myblog.com/2013/12** and showing **only three posts' title** from the december 2013. how can I fix it to show all the post from the particular month?


SSL setup: wp-login css doesn't load over httpS

I have a multisite setup, using SSL. Everything works fine. visitors are getting all there content over https. There is not a single url without httpS in my page source. (inclusing urls to css,js files) But, once go to the login page, all my css files have an URL with http instead of https. So most browsers block these insecure sources, thus screwing up admin interface. The pages itself is loaded over https, all redirects are also served over https. My site url is set to https://... I'v searched my database and project files and there is not a single reference to http://... What can cause this problem?


Custom Taxonomy URL

I have been reading all of the similar answers on here for hours but can't find anything basic enough for my needs. I have a non-hierarchical custom post type "inventory". I have one custom taxonomy "division" which is the inventory category I'd like the permalink URL for a single page to be:               sitename.com/division/postname      but it only comes up as:               sitename.com/postname      What is the simplest way to get the inventory category (division) to display in the url? Just to clarify, I'd like to have 'division' replaced with the name of the category that division represents. Suggestions are much appreciated! Update: marfarma's answer below worked perfectly, note that it was necessary to include the static string before the dynamic portion:               'rewrite'   => array( 'slug' => 'division/%division%', 'with_front' => false ),


Insert Post using Ajax

I'm using the following code to submit a form from a Wordpress page.                                             <form action="<?php the_permalink(); ?>" class="contact-box" id="enqform" method="post">         First Name*                               <input type="text" id="firstname" name="firstname" value="<?php if(isset($_POST['firstname'])) echo $_POST['firstname'];?>" class="required" />          <input type="submit" id="submit-btn" value="Submit" />         <input type="hidden" name="submitted" id="submitted" value="true" />          <input type="hidden" name="nonce" value="<?php echo wp_create_nonce( 'form-nonce' );?>" />                           </form>       This is the code in the form-process.php file:               <?php            if(isset($_POST['submitted'])) {                  if(trim($_POST['firstname']) === '') {             $hasError = true;         } else {             $firstname = trim($_POST['firstname']);         }                 global $wpdb;         $nonce = $_POST['nonce'];         if ( ! wp_verify_nonce( $nonce, 'form-nonce' ) ) {             die( 'Security check' );          } else {                         $new_post = array(                 'post_title'    => $firstname,                 'post_status'   => 'publish',                 'post_type' => 'mycpt'             );             $pid = wp_insert_post($new_post);                                        if( $pid ) {                  add_post_meta( $pid, 'cpt_firstname', $firstname, true );                                                    }         }     }                ?>            The form works ok but seems to die when it gets to `wp_insert_post`, resulting in a 500 Internal Server Error. Any ideas where I'm going wrong please?


Plugin to download attached media files?

I have a photo gallery site. Each post has 10-20 photos. I want to be able to offer a download of my photos on post-by-post basis in a single zip file. In other words a link to a zip file with all those photos zipped up. How do I do that? Is there a plugin for that?


numberposts? showposts? posts_per_page?

So the documentation on the Codex is pretty clear that showposts is deprecated. But that same documentation mentions nothing of numberposts. Instead, posts_per_page is listed. But if we turn to the Codex docs for get_posts we see no mention of posts_per_page, instead citing numberposts. In post.php we see what's happening: numberposts is set up as a default (5), but then copied to posts_per_page (unless posts_per_page is set in the args). So my question is really quite pedantic, but I'm looking to update Codex so I wanted to ask you guys - is there a reason why we wouldn't want to just encourage posts_per_page across the board, eventually deprecating numberposts? Or am I missing some critical insight here?


Have different number of posts on first page

I need to have a different amount of posts per page on the first page that on the other pages. For example, this is what I need   * Total posts: 6   * First page: showing 3 posts   * Following page: showing 2 posts per page Here's my code:               $paged = (get_query_var('paged')) ? get_query_var('paged') : 1;          $fp_limit = 3; // first page limit     $limit = 2; // following page limit     $offset = 0; // default offset          if( $paged == 1 ) {         $limit = $fp_limit;     } else {         $offset = $fp_limit + ( ($paged - 2) * $limit );     }          $args = array(         'post_type' => 'my_post_type',         'post_status' => 'publish',         'offset' => $offset,         'posts_per_page' => $limit,         'caller_ get_ posts' => -1, // remove sticky post         'paged' => $paged,         'tax_query' => array(             array(                 'taxonomy' => 'my_taxo',                 'field' => 'slug',                 'terms' => array('slug1', 'slug2', 'slug3')             )         )     );     $my_query = null;     $my_query = new WP_Query($args);          // basic loop     if( $my_query->have_posts() ) :      while ($my_query->have_posts()) : $my_query->the_post();          ...          endwhile; endif; // archive loop     if (function_exists('wp_pagenavi')){ wp_pagenavi( array( 'query' => $my_query ) ); }          wp_reset_query();      At first page in archive, this code assumes: Well, 6 posts total and 3 posts per page. So I need 2 archive pages and the pagination I present to you is: `[1] [2]` However, any other page in archive the code assumes: Well, 6 posts total and 2 posts per page. So I need 3 archive pages and the pagination I present to you is: `[1] [2] [3]` Need a little help to fix this.


Updating a custom field in a custom post type

`update_post_meta($post_id, 'custom_field_name', 'custom_field_value')` updates a custom field in a post. How to do the same with a custom post type ?


Facebook share button help

I am developing a social sharing widget. It has Facebook sharing option too. I wrote the following link structure for it but when clicked, the page neither displays the link to share, nor the title and decription. Please help out. Thanks               <a href="http://www.facebook.com/sharer.php?u=<?php get_permalink();?>&t=<?phpthe_title();?>">     Share


YouTube oEmbed and privacy-enhanced mode

When you´re embed a youtube video in an iframe, you can enable the privacy- enhanced mode, so YouTube doesn´t store information about your web page visitors until they play the video. I've tried to embed a video via oEmbed and the URL > http://www.youtube-nocookie.com/embed/xA3tfBTvH0c but it didn't work. Is there a chance to implement a privacy-friendly solution with oEmbed? * * * _EDIT_ I found this proposal and tried to customize it and it seems to work, but there is one thing that is not optimal. You can´t use the defined $content_width, because this solution needs a declaration of the height, too. Any ideas to this approach or do you have another?                wp_embed_register_handler( 'ytnocookie', '#https?://www\.youtube\-nocookie\.com/embed/([a-z0-9\-_]+)#i', 'wp_embed_handler_ytnocookie' );      wp_embed_register_handler( 'ytnormal', '#https?://www\.youtube\.com/watch\?v=([a-z0-9\-_]+)#i', 'wp_embed_handler_ytnocookie' );      wp_embed_register_handler( 'ytnormal2', '#https?://www\.youtube\.com/watch\?feature=player_embedded&v=([a-z0-9\-_]+)#i', 'wp_embed_handler_ytnocookie' );           function wp_embed_handler_ytnocookie( $matches, $attr, $url, $rawattr ) {        global $defaultoptions;        $defaultoptions['yt-content-width'] = '680';        $defaultoptions['yt-content-height'] = '510';        $defaultoptions['yt-norel'] = 1;        $relvideo = '';        if ($defaultoptions['yt-norel']==1) {            $relvideo = '?rel=0';        }        $embed = sprintf(          '
View video on YouTube
',           get_template_directory_uri(),           esc_attr($matches[1]),           $defaultoptions['yt-content-width'],           $defaultoptions['yt-content-height'],           $relvideo        );        return apply_filters( 'embed_ytnocookie', $embed, $matches, $attr, $url, $rawattr );      }


@package & @subpackage: how to use with child themes

My problem is with `@package` and `@subpackage`. I went to the link (What are the package and subpackage comment for?). This was the answer: "These are PHPDoc tags - used to generate meaningful (and automated) code documentation". I went to the suggested link and didn't find the anything I could apply to the problem This is what I have now.               /**          * Contains a list of all custom action hooks and corresponding functions defined for abc.          * This file is included in functions.php:          *          * @package theme-name          * @subpackage Functions          */      This is not a child theme of twenty ten. There is a folder in the theme-name folder: functions. My child theme is in another folder. I’ve saved the functions.php file to my child theme folder. Nothing happens (changing the content) either when I change the subpackage my folder name or leave the “Functions” word there. What should I be putting in the here?               /**          * Contains a list of all custom action hooks and corresponding functions defined for abc.          * This file is included in functions.php:          *          * @package theme-name          * @subpackage ???          */      thank you so much for the help. `@package` & `@subpackage`: how to use with child themes


Put code into body tags near top, using a plugin

How do I use a plugin to put this inside the body of every page on my WP site, for facebook integration. (Yes, I know other plugins can do it, but I want to do it myself.) Facebook recommends as close to the top of the lead body tag as possible. Thanks!               <script>(function(d, s, id) {     var js, fjs = d.getElementsByTagName(s)[0];     if (d.getElementById(id)) return;     js = d.createElement(s); js.id = id;     js.src = "//connect.facebook.net/en_US/all.js#xfbml=1&appId=99999999999";     fjs.parentNode.insertBefore(js, fjs);     }(document, 'script', 'facebook-jssdk'));</script>


Reply button missing in comment \s area, How can I get that?

I have added comments template in wrodpress in my developed theme using this code :               <?php comments_template( '', true ); ?>      after that I get a comment box, name filed, email field, and website url field. But when I submit a comment then reply button is missing I cant found the reply button with my comment. For kind notice, I have enabled threaded (nested) comments from backend setting. Please know me how can I bring reply with my comments. Thanks


Comments from mobile apps & Disqus

I'm currently using Disqus in my WordPress Installation, and I am pretty happy with it. However, I'd like to extend my native mobile app (Windows Phone) to allow the users to post comments directly inside the app. I'm using a framework which supports WordPress comments for registered users out of the box, and I wouldn't want to rewrite the app to explicitly support Disqus. But as far as I know I can't combine both systems without problems, right? I'm certainly not the only person with that problem, so what's your strategy? Should I switch to Jetpack comments? I don't want to loose social login options, at least on the normal homepage. WordPress Version 3.6.1 Disqus Comment System Version 2.74 http://disqus.com/ Jetpack


Single.php loading fully on localhost but not on server

The title explains the issue. I did my best to find reason behind such dysfunctionning. Can you please tell me what can be the causes of such issue? Any techniques to investigate the problem are welcome. Thank you for your help. **Edit** : After using the debugging suggestion, I have the following errors in my debug.log file. What I dont understand is why I have errors in functions.php at line 2959 while the last line in my functions.php is 2145.               [22-Oct-2013 17:21:33 UTC] PHP Notice:  wp_enqueue_script was called incorrectly. Scripts and styles should not be registered or enqueued until the wp_enqueue_scripts, admin_enqueue_scripts, or init hooks. Please see Debugging in WordPress for more information. (This message was added in version 3.3.) in C:\xampp\htdocs\balagha-to-alquran\production\wp-includes\functions.php on line 2959          [22-Oct-2013 17:21:33 UTC] PHP Notice:  wp_enqueue_style was called incorrectly. Scripts and styles should not be registered or enqueued until the wp_enqueue_scripts, admin_enqueue_scripts, or init hooks. Please see Debugging in WordPress for more information. (This message was added in version 3.3.) in C:\xampp\htdocs\balagha-to-alquran\production\wp-includes\functions.php on line 2959      **Edit** : I see that a plugin is the responsible of above notices. When I deactivate it I see that the errors disappear. the part of the code in the plugin file that seems responsible is:                 if (!is_admin() ){         if (get_option('jqfoot_nohover')!=TRUE){        //if its not checked load the JS/CSS         //wp_enqueue_script('jquery');  //no need here, loads as dependancy in next line down         wp_enqueue_script('footenote_js', plugins_url('/footnote-voodoo.js', __FILE__), array('jquery'));         // it would save load to put these css rules into your template css and comment this next line out         wp_enqueue_style('footenote_css', plugins_url('/footnote-voodoo.css', __FILE__) );                   }      How can I make `wp_enqueue_script` and `wp_enqueue_style` work correctly. Thank you again for your time. } //end !is_admin()


Posts in multiple Categories different single.php

I am smashing my head against some code. Here is the situation: I have one post in 3 different categories, this post has to be visible in "category 1" with the single1.php, in "category 2" with single2.php and in "category 3" with single3.php. Obviously the 3 single.php pages have a different template inside. For example the single1.php shows pictures and the_content(); single2.php shows pictures and comments; single3.php shows the reviews. I know that in single.php I can use the if/else but I cannot figure out if the same post is in 3 different categories. Any help please?


Escaping Quotes

For some reason when i try to put like a embeded video my video has slashes inside the code, but if I add it in the template itself then the code is fine i was told its "escaping quotes" anyhow this is what i have. Functions file               <?php         add_action ( 'edit_category_form_fields', 'extra_category_fields');         function extra_category_fields( $tag ) {    //check for existing featured ID             $t_id = $tag->term_id;             $cat_meta = get_option( "category_$t_id");     ?>                      <textarea name="Cat_meta[extra4]" id="Cat_meta[extra4]" style="width:60%;"><?php echo $cat_meta['extra4'] ? $cat_meta['extra4'] : ''; ?></textarea>
                 <?php _e('Video'); ?>
     <?php     }               add_action ( 'edited_category', 'save_extra_category_fileds');     function save_extra_category_fileds( $term_id ) {         if ( isset( $_POST['Cat_meta'] ) ) {             $t_id = $term_id;             $cat_meta = get_option( "category_$t_id");             $cat_keys = array_keys($_POST['Cat_meta']);                 foreach ($cat_keys as $key){                 if (isset($_POST['Cat_meta'][$key])){                     $cat_meta[$key] = $_POST['Cat_meta'][$key];                 }             }             update_option( "category_$t_id", $cat_meta );         }     }     ?>      Template file                    <?php      if (isset($cat_data['extra4'])){     echo $cat_data['extra4'];     }     ?>           I can also post the embed code for the video im trying to post if that helps its pretty long though Any help is greatly appreciated.


query_posts() in function makes global $wp_query out of sync?

This has me stumped for a while already. Either I am missing something very obvious or something very not obvious. I am also not entirely sure if this has something to do with WP or purely PHP mechanics at work.               function test() {              global $wp_query;              var_dump($wp_query == $GLOBALS['wp_query']);     }          function test2() {              global $wp_query;              query_posts(array('posts_per_page' => 1));         var_dump($wp_query == $GLOBALS['wp_query']);     }          test();     test2();      Result: > boolean true > > boolean false Why does `test()` evaluates that to `true`, but `test2()` evaluates that to `false`?


How to include code into functions.php file via a plugin

I have a lot of custom code in my functions.php file, what I would like to do is move all of this into a plugin for example myplugin-functions.php and then include the file into the themes functions.php file. Can I use hooks to do this or would I have to manually include the file. The reason I want it as a plugin is so that I can easily disable it without editing theme files!


get_bookmarks filter not supplying query argument (wp 3.1)

I'm using a filter on the get_bookmarks function. When I use two arguments in my filter function I get the result array and nothing for the second arg (it should be the parsed query). Here's what I'm mean:               function samiconductor_sort_links_by_order( $results, $args ) {         echo print_r($args); // nothing              function order($a, $b) {             $a_order = get_option( "link_order_$a->link_id", 0 );             $b_order = get_option( "link_order_$b->link_id", 0 );                  if ( $a_order == $b_order ) {                 return 0;             }             return ( $a_order > $b_order ) ? -1 : 1;         }              usort( $results, order );              return array_reverse($results);     }     add_filter( 'get_bookmarks', 'samiconductor_sort_links_by_order' );      And here's the get_bookmarks function - source. As you can see, it should pass $r = wp_parse_args( $args, $defaults ); as the second arg to the filter. Am I missing something? Thanks


wordpress enqueue script not working

I am using a carousel to display latest jposts on my front page and I am using the following code but it's not working.               function my_load_caroufredsel() {             // Enqueue carouFredSel, note that we specify 'jquery' as a dependency, and we set 'true' for loading in the footer:             wp_register_script( 'caroufredsel', get_template_directory_uri() . '/js/jquery.carouFredSel-6.1.0-packed.js', array( 'jquery' ), '6.1.0', true );             // For either a plugin or a theme, you can then enqueue the script:             wp_enqueue_script( 'my-caroufredsel', get_template_directory_uri() . '/js/my-caroufredsel.js', array( 'caroufredsel' ), '', true );         }         add_action( 'wp_enqueue_scripts', 'my_load_caroufredsel' );      Any one can please tell what's the problem with the above code. Thanks


jquery bookmark links

I got social bookmarks in jQuery, but how can I get post titles and permalinks in this snippet? If I put `<?php echo get_permalink(); ?>` in there, the whole site gets blank.               $('a[rel=shareit-twitter]').attr('href', 'http://twitter.com/home?status=' + title + '%20-%20' + title);      UPDATE: Here's the whole jQuery for the bookmarking:               <script type="text/javascript">        jQuery(         function() {              //grab all the anchor tag with rel set to shareit         $('a[rel=shareit], #shareit-box').click(function(e) {                    e.preventDefault();             //get the height, top and calculate the left value for the sharebox             var height = $(this).height();             var top = $(this).offset().top;                  //get the left and find the center value             var left = $(this).offset().left + ($(this).width() /2) - ($('#shareit-box').width() / 2);                       //grab the href value and explode the bar symbol to grab the url and title             //the content should be in this format url|title             var value = $(this).attr('href').split('|');                  //assign the value to variables and encode it to url friendly             var field = value[0];             var url = encodeURIComponent(value[0]);             var title = encodeURIComponent(value[1]);                  //assign the height for the header, so that the link is cover             $('#shareit-header').height(height);                  //display the box             $('#shareit-box').show();                  //set the position, the box should appear under the link and centered             $('#shareit-box').css({'top':top, 'left':left});                  //assign the url to the textfield             $('#shareit-field').val(field);                  //make the bookmark media open in new tab/window             $('a.shareit-sm').attr('target','_blank');                  //Setup the bookmark media url and title             $('a[rel=shareit-mail]').attr('href', 'http://mailto:?subject=' + title);             $('a[rel=shareit-facebook]').attr('href', 'http://www.facebook.com/share.php?u=' + url + '&title=' + title);             $('a[rel=shareit-posterous]').attr('href', 'http://posterous.com/share?linkto=' + url + '&title=' + title);             $('a[rel=shareit-twitter]').attr('href', 'http://twitter.com/home?status=' + title + '%20-%20' + title);         });              //onmouse out hide the shareit box         $('#shareit-box').mouseleave(function () {             $('#shareit-field').val('');             $(this).hide();         });              //hightlight the textfield on click event         $('#shareit-field').click(function () {             $(this).select();         });     });       </script>


How to use a WordPress' existing admin icon?

I use the `add_menu_page` function to add an new admin menu:               add_menu_page(         'Custom_menu',         'Custom_menu',         'edit_posts',         'custom_slug',         '',         'wordpress_existing_icon',         5     );      How to use one of WordPress' existing icons? For instance, if I would like to use the "Posts" WordPress icon, by what must I replace `'wordpress_existing_icon'` in the code above ? I tried `'edit'` and `'edit-posts'` but it doesn't work.


Template tags for Buddypress

Is there a place that shows all available template tags and how to use them similar to how wordpress does? I'm trying to link to a profile within a loop. Ex of output               Tom's Profile      Tried this               <?php echo( bp_core_get_userlink() ) ?>      but it errors out This gives me the author name and url but i just need the url to the profile               <?php echo( bp_core_get_userlink( $post->post_author ) ) ?>      But I am not all that great with PHP so I can't figure out how to just output the url Thoughts?


Best practices for securing a Buddypress installation?

A client of mine runs a Buddypress-based site (BP 1.2.6 on WP 3.0.2). We'd like to give users the ability to publish blogs of their own, but we don't want them to be able to execute PHP code (we make extensive use of the Exec- PHP plugin on the site), activate/deactivate plugins, or basically anything but use the site and publish blogs. How can we lock things down such that only users with "admin" level privileges and higher can execute PHP code, activate/deactivate plugins, manage users, and the like?


Looking for a subscriber list management system

Is there any plugin that enables the creation of forms and has a smart tool for subscribers (not site visitors who registered) database management? I'm looking for a plugin that does that for a long time for different type of needs. For example, event subscription, workshops, courses etc. I don't need an event/calendar tool, just forms. The emphasis not on the front end but on the ability to manage the subscriber lists in the back end. Thanks


Insert/sticky specific post into Loop at specific location

I'm having a hard time determining the first direction to take with this. I'm trying to write a plugin that allows users to pick a location for a post to be inserted into the homepage. For example a user can 'sticky' an old post to the 2nd location on their front page. My problem is I don't know how to insert a post into the loop at a specific point. I'm thinking it should be something like the following (but clearly I'm missing the insert text):               $current_position = $_POST('current_postition');     add_action ('pre_get_posts', 'add_post_to_frontpage');     function add_post_to_frontpage ($query) {       if ( $query->is_home() && $query->is_main_query() && $query->current_position = $positionlocation ) {              //insert a given post into this current_position          $query->set( 'p=$desired_post');       }     }      Thanks EDIT: I added in what I think is a logical way to set the post, but think that this will cause trouble with the posts that follow the post I'm inserting


Something is injecting a slash after any static file response , server is nginx

This is what chrome's console says: > Resource interpreted as Stylesheet but transferred with MIME type text/html: > "someserver/wp-content/themes/pgcss/normalize.css/?ver=3.5.1". someserver:18 > > Resource interpreted as Image but transferred with MIME type text/html: > "someserver/wp-content/themes/pgimg/lens.png/". someserver:77 Obviously something in injecting a slash at the end of my file.   I am not very familiar with nginx , what can I do?


How to add a custom-post-type post within another custom-post-type post edit screen using AJAX?

I've got two custom post types: CD and Track. Each of them has got some metadata associated with them. What I'm trying to do is to add Track posts to a CD post when the CD post is being edited. On the CD edit page I have "Add Track" link. When clicking on it, I would like a "New Track Form" to appear under the link that will ask for a Track (custom-post-type) information, along with all metadata that needs to be specified for a Track - as if "Add Track" link was clicked from the left WP menus. Hope that makes sense.CD My CD and Track custom-post-types are registered as following: http://wordpress.pastebin.com/Y6aagTVs On the edit CD page I have the following link `<a class="addTrack" href="">Add Track</a>` I'm missing AJAX and the function that will handle the addition of the "New Track form". Here is what I've got so far in the AJAX function:               // Add Tracks        $("a.addTrack").click(function () {         opts = {             url: ajaxurl, // ajaxurl is defined by WordPress and points to /wp-admin/admin-ajax.php             type: 'POST',             async: true,             cache: false,             dataType: 'json',             data:{                 action: 'track_add', // Tell WordPress how to handle this ajax request             },             success: function(response) {                 return false;             },             error: function(xhr,textStatus,e) {  // This can be expanded to provide more information                 alert("There was an error adding a track.");                 return false;             }         };         $.ajax(opts);     });      And the function that will handle the insertion of the "New Track Form" is               // Add Tracks     add_action('wp_ajax_track_add', 'my_ajax_admin_add_track');     function my_ajax_admin_add_track() {     }      I don't know how to go on about the AJAX and my_ajax_admin_add_track() functions. Would really appreciate any help and tips!!! Many thanks, Dasha


Adding a custom post type meta field to rss

So I added my videos custom post type to my rss feed via this code.               //Add videos custom post type     function myfeed_request($qv) {     if (isset($qv['feed']) && !isset($qv['post_type']))         $qv['post_type'] = array('post', 'videos');     return $qv;     }     add_filter('request', 'myfeed_request');      Is there a way to add a custom post type meta field to the output. Example:               Title     Post meta field (in this case a video)     Post data


Remove "minor-publishing" div from Publish admin metabox

I want to remove the `#minor-publishing` `div` from the Publish admin metabox. I came across How to HIDE everything in PUBLISH metabox except Move to Trash & PUBLISH button and http://wordpress.org/extend/plugins/adminimize/ but they either remove it by css or custom-code their metabox. Is there a way to remove the div by hooking on to some action and modifying the html that will be outputted for that metabox? How to Move the Author Metabox into the "Publish" metabox? modifies the html output by _adding_ code to it. What I need is to _remove_ the entire `#minor- publishing` `div` from the html that will be output for the Publish admin metabox. Thanks in advance.


How Can I remove or hide the export page in WordPress menu?

I'm trying to remove the export.php page from WordPress admin menu -> tools for a multisite so only the network admin could see it I have the following code so far but can't get it to work.               //***************************************************     // Remove export Page     //***************************************************     function remove_menu_export_pages() {         remove_menu_page('export.php');      }     add_action( 'admin_init', 'remove_menu_export_pages' );      How can I solve this?


Search using WP_Query

I'm using the following `WP_Query` within my `search.php` template in order to only search the 'products' custom post type. For some reason, its returning other post types with some search terms. Any Ideas where I'm going wrong?               <?php global $query_string; ?>          <?php $query_args = explode("&", $query_string); ?>          <?php $search_query = array( 'post_type' => 'products', 'posts_per_page' => 12, 'paged' => $paged, 'orderby' => 'name', 'order' => 'ASC' ); ?>          <?php foreach($query_args as $key => $string) {              $query_split = explode("=", $string);              $search_query[$query_split[0]] = urldecode($query_split[1]);          } ?>          <?php $search = new WP_Query($search_query); ?>          <?php if ( $search->have_posts() ) : while ( $search->have_posts() ) : $search->the_post(); ?>
         <a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>">
                      <?php if( get_field('product_image') ) { ?>                          <?php $product_image = get_field('product_image'); ?>                     <img src="<?php echo $product_image['sizes']['thumbnail']; ?>" alt="<?php echo $product_image   ['alt']; ?>" >                      <?php } else { ?>                          <img src="<?php bloginfo('template_url'); ?>/images/fallback-image.png" alt="Product image coming soon.">                      <?php } ?>
<?php trimmed_title('...', 22); ?>
<?php the_field('reference_number'); ?>

          <?php endwhile; else: ?>
Sorry, no products matched your search criteria.
          <?php endif; ?>


Hide root site in Multisite install

I recently setup a WordPress multisite install using subdomains and the WordPress MU domain mapping plugin. When I initially setup the domain mapping plugin, I set the root (http://domain.com) and http://www.domain.com to redirect to blog ID 2 (ie. www.domain.com). However, when I do this the redirect on the root prevents me from accessing the Network admin page. Is there a way I can change the configuration to enable me to still access the Network admin page whilst redirecting the root site to www?


Creating new dynamic menu including BP links

Perhaps I have missed something fundamental, but I am attempting to include the various dynamic menu items included with BuddyPress and other add-ons to my primary drop-down menu. For example, the Twenty Eleven WP theme has a tall header with a drop-down menu beneath the header. This menu can be manipulated via the Appearance->Menus option in wp-admin. BuddyPress adds its own menu items to the admin bar at the top of the page but does not include these links in the drop-down menu below the header. I would like to remove the admin bar completely and relocate all dynamic links to the drop-down menu. I have already created a custom menu in the `functions.php` file:               function register_my_menus() {       register_nav_menus(       array(        'header-menu' => __( 'Nav Menu' )       )      );     }     add_action( 'init', 'register_my_menus' );      And this menu is loaded in the `header.php` with:               <?php wp_nav_menu( array( 'theme_location' => 'header-menu' ) ); ?>      I am able to add individual links to this menu using the `wp_nav_menu_items` function, but cannot seem to be able to replicate the dynamic menu structure created by the `bp_nav` functionality based on user. Does anyone have ideas on how I could relocate this functionality? Or perhaps am I looking at the menu structure incorrectly?


Why is it wrong to use admin_print_scripts-{hook} to enqueue a script (.js) file?

According to the Codex, it should only be used for inline script tag(s) in the head. I've been using `add_action('admin_print_scripts-{my-hook}'` for injecting .js and `add_action('admin_print_styles-{my-hook}'` for .css without any problems. I use wp_register_script() & wp_enqueue_script() (and the corresponding **_*_style()_** ) to enqueue them. A "view source" shows               <link rel='stylesheet' href=[...] />      and               <script type='text/javascript' src=[...] ></script>      being inserted into the <head> correctly. Does anyone know any reason _not_ to use them this way, other than a poorly- written Codex description that says not to?


New Template -- copy existing template and change code?

> **Possible Duplicate:**   >  Correct process for a new Page Template? I created a page template following these instructions: http://codex.wordpress.org/Pages#Creating_Your_Own_Page_Templates I'm having difficulty figuring out how to apply margins, fonts, and font sizes to the new page template. So I'm thinking perhaps there's another way to do it: if I can make the new template so it displays Pages exactly the same as my active template (twentyeleven-child), I can then remove things and change things -- I might find it easier this way to locate the things to remove and change rather than figure out how to build the Page Template from scratch. Is this a sensible approach? If it is, would I copy all the text in content.php to my new page template file, and then edit things both in the new page template file and in style.css ?


Remove Unnecessary Mysql Query

my single posts is getting 31 query from mysql. I checked all queries. I saw this query. I am using **last posts** and **categories** widget. I think there query is unnecessary.How to remove theme               Query: SELECT option_value FROM xy_options WHERE option_name = 'widget_pages' LIMIT 1     Query: SELECT option_value FROM xy_options WHERE option_name = 'widget_calendar' LIMIT 1     Query: SELECT option_value FROM xy_options WHERE option_name = 'widget_tag_cloud' LIMIT 1     Query: SELECT option_value FROM xy_options WHERE option_name = 'widget_nav_menu' LIMIT 1      my sidebar is here https://gist.github.com/4546327


Can I hide a specific post from latest posts page?

Let's say that I have a post that I only want to be shown in the page of the category that it belongs to. The problem is that this post is also visible in the latest posts page. Is there a way to hide this post from the latest post page and show it only in the page of the category of the post?


Set domain level rel canonical with Yoast SEO

i have two single woocommerce installs (not multisite) that publish the same content (products etc). i want to add a cross domain level rel canonical to the second domain, such that - www.domain2.com/any-url/ will have a rel canonical of www.domain1.com/any-url/ it seems only way to do it is add rel canonical to every single URL manually. is there not an option to set a top level rel canonical for the whole domain?


How to override enqueued styles using a child theme

I'm creating a child theme (My first in over 3 years) of a WooCommerce theme and I'm having some trouble with the fact that some of the layout styles are enqueued in the parent theme and I'm having to add `!important` to all the styles I want to override. This is the current enqueue code in the parent themes functions.php;               if ( ! is_admin() ) { add_action( 'wp_enqueue_scripts', 'woo_load_frontend_css', 20 ); }          if ( ! function_exists( 'woo_load_frontend_css' ) ) {     function woo_load_frontend_css () {         wp_register_style( 'theme-stylesheet', get_stylesheet_uri() );         wp_register_style( 'woo-layout', get_template_directory_uri() . '/css/layout.css' );         wp_enqueue_style( 'theme-stylesheet' );         wp_enqueue_style( 'woo-layout' );     } // End woo_load_frontend_css()     }      What I need to do is load the child theme css AFTER the `layout.css` file loaded by the parent theme.