Settings API and dynamically generated submenu pages

I have the following situation - I'm making a WordPress version of a jQuery plugin and I want the users to be able to have multiple instances of the plugin (with unique content) for their site. On the main page of my plugin settings the user makes and deletes the instances of the plugin and they appear as dynamically generated submenu pages. Here comes the trouble. In each submenu page there must be a form with settings for that specific instance. I'm doing my best to go with WP standards (so to speak) instead of custom stuff and I really want to try out the Settings API. I barely wrap my head around how to use it in a "normal" or static page, but what about those dynamically generated pages? What do I have to specify as a page when I register the settings section with add_settings_section()? Also, I'm using the class approach for writing the entire thing, and honestly it's a mess. I have no idea where should I register those sections and fields. Here is my template for the plugin:               if (!class_exists('PluginName')) {         class PluginName {             function __construct() {                  }             function get_admin_options() {                  }             function init() {                 // Register plugin pages, subpages and stuff             }             function print_admin_page() {                  }         }     }          if (class_exists('PluginName')) {         $pluginName = new PluginName();     }          if (isset($pluginName)) {         add_action('admin_init', array($this, 'init'));     }      Any help is much appreciated. Cheers!


Performance-issue in WP-admin with a lot of posts

When clicking on "Manage posts" to view all posts in WP Admin, it takes waaay to long. This is a new WP-site, but we are importing posts from an old site, and currently we have 3,376 posts at the site. But the goal is to import between 10-15.000 articles. However, if WP is going to reduce the performance like this - it is really critical. It loads 1.5 - 3 minutes (!) before anythis shows up.. The overall performance of the site it self is really good, but the admin-area for posts is a disaster. So;   1. WHY is the performance so bad   2. How can we make it faster?


How do I activate jQuery/script on demand?

I am trying to use jQuery to display the comment-section of my Wordpress- pages, but without requiring that jQuery be present on all pages that allows comments. Basically, I need the following:   1. A generic javascript implementation of the 'in view' jQuery-plugin (http://remysharp.com/2009/01/26/element-in-view-event-plugin/)   2. A method of activating jQuery (core) when the div containing the comments come into view. This would then load jQuery, which in turn would load the comments-section of the page, but only when that section became visible through the browser viewport. The problem seems to be that I really cannot use 'wp_enqueue_script' (Wordpress' generic way of adding scripts) for this, as it is a PHP-function. Is there some method that would allow me to implement a functionality as described above (without breaking Wordpress/jQuery-functionality)? **EDIT:** I need to enable jQuery only when the reader decides he wants to read comments (as opposed to only opening a page, seeing the title and leaving) - much in the style of Disqus. Disqus appears to be activated only when visible in the viewport, and I am assuming, at the same time the controlling Javascript is activated. How would I do something like that in regular Javascript (activating jQuery), and then porting it to Wordpress?


A shared custom taxonomy between two custom post types

I have two custom post types: event and contact: http://acicafoc.josoroma.com/contactenos http://acicafoc.josoroma.com/eventos Both of them uses a custom taxonomy: country I just created a template named: taxonomy-country.php But I Need two separated templates, one for events who uses countries and another one for contacts who uses countries. For example, to display all events in United States or all contacts from Costa Rica. This is my actual code of taxnomy-country.php, but only for events who uses countries.               <?php     /**      * The template for displaying Countries Taxonomy.      *      */          get_header();               $term = get_term_by( 'slug', get_query_var( 'term' ), get_query_var( 'taxonomy' ) );               //print_r($term);               $args = array();          $args['post_type']  = 'event';     $args['taxonomy']   = $term->taxonomy;     $args['term']   = $term->slug;               query_posts($args);           ?>

<?php                         printf( __( 'Archives: %s', 'twentyten' ), '' . $term->name . '' );                     ?>
                     <?php                         $category_description = category_description();                         if ( ! empty( $category_description ) )                             echo '
' . $category_description . '
';                          /* Run the loop for the category page to output the posts.                      * If you want to overload this in a child theme then include a file                      * called loop-category.php and that will be used instead.                      */                     get_template_part( 'loop', 'category' );                     ?>

          <?php get_sidebar(); ?>     <?php get_footer(); ?>      Thanks in advance.


Block registration by URL referrer?

Is it possible to block user registration based on the referring URL? I have an open registration WP site (configured so users can post ads and events) and while I typically don't get a lot of spam registrations (there is a reCaptcha involved), I was listed on a site as an example of the capabilities of the theme I'm using, and it generates a lot of "test" type of traffic. I like the traffic, but I don't like people registering just to post false test posts just to see how the site works, so I'd ultimately like to simply block registration from that referring URL. Thanks!


wp_remote_get() and javascript/noscript situation

I am using `wp_remote_get()` to get access to certain pages on the net. However, when I make a call using `wp_remote_get()`, the response I recieve is a webpage that contains the following lines of code:               <body>         <noscript>This site requires JavaScript and Cookies to be enabled. Please change your browser settings or upgrade your browser.</noscript>     </body>      So, the page is not returning in full because of the way it is programmed. Is there a way to change the call so that the **non-noscript** page returns instead?


How can I determine if a post has an image attachment?

As far as I know, there's not a simple function that will return true if a post has an attachment. With that in mind, what's the best way to determine if a post has an attachment (or even better, has an image attachment)? I'm automatically inserting a shortcode on posts, but would like that to only happen if there is actually an image attached to the post.


Including only current user's posts in search

I am a new WP plugin developer. I want the search page to include only the current user's posts. I first added a new capability `read_others_posts` to only administrators and editors. Then I tried the following code, placing it in a function and hooking it to the `pre_get_posts` action:               if( !current_user_can('read_others_posts') )         $query->set( 'author', get_current_user_id() );      For all other queries (including in admin and in home), this "filter" works but search doesn't. It still shows all posts on the result page. Is there something that I did wrong? Is there a way to achieve what I described? **EDIT:** Just in case anyone wants to use this hook, let me provide a more general purpose version of the function, although I do think there is a better way to achieve this:               function exclude_other_users_posts( $query ) {         if( !is_user_logged_in() ) {             // guests cannot read private posts             // and we exclude all public posts here             // so guests can read nothing :-)             $query->set( 'post_status', 'private' );             $query->set( 'perm', 'readable' );         } elseif( !current_user_can('read_others_posts') )             $query->set( 'author', get_current_user_id() );     }     add_action( 'pre_get_posts', 'exclude_other_users_posts' );


When to show the author box information automatically

I want to control when the author box is showed in my WordPress theme. It is showed in two pages: `single.php` and `author.php`. For the `single.php` page I already created an option to enable/disable this option, so it will be a choice of the webmaster through the options page. For the `author.php` I would like to make it without options. Totally automatic. If it has information to show, display it, if not, don't display it. And it is at this point where I have my question. Which parameters should I take in consideration to show it or not. At the first moment I planned:               if (the_author_meta('description') {     //Show this     }      But I think it is not a smart way to solve that point. I listed the information to show:   * The avatar   * User first name   * User last name   * Description   * Website   * Twitter   * Facebook   * Google Plus   * Linkedin So, it would be something like that:               $authorfn = get_the_author_meta('user_firstname');     $authorln = get_the_author_meta('user_lastname');     $authordesc = the_author_meta('description');     if (($authorfn || $authorln) && $authordesc) {     //Show this     }      What would you do?   1. If the firstname AND the lastname AND the description   2. If the firstname OR the lastname AND the description   3. If the firstname OR the lastname OR the description   4. If the firstname OR the lastname   5. ... Which parameters would you take in consideration to show the author box information automatically? **Edit:** I will use this solution:               _e('Author: ', 'wp-theme');     echo get_the_author();          $authorfn = get_the_author_meta('user_firstname');     $authorln = get_the_author_meta('user_lastname');              if ($authorfn || $authorln) {             echo ' / ';             _e('Name: ', 'wp-theme');             echo the_author_meta('user_firstname');             echo ' ';             echo the_author_meta('user_lastname');         }


Get first_name and last_name on user_register hook

I have multisite running with 4 sites. One of them has woocommerce. Customers have option to create account while checkout. I have custom analytics where registered customers are labeled with wordpress user ID (`get_current_user_id()`). Customers without account have default ID of `0`. My analytics allow me to add first name, last name, email etc... to customer according to his ID. I would like to add this information right after they make account. I used `user_register` hook to do this job but it is not working. Here is my code in themes functions.php (for simplicity I am not adding analytics code)               function update_user($customer){              $first_name = get_user_meta($customer, 'first_name', true);         $last_name = get_user_meta($customer, 'last_name', true);          }          add_action( 'user_register', 'update_user' );      Here I am trying to save first and last name in variables which are later passed to analytics however I am not getting any result. Maybe I do not fully understand documentation or I do not know the right way to do it. Or would you suggest any other method of getting users information after their registration? Please could you help me? Thank you in advance.


Does auto_update_plugin Filter Work When Put In Theme's functions.php File

I wanted to know if the (auto_update_plugin) and the (auto_update_theme) filters work when put in theme's functions.php file instead of config.php file in WordPress core.


Contact Form 7: Load scripts and styles only when there is shortcode?

how can I make the script and style appear in my footer of my wp only when the shortcode is on a page or a post?


Rewrite rule shows 404 page

I am new to Wordpress so I don't really know how the rewrite rules should look like. My problem is that I have a custom template in my theme called portfolio-inner.php My rule looks something like that `['portfolio/php/wordpress'] => 'portfolio- inner/?galid=3'`. The problem is that all the examples show an `index.php` URL as the destination, but I don't know how to build the `index.php` URL for my template URL. As a result, that rule shows the 404 page. As a workaround, I edited the `.htaccess` and added this:               Redirect /portfolio/php/wordpress  http://example.com/portfolio-inner/?galid=3      and I see the right gallery page, but that's not OK, because the browser's address bar changes and it should remain `/portfolio/php/wordpress`


Wordpress tax_query not showing private posts

When querying posts with the following:               $getClientsArgs = array(         'post_type' => 'client',         'showposts' => -1     );     query_posts($getClientsArgs);      Private posts are displayed if the person viewing is signed in. Else, it skips that post and proceeds to show any non-private posts. This is how I expected it to work. But, when I start using tax_query, private posts are not shown to either people logged in or logged out. They are not returned at all. See this example:               $getClientsArgs = array(         'post_type' => 'client',         'showposts' => -1,         'tax_query' => array(             array(                 'taxonomy' => 'client_types',                 'field'    => 'term_id',                 'terms'    => $clientType->term_id             )         )     );          query_posts($getClientsArgs);      **EDIT:** * * * Further inspection it seems that, when its not the code above causing the problem. See comment on line 3. Its this code:               <?php         $args = array(             'type'         => 'client',             'hide_empty'   => 0, //Setting this to 1 will cause the issue explained above             'hierarchical' => 1,             'taxonomy'     => 'client_types'         );              $clientTypes = get_categories($args);     ?>     <?php foreach ($clientTypes as $clientType): ?>
<?php echo $clientType->name; ?>

                 <?php                     $getClientsArgs = array(                         'post_type' => 'client',                         'showposts' => -1,                         'tax_query' => array(                             array(                                 'taxonomy' => 'client_types',                                 'field'    => 'term_id',                                 'terms'    => $clientType->term_id                             )                         )                     );                          query_posts($getClientsArgs);                 ?>                 <?php while (have_posts()) : the_post(); ?>
                         <?php $workLink = get_field('linked_project'); ?>                         <a href="<?php echo get_permalink($workLink[0]); ?>">                             <img src="<?php the_field('logo'); ?>" />
                 <?php endwhile;                     wp_reset_query(); ?>

     <?php endforeach; ?>


Displaying and Querying Posts with Featured image

I have added Featured image support for my posts by adding the following in the `functions.php`               add_theme_support('post-thumbnails');      I created 3 posts with Featured Image and i want to display them on the homepage as show in the Read Section in this link http://play.mink7.com/sophiance/ I am trying to do the following to get my posts.                   $args = array(                 'post_type' => 'post',                 'posts_per_page' => 3,                 'order' => 'asc'                 );              $home_shows = new WP_Query($args);          //   var_dump($home_shows);              echo "<pre>";         print_r($home_shows->posts);     echo "</pre>";      I am trying to fetch the Featured Image using the following syntax.                   $page = get_page(1);         print_r($page);         if ( has_post_thumbnail() ) {            the_post_thumbnail(array(486,226));         }      the_content();      Now i am not sure how to call the featured image to the posts i have queried at the top. as the content is already fetched before am calling the featured image.


Get post image gallery link

I am showing the featured image on a custom post template, and I want to insert a "more images" text link to the gallery of attached images. Wordpress has instructions for inserting the gallery directly via but I want just the link, or better yet a modal popup to view the gallery. I have tried a variety of plugins, but none seem to work out of the box with the featured image.


Loading Admin Toolbar in header not Footer to Scroll it with page

I'm trying to load the admin toolbar on the front end immediately after the `head` tag in my header. I'm trying to achieve something like this as opposed to how it usually gets loaded at the end of the page.
...

Home

About

Blog

                I want the menu bar to flow naturally with the rest of the page instead of being fixed so when I scroll up it hides with everything else. I've found the admin bar gets loaded in "wordpress/wp-settings.php" on line 146:                  require( ABSPATH . WPINC . '/admin-bar.php' );      And admin bar itself is at:                  wordpress/wp-includes/class-wp-admin-bar.php         wordpress/wp-includes/admin-bar.php      However, I'm new at PHP and have had trouble figuring out how the order of page elements is determined.


ACF | Repeater Add-On Query

Hoping someone can assist as I am new with ACF, particulary around the repeater add-on I am creating a "Postage Pricing" table where this table will consist of 5 columns with 7 rows say.               1st Column = "quantity"     2nd Column = "strips - regular post"     3rd Column = "strips - express post"     4th Column = "roll - regular post"     5th Column = "roll - express post"      An example of one row, keeping in mind the 5 columns described above might be:               150  |  $2.00  |  $7.50  |  $8.50  |  $11      So based on this row, column values will be:               1st Column = 150     2nd Column = $2.00     3rd Column = $7.50     4th Column = $8.50     5th Column = $11      Using this row/column example, if the user selects the following options from three drop-down lists, i.e:               1) Select Order Quantity = 150      2) Packaging Options = "strips"     3) Postage Type = "express_post"      Programmatically in the backend php, how would I go about retrieving the row/column value for this selection, in this case, cost returned would be $7.50 ? Hope this makes sense. Thanks.


Which template.php for /blog

Hi I have a particular installation of WordPress, and I would like to know what is the name of the .php file to access to the blog. So to sum up : I have a navigation like that : HOME / PORTFOLIO / BLOG /CONTACT By default, the user arrives on the home which use "front-page.php" which display excerpt of last entries. I would like when the user click on "BLOG" they go to the list of posts. But what template should I use ? Beause If i use "home.php", my URL will be mysite.com/home, and not mysite.com/blog as I want... Could you help me please ? Thanks a lot ! **EDIT this is my link:**
<a href="<?php echo site_url('blog');?>" title="blog">Blog
      How could home.php be loaded whit that URL ?


Replace Menu Item with Logged in username

I have a topnav menu item that current says "My Account", I would like to change it so that it functions as: Welcome [Logged in Username] -> My Account -> Logout


ajax in admin menu

Following the tutorial listed here, I'm the data isn't being saved to the user meta I'm trying to set. The process itself seems simple enough, but the meta data isn't being saved. I don't get any console errors and the little success animation I have runs when I run the jQuery script.               <?php         add_action( 'admin_footer', 'ring_jquery' );              function ring_jquery() {     ?>     <script type="text/javascript">         jQuery('.ring-submit').on('click', function(){             var u = jQuery(this).attr('user'),                 c = jQuery('.agt_ringc[user="'+u+'"]').val(),                 x = jQuery('.agt_ringx[user="'+u+'"]').val(),                 formData = 'ringu='+u+'&ringc='+c+'&ringx='+x;             jQuery.ajax({                 url: '<?php echo admin_url('admin-ajax.php'); ?>',                 type: 'POST',                 data: formData,                 success: function(e){                          jQuery('.success[user="'+u+'"]').fadeIn(400).delay(400).fadeOut(400);                      },                 error: function(){                          jQuery('.fail[user="'+u+'"]').fadeIn(400).delay(400).fadeOut(400);                      }             });         });          </script>     <?php     } //End ring_jquery()          add_action('wp_ajax_my_action', 'ring_callback');          function ring_callback() {         global $wpdb; // this is how you get access to the database              $ringu = $_POST['ringu'];         $ringc = $_POST['ringc'];         $ringx = $_POST['ringx'];              update_user_meta($ringu,'agt_ringc',$ringc);         update_user_meta($ringu,'agt_ringx',$ringx);              die(); // this is required to return a proper result     }     ?>


How to add admin bar only page?

I successfully managed to create admin bar item using this:               add_action('admin_bar_menu', 'toolbar_link_to_mypage', 999);     function toolbar_link_to_mypage($wp_admin_bar){         global $wp_admin_bar;              $theme_menu = array(             'id' => 'theme_page',             'title' => __('test', 'test'),             'href' => 'http://mysite.com/my-page/',             'meta' => array('class' => 'test')         );              $wp_admin_bar->add_node($theme_menu);     }      But I can't figure out what is the correct way to create an admin panel **OPTIONS PAGE (not sub-menu item! Two answers are about sub-menus already)** for `'href' => '',` parameter. I can't simply use `add_menu_page();` because that would attach it to left navigation as well. Any help would be great!


What's the best "insert all images" plugin?

I've tried several plugins that supposedly allow you to "insert all images" after using the flash based uploader to upload multiple images. However, I still haven't found one that ties in well with the latest version of wordpress in a non-hacky way. Which plugins the most for inserting multiple images? ![image](http://img221.imageshack.us/img221/4746/pictureu.png)


How do I add a TinyMCE row that all users can see, instead of just admins?

Currently I have successfully added a row of shortcode buttons to the TinyMCE editor in WordPress. The problem is, only admins can see the row, and I need contributors and editors to see it too. I have checked the Codex for add_action and add_filter and I can't see any specific arguments to indicate user roles or anything like that. How can I modify this code so that all logged in users can see the new row instead of just admins? Here is the code I'm using to add the row to the editor window:               // add shortcode buttons to the tinyMCE editor row 3     function add_button_3() {        if ( current_user_can('edit_posts') &&  current_user_can('edit_pages') )        {          add_filter('mce_external_plugins', 'add_plugin_3');          add_filter('mce_buttons_3', 'register_button_3');        }     }     //setup array of shortcode buttons to add     function register_button_3($buttons) {        array_push($buttons, "dropcap", "divider", "quote", "pullquoteleft", "pullquoteright", "boxdark", "boxlight", "togglesimple", "togglebox", "tabs", "signoff", "columns", "smallbuttons", "largebuttons", "lists");          return $buttons;     }     //setup array for tinyMCE editor interface     function add_plugin_3($plugin_array) {        $plugin_array['lists'] = get_template_directory_uri().'/js/customcodes.js';        $plugin_array['signoff'] = get_template_directory_uri().'/js/customcodes.js';        $plugin_array['dropcap'] = get_template_directory_uri().'/js/customcodes.js';        $plugin_array['divider'] = get_template_directory_uri().'/js/customcodes.js';        $plugin_array['quote'] = get_template_directory_uri().'/js/customcodes.js';        $plugin_array['pullquoteleft'] = get_template_directory_uri().'/js/customcodes.js';        $plugin_array['pullquoteright'] = get_template_directory_uri().'/js/customcodes.js';        $plugin_array['boxdark'] = get_template_directory_uri().'/js/customcodes.js';        $plugin_array['boxlight'] = get_template_directory_uri().'/js/customcodes.js';        $plugin_array['togglesimple'] = get_template_directory_uri().'/js/customcodes.js';        $plugin_array['togglebox'] = get_template_directory_uri().'/js/customcodes.js';        $plugin_array['tabs'] = get_template_directory_uri().'/js/customcodes.js';         $plugin_array['columns'] = get_template_directory_uri().'/js/customcodes.js';        $plugin_array['smallbuttons'] = get_template_directory_uri().'/js/customcodes.js';        $plugin_array['largebuttons'] = get_template_directory_uri().'/js/customcodes.js';        return $plugin_array;     }     add_action('init', 'add_button_3'); // add the add_button function to the page init


How to generate "WP_Error" Object for user login?

I want to return the Login Error Message even user key-in their privileges correctly. In other words, to terminate the login and show the error message. When we key-in wrong passwords, wordpress shows:               There was an error authenticating your details.          ERROR: The password you entered for the username admin is incorrect. Lost your password?      .. on the login page. This is because of `WP_Error` Object is returned. So my curious question is:   * How to get/generate this `WP_Error` Object on my own, to return back? Is it Array?


Show number of posts AND number on current page

I know how to show the total number of posts in a site, but is there a way to show the number of posts the page you're on is displaying? For example, I want to show this at the bottom of each of my blog pages (8 posts per page);               Index - "Showing posts 1 through 8 of 294 total"     Page2 - "Showing posts 9 through 17 of 294 total"     Page3 - "Showing posts 18 through 26 of 294 total"      The posts are displayed in chronological order if that makes a difference. Is this even possible?


Meta box with front-end styling

I have a specific _Gallery_ post of products that I release at the start of every Monday on my website, which differs from my other _Gallery_ posts. These types of _Gallery_ post don't require the _Authors Bio_ or post _Tags_. * * * I have been manually going into the `style.css` file and changing it to read:               body.postid-9840 div.post-tags,     body.postid-9840 div#author-bio {display: none;}      However, this process has become time-consuming and is starting to take up a lot of room in my `style.css` file. * * * Is there a way I can display a _Meta_ checkbox at the bottom of my _Gallery_ post screen, that when clicked, is able to turn off/hide the _Authors Bio_ and post _Tags_ from being displayed on the front-end? * * * For example: ![enter image description here](http://i.stack.imgur.com/wrtqX.png)


Handling duplicates with wp_insert_term()

I'm using `wp_insert_term` which works quite well Now I want some error handler for when using the same name.               $term_id = wp_insert_term( $term, 'wpsc_product_category', $args );     if($term_id) {//my operations here}      where `$term = $_POST['categoryTitle'];` I want to display some error when such name already exists. In wp_insert_term, how to check if this `$term_id` is duplicate?   I don't want to continue my operations on already existing terms.


Use date in the URL of custom post type

So I've created a custom post type, say `reviews`, and its archive is available at `<domain>/reviews/`. I want to categorize them by date. So every day (or week) I publish a `reviews` type post and I want its url to be `<domain>/reviews/2013/09/05/<post-name>`, so that users will be able to list all the `reviews` from specific year, month or day. Just like we have a similar feature for the regular posts. All the plugins I've tried are old and aren't working with WP 3.6. So is there any solution (maybe even built-in)? Or at least some direction so I can code it myself? I would appreciate any help.


How to instantly delete posts/pages permanently?

For development purpose I need to constantly fill and unfill a Wordpress instance with dummy content. Deleting everything in two steps is quite annoying, so I'm wondering if there's a way to cut the long way around to trash when deleting posts. Please help.


display post types alternately

Is there a way to sort post types alternately. So when you query two (or more, but let's take two for example) post types, is there a parameter or method wich you can use to display the results alternatly. so like this   1. post type 1 (last post from post type 1)    2. post type 2 (last post from post type 2)    3. post type 1 (forlast post from post type 1)    4. post type 2 (forlast post from post type 2) In de codex I can find nothing about this and it also seems that it is not a very common thing to do, because I can not find anything about it on the internet..


Edit body image after insertion in 3.9.1

Pre 3.9.1 when I hovered over an image in the post body I was presented with 2 buttons top left of the image. One allowed me to edit the image (size, alt, title tags etc). This has disseapred now and I can't work out how to modify the image once inserted into the body. My functions.php               function formatTinyMCE($init)     {            $init['wpautop'] = true;         $init['plugins'] = 'infographic';         $init['toolbar1'] = 'formatselect,|,bold,italic,blockquote,|,link,unlink,infographic,|,bullist,numlist,|,pastetext,removeformat,|,undo,redo';         $init['toolbar2'] = '';              $init['block_formats'] = 'Paragraph=p;Heading 2=h2;Heading 3=h3';         return $init;     }     add_filter('tiny_mce_before_init', 'formatTinyMCE' );      I tried adding `wpeditimage` to the toolbar but nothing appeared.


add_query_arg to look up page title

I'm trying to get the code below to look up the status name, i.e. _new_ , _open_ , _pending_ or _resolved_ with the word _ticket_ together to find pages called new tickets, open tickets etc.               $ticket_status = get_terms('ticket_status', 'orderby=description&hide_empty=0');     echo '
';     if ($ticket_status) : foreach($ticket_status as $status) :              if (!isset($counts[$status->slug])) :             $counts[$status->slug] = '0';         endif;         echo '
name, 'tickets').             '">'.$status->name.''.$counts[$status->slug].'
';


Is it possible to hook AJAX to UPDATE-button?

I have a site with a custom post. When I enter that custom post in admin (edit)-page then a form is rendered. This form takes like about 2-3s to render - it's a lot of of values in it - both hidden and not hidden. When I update this custom post it takes about 2 seconds to update - and after the update it redirects to the custom post and renders the form again, so overall it could take about 8-9 seconds (regeneration of menu, some other stuff that is loaded each time in the wp-admin area). My question is: Is there any way just to save post data when upate - like hooking ajax-call to UPDATE-button (I really don't have to reload the page cause it doesn't change anything)? **UPDATE:** I guess I could something like this (in jQuery)               $( '#publish' ).click( function( e ) {         e.preventDefault();         //ajax call to save current postetc.         //done = alert('post saved');     } );      but would that be right?


How do I change the location of post-specific information?

On each post page is the following information displayed: > Written by: nona   >  Date Posted: April 24th, 2013   >  Category: drawing writing reading, General   >  Comments: 3 Comments » Here is an example link. So the post info is situated in the top of the post. We would like to move it to the bottom of the post page.   How do I do this?


place a direct link to custom-stylesheet, under appearance menu in wp-admin

**FINAL UPDATE:** Updated code from @birgire solved my issue. If you are facing a similar issue, please read the accepted answer. * * * **ORIGINAL QUESTION IN DETAIL:** Currently under the appearance menu in admin, there is a link called 'editor', which when clicked leads to editable main- stylesheet, my effort is to put a link to a custom-stylesheet instead, because it is more convenient and I could save me a lot of time in the long run. This link may appear as a sub-menu item under appearance (direct link to my custom- stylesheet.css), which I tend to click more often than anything else. In effort to achieve that I followed the instructions given in this article on how to add menu items in wp and I was able to construct a code below.               add_action('admin_menu', 'add_appearance_menu');               function add_appearance_menu() {     add_submenu_page( 'themes.php', 'Custom Stylesheet', 'customstyle', 'manage_options', 'custom-style.css', '$function'); }      However, the code is still not complete as you can see I had no clue what to insert in the actual function in line 3. If you must know, the custom- stylesheet.css is in the root of theme folder and also that I am using a premium theme, but I am not sure if this is a theme level issue. This incomplete code still seems to work well otherwise, as I can see an added menu under the appearance menu. So, It does not seem absurd, what I am trying to achieve. Although it throws an invalid function error when I click the created menu link. Please give me a hint as to where I should be looking for this function.


Restrict access to content in conjunction with facebook connect & google login

I've got a page of content that I want to hide by default. We want the users wanting to see the content to be able to simply login using Facebook connect or Google logins. Since we will be using this as a source of lead gen, we'd also like to capture as much data as we can from those that login using Facebook or Google without bothering the user with it. So the two questions are:   1. Is there a good plugin to restrict content and allow users to connect with their Facebook or Google info?   2. What content will Facebook and Google allow us to see/store on our end?


How to do an event when any user updates their profile?

I want to call a function, whenever any user update their profile. How to do that?


Problem to insert links on some text in post

When i try to add a local link (toward my own pages) on some text in my post, the AJAX function run indefinitely and didn't find anything. I've opened my browser's console and i've saw the following error : **mysite.com/wp- admin/admin-ajax.php respond with a Internal Server Error**. But I never modified this file or core files in general. Is it a known bug or whatever ?


How can I change the default wordpress password hashing system to something custom?

Can I change the default wordpress password hashing system by overriding the wp_hash_password function from plugin? If yes, then what will happen to old stored passwords in DB? How will they be validated for login?


How can I display custom post types under multiple views?

I want to create custom post types with multiple views based on URL. E.g., suppose I have a "Product" post type. I would like to have something like the following:   * http://example.com/products/product_name <-- Regular view of the product/regular template   * http://example.com/products/product_name/detailed <-- Expanded view, extra info, more theme elements, widgets, etc.   * http://example.com/products/product_name/summary <-- Quick view, less info, minimal page elements   * http://example.com/products/product_name/xml <-- Content wrapped in XML I would be fine with this as well:   * http://example.com/products_xml/product_name   * http://example.com/products_detailed/product_name Is it possible to represent a page/post as different URLs, each with a different view of the same data? Would this require a lot of modification?


Admin Panel pagination link styles

Whenever I write plugins that use Admin Panels, I include some form of pagination using the `paginate_links` method and I have always been able to style them in a nice way using the suggestions on this blog post. Recently, however, I have been unable to find the secret sauce to make this work. I'm guessing it's the way the divs on my pages are set. Does anyone have the proper style declarations for using real WordPress pagination links? (Look at that site for what I'm looking for)


next_posts_link and previous_posts_link problem

Below is the code from my author.php file. The problem is that `next_posts_link` and `previous_posts_link` only generate links based on the number of posts in the blog authored by the author in question, not the number of posts in the query ( which includes pages and events). I have used WP_Query to add the custom post type 'events' as recommended here. I find this behaviour strange because the page is displaying the results of the query but the `previous/next_posts_link's` are doing something completely different. Can anyone see my mistake or is this some problem with WordPress.               <?php get_header();      // add evemts post type to query               $query = new WP_Query( array(        'post_type' => array( 'post', 'page', 'events' )        ));            if($query->have_posts()) : ?>
Posted by : author

                                                   <?php while($query->have_posts()) : $query->the_post(); ?>                         <div class="archive-post" id="<?php the_ID(); ?>">

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

Entry meta here
                         <?php the_excerpt(); ?>
                                                                                <?php edit_post_link( 'Edit', '', '' ); ?>

                              <?php endwhile; endif; ?>

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

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

                 <?php get_sidebar(); ?>
     <?php get_footer(); ?>      **EDIT** : I have just found this page detailing the problem, however after implementing the solution, while it is definitely an improvement in that the links now show, still for some reason they point me to a 404 page


Upload multiple images in a custom metabox

I am new to theme development. I am trying to create a custom metabox that has the ability to upload a image. I am doing this on a page not a post. I want to output the images (multiple) onto the page in a unordered list. I have attempted to use WP alchemy, and I can only get as far as getting the metabox to show up but I have no idea on how to output the imgurl to the page. Is there a better way to upload multiple images to a page which is easy for a client and doesn't add images to the content editor (I just think it isn't user friendly) and then output them to a page in a unordered list. Some advice please.


How to retain responsive navigation menu in twentyeleven child theme

I use TwentyTwelve as the parent theme for most of my site development. However, when i change any styling or positioning associated with the menu, the responsive nature of menu does not come into effect on small-screens. Instead, all the menu items are displayed in a vertical list. What i did: Created a new child theme Created header.php by copy pasting contents from original header.php file, Created a style.css and added style overrides here. Then i moved the site-navigation div into hgroup so that i could display menu at top, just after the logo. Tried to add some margins to .main-navigation and the menu does not fallback to responsive layout on small screen. This is how the menu looks on small screen: ![enter image description here](http://i.stack.imgur.com/OfjgC.png) Here is the header.php code:                           <?php                 /**                  * The Header for our theme.                  *                  * Displays all of the  section and everything up till
                  *                  * @package WordPress                  * @subpackage Twenty_Twelve                  * @since Twenty Twelve 1.0                  */                 ?><!DOCTYPE html>                                                                    <html <?php language_attributes(); ?>>                                                   <meta charset="<?php bloginfo( 'charset' ); ?>" />                 <meta name="viewport" content="width=device-width" />                 <title><?php wp_title( '|', true, 'right' ); ?></title>                 <link rel="profile" href="http://gmpg.org/xfn/11" />                 <link rel="pingback" href="<?php bloginfo( 'pingback_url' ); ?>" />                 <?php // Loads HTML5 JavaScript file to add support for HTML5 elements in older IE versions. ?>                                  <?php wp_head(); ?>                                       <body <?php body_class(); ?>>
                                              <hgroup>
<?php _e( 'Menu', 'twentytwelve' ); ?>
                             <a class="assistive-text" href="#content" title="<?php esc_attr_e( 'Skip to content', 'twentytwelve' ); ?>"><?php _e( 'Skip to content', 'twentytwelve' ); ?>                             <?php wp_nav_menu( array( 'theme_location' => 'primary', 'menu_class' => 'nav-menu' ) ); ?>

<?php bloginfo( 'description' ); ?>

                         </hgroup>                              <?php $header_image = get_header_image();                         if ( ! empty( $header_image ) ) : ?>                             <a href="<?php echo esc_url( home_url( '/' ) ); ?>"><img src="<?php echo esc_url( $header_image ); ?>" class="header-image" width="<?php echo get_custom_header()->width; ?>" height="<?php echo get_custom_header()->height; ?>" alt="" />                         <?php endif; ?>
      Style.css:                           /*                 Theme Name:     Bennys Salon                 Description:    Bennys Salon Child Theme                 Author:         MuMacro                 Template:       twentytwelve                      (optional values you can add: Theme URI, Author URI, Version)                 */                      @import url("../twentytwelve/style.css");                 @import url(http://fonts.googleapis.com/css?family=Acme);                 @import url(http://fonts.googleapis.com/css?family=PT+Sans:400,700italic);                           /* Fonts */                      .nav-menu{                     font-family: Acme, serif;                     color: #9C3F97;                     text-transform:uppercase;                 }                      .entry-header .entry-title {                     color: black;                     font-size: 1.57143rem;                     font-family: Acme, serif;                 }                      .entry-content p, .entry-summary p, .comment-content p, .mu_register p {                     color: black;                     line-height: 1.71429;                     margin: 0 0 1.71429rem;                 }                 /*Navigation*/                 .main-navigation li a {                     border-bottom: 0 none;                     color: #9C3F97;                     font-size: 13px;                     line-height: 3.69231;                     text-transform: uppercase;                     white-space: nowrap;                 }                      .main-navigation ul.nav-menu, .main-navigation div.nav-menu > ul {                     border-bottom: 0 solid #EDEDED;                     border-top: 0 solid #EDEDED;                     display: inline-block !important;                     margin-left: 28%;                     margin-top: 0;                     text-align: left;                     width: 100%;                 }                           /* Header */                 .site-header h2 {                     color: #9C3F97;                     font-size: 17px;                     font-weight: normal;                     line-height: 1.84615;                     font-style: italic;                     font-family: Acme;                 }                 .site-header h1 {                     font-size: 1.85714rem;                     line-height: 1.84615;                     margin-left: -27px;                 }                      .site-header {                     padding: 1% 0;                 }                           /*Navigation*/                 .main-navigation {                     margin-top: 0.714rem;                     text-align: center;                 }                      /* Content Background */                      .site{                     background: rgba(255,255,255, .5); /* Works on all modern browsers */                 }                      body .site {                     box-shadow: 37px 24px 51px rgba(205, 100, 100, 0.3);                     margin-bottom: 3.42857rem;                     margin-top: 3.42857rem;                     padding: 0 2.85714rem;                 }                      /*Footer Credits*/                      .site-info{                     float:right;                 }                      /* Font Colors */                 .site-header h2 {                     color: #9C3F97;                     font-size: 17px;                     font-style: italic;                     font-weight: normal;                     line-height: 1.84615;                 }                      /* Logo Image */                      .fplogoimg{                     height:130px;                 }                      /* Site Description*/                      .site-description {                     margin-left: 5%;                     position: relative;                 }                      /*Content Margins*/                      .site-content {                     margin: 0;                 }                      .widget-area {                     margin: 0;                 }                      body .site {                     box-shadow: 37px 24px 51px rgba(205, 100, 100, 0.3);                     margin-bottom: 1.429rem;                     margin-top: 1.429rem;                     padding: 0 2.85714rem;                 }      N.B. I am not good into HTML, CSS. I just find ways to hack a solution. Kindly help.


Using DePo Masthead with WP 3+

Does anyone have any experience with running DePo Masthead in WP3+? I'm thinking of changing the theme on my personal site and blog.


Get PHP Fatal error on globalized $wpdb: Call to a member function insert() on a non-object- I have no clue. What to do?

I am trying to utilize this function. I cannot figure out why I am still getting the PHP error. All I can figure out is that for some reason the template isn't able to access $wpdb. I don't know what line needs to be placed in the functions.php (in theme folder) file that contains this function. Please help me!!               function submitWeightUpdate( $userid, $weight ) {         global $wpdb;              $result = $wpdb->insert( 'wp_weights', array( 'user_id' => $userid, 'current_weight' => $weight ), array( '%d', '%d' ) );              if (empty($_POST['weight'])) {             $return['error'] = true;             $return['msg'] = 'You did not enter a weight.';         }         else {             $return['error'] = false;             $return['msg'] = 'You\'ve entered: ' . $weight . ' as your new weight.';         }              echo json_encode($return);     }       I also tried setting the theme to the default one and it still won't work, so I have no idea what could be wrong with it!


Pros and cons of using [taxonomy name] in place of [category name]?

We are currently in development on a new site. Categories (& tags) are pretty much meaningless for us because we've implemented custom posts & taxonomies. By default, because I have enabled pretty permalinks, if I create a post titled, "Mubarak steps down" without selecting a category, Wordpress will give me this: domain.com/uncategorized/mubarak-steps-down. Today, I installed the custom permalinks plugin which enables me to make the permalink virtually anything I want. I have a custom taxonomy called countries and one of the terms is Egypt so I re-wrote the above permalink to be domain.com/countries/egypt/mubarak-steps-down. domain.com/egypt/mubarak-steps- down would be better but there's nothing there & writing a re-direct for all countries would be a major pain. The pros, as I see them, in doing this: 1) A reader may realize that by removing the post title and re-submitting the url in the browser that they will see more content on the parent subject most relevant to the individual post, in this case, Egypt. Of course, this can also be done by making a link to the Egypt section on the page easy to see. 2) I think* it could be an effective white hat SEO strategy for communicating something more relevant in the url than 'uncategorized' or something else generic like 'events' or 'news.' What are the pros and cons of doing this with respect to WP database performance, etc.?


Ajax in wordpress

I tried to write ajax with jquery to fetch data from database butajax doesn't return any data. I put that code in header and it return the whole html content in response. What is the code need to write in admin-ajax.php to use ajax?


Content not retrieving on .load jQuery function

I`m trying to get posts from a wordpress query_posts external php file via .load jquery function. I`m getting the correct html code, but the wordpress loop part of the code is not loading. My code is: HTML:

      JQUERY:                         EXTERNAL FILE:
Temakis
          <?php     $args = array(         'post_type'      => 'post',         'category_name' => 'temakis');     query_posts($args);     while (have_posts()) : the_post();     ?>
       <img src="<?php the_field("imagem-produto");?>" width="150" height="150" title="<?php echo get_the_title(); ?> "/>

<?php echo get_the_title(); ?>

<? echo get_post_field('post_content'); ?>

R$ <? the_field("preco"); ?>

          <?php endwhile; ?>     <?php wp_reset_query(); ?>      The request is ok, because i`m getting the h3 correctly. Can anyone help me? Thanks!


What is the right way to include my Ajax script in wordpress

I've searched around for a solution to my issue to no avail. So here it is: I have created custom meta fields in the user section within the admin area. There are two fields in total, both select boxes. The first select box loads countries from a csv file, the second loads companies from the country selected in the first select box. I wrote and tested a script on my server which worked fine but when I transferred to my wordpress website things didn't go as planned. Which is probably due to my lack of knowledge using ajax in wordpress! (and ajax in general) Here is my process. I copied my javascript and ajax code directly into my functions.php within the function that creates the meta fields for users:               <?php                  <script language="javascript" type="text/javascript">                 <!--                  //Browser Support Code                 function ajaxFunction(){                   var ajaxRequest;                                       try{                     // Opera 8.0+, Firefox, Safari                     ajaxRequest = new XMLHttpRequest();                   } catch (e){                     // Internet Explorer Browsers                     try{                       ajaxRequest = new ActiveXObject("Msxml2.XMLHTTP");                     } catch (e) {                       try{                         ajaxRequest = new ActiveXObject("Microsoft.XMLHTTP");                       } catch (e){                              alert("failed");                         return false;                       }                     }                   }                   // Create a function that will receive data sent from the server                   ajaxRequest.onreadystatechange = function(){                     if(ajaxRequest.readyState == 4){                            //alert(ajaxRequest.responseText);                       //alert(getValue);                       document.getElementById("operator").innerHTML = ajaxRequest.responseText;                          }                   }                        var list = document.getElementById("countries");                   var getValue = getOperatorList(list);                        ajaxRequest.open("GET", "<?php echo get_template_directory_uri(); ?>/ajaxCompanies.php?o=" + getValue, true);                   ajaxRequest.send(null);                  }                      function getOperatorList(sel)                 {                     getValue = sel.options[sel.selectedIndex].text;                     return getValue;                 }                 //-->                 </script>     ?>      Then I added an onChange event to my select tag which is also in my functions.php file I'm showing just the tag but this sits within the meta fields function as well:               <select id="countries" name="opp_country" value="<?php echo esc_attr(get_the_author_meta( 'opp_country', $user->ID )); ?>" class="regular-text" onChange="ajaxFunction();" >      The above javascript/ajax snippet refers to this file when an option is selected: ajaxCompanies.php Here are that file's contents:                   <?php           //This hooks in my classes which consists of the database connection class and the                //csv parser class          require_once(TEMPLATEPATH."/includes/initialise.php"); ?>         <?php              //Creates an instance of the csv object              $csv = new parseCSV();              //Gets the name of the file from the database              $csv_query = "SELECT * FROM csv_files LIMIT 1";         $csv_file = Csv::find_by_sql($csv_query);                  $csv_file_filename = $csv_file[0]->filename;                  //Loads the file name             $csv->auto('csv/'.$csv_file_filename);                  $value_array = $csv->data;                         $number = count($value_array);         //Puts the operators(companies) from selected country into an array         if(isset($_GET["o"])) {                      for ($c=0; $c < $number; $c++) {                   if($_GET["o"] == $value_array[$c]['Country'])                   $operators[] = $value_array[$c]['Operator'];                 }                    }              ?>              //Outputs the operators(companies) in option tags              <?php                   for ($i = 0; $i < count($operators); $i ++) {               if (isset($operators[$i])) {                         echo("<option value='" . $operators[$i] . "'");                         if ($operators[$i] === $selected_operator) {                             echo(" selected='selected'");                         }                         echo(">" . $operators[$i] . "</option>");                     }               }                 ?>      So the issues are, `TEMPLATEPATH` isn't doing anything which means I don't have access to the classes necessary for me to get this working. I tried switching to absolute paths but when I do that nothing happens. The csv file doesn't get read and I can't access my databases. I get database connection errors. I know there is a better way to this but anything I find on the net refers to using ajax with plugins and with jQuery. If anyone can clue me in on the best way to achieve what I'm trying to do or point me in the right direction that would be great!


How to create query to get top 3 sticky/latest posts

I hope I will make sense, and if you have a better suggestion please let me know. I am just starting WordPress I want to layout my theme such that I get 3 sticky, not more than 1 month old, or latest posts at the top. Then render the rest of the posts latest 1st below. A picture (below) will explain better I hope. I think I will need custom queries, how might I achieve that ![](http://imgur.com/dK2vt.jpg)


How can I fetch loop of post titles via AJAX?

I have a list of the most recent post titles in `sidebar.php`. Here is an example of how that code looks:               <?php $args = array('posts_per_page' => 20); ?>     <?php $sidebar = new WP_Query($args); ?>     <?php if ( $sidebar->have_posts() ) : ?>     <?php while ( $sidebar->have_posts() ) : $sidebar->the_post(); ?>
     <a href="<?php the_permalink(); ?>" title="<?php the_title(); ?>">       <?php the_title(); ?> - <?php the_time("F j, Y h:i A"); ?>
          <?php endwhile; ?>     <?php endif; ?>      That part works perfectly. It displays the 20 latest post titles and post times wrapped in permalinks. However, I am trying to do a bit more. I want to create a load more button at the bottom to fetch the next 20 post titles. I know my jQuery and that is not the issue. I need help with figuring out how to create a custom loop in a new custom `.php` template file that only generates the html above. That file needs to be able to accept a parameter for a page number, so that my `javascript` can fetch an incremented URL each time. I would appreciate any help, thanks!


Redirecting search to specific templates with $_GET["post_type"]

I'm using `$_GET["post_type"]` to direct my search to the correct templates and have used the following:               <?php $search_refer = $_GET["post_type"];     if ($search_refer == 'news') { load_template(TEMPLATEPATH . '/search-news.php'); }     elseif ($search_refer == 'members') { load_template(TEMPLATEPATH . '/search-members.php'); }; ?>      I need to add another `elseif` to this where the search refer is news but the posts have the status "future". Is it possible to do that? The current news search refer needs to only show posts with the status "published".


Performance and styles not working fine after changing permalink structure

Fist I was using default option of permalink and everything was fine (speed is ok, my own created theme is working fine) but now I change default structure to post name structure of permalink now I am not getting 404 error but the problems are : 1 - Whole website is loading very slow (pages,post) . 2 - My custom theme is not working fine means styles are not working on single page or single post. I checked my .htaccess file where the code is :               # BEGIN WordPress     <IfModule mod_rewrite.c>     RewriteEngine On     RewriteBase /wordpress_1/     RewriteRule ^index\.php$ - [L]     RewriteCond %{REQUEST_FILENAME} !-f     RewriteCond %{REQUEST_FILENAME} !-d     RewriteRule . /wordpress_1/index.php [L]     </IfModule>          # END WordPress      **Note** : wordpress_1 is directory name.


list taxonomy based on taxonomy

Please, someone can help?! I'm fighting with this for weeks and nothing.... I'm quite new in wordpress and php... There is a way to list taxonomy terms based on another taxonomy? OR If is possible to list taxonomies based on post category. BUT, I'm doing this on homepage, not post page... The function above retrieve my **all** my taxonomy terms, but how or where filter this?               function dox_get_list_terms( $taxonomy = 'category', $term_id, $number, $orderby = 'ID', $order = 'ASC', $hide = '0' ) {                          global $dox_options;                  $terms = array();             $terms = explode(',', $term_id);             $count = count( $terms );                  $output = '';             foreach( $terms as $term ) {                 if ($term >= 0) {                     $options = get_terms( $taxonomy, 'number='.$number.'child_of='.$term.'&parent='.$term.'&hide_empty='.$hide.'&hierarchical=1&depth=1&orderby='.$orderby.'&order='.$order );                     if (! is_wp_error($options) ) {                         foreach ($options as $option) {                             $output .= '<li>'. $option->name .'</li>';                             }                         }                     }                 }             }                  return $output;     }


Outside the loop Category name with link

I want to display the category Name by using category ID with link to category page (out side the loop). here is my code...               <a href="<?php get_category_link('23'); ?>"><?php echo get_the_category_by_id(23); ?>      it's ok, but only think is it's go to home page... instead of category page... something missing... which i'hv not understand...


Optimize shortcode callbacks

I created a plugin to add some shortcodes in my WordPress site. But I'm a PHP newbie, so I believe it may have some errors or ways to optimize it. It's working fine, and apparently there are no problems. Memory usage is at 00.04MByte. Could you please take a look? Thank you very much!               add_action( 'wp_enqueue_scripts', 'prefix_add_my_stylesheet' );              function prefix_add_my_stylesheet() {             // Respects SSL, Style.css is relative to the current file             wp_register_style( 'prefix-style', plugins_url('style.css', __FILE__) );             wp_enqueue_style( 'prefix-style' );         }          /* Adsesnse Shortcode */     function get_adsense($atts) {         return 'THE_ADSENSE_SCRIPT_GOES_HERE     ';     }     add_shortcode('adsense', 'get_adsense');          /*Padding Shortcodes*/      function get_pad5($atts) {         return '

';     }     add_shortcode('pad5', 'get_pad5');          function get_pad10($atts) {         return '

';     }     add_shortcode('pad10', 'get_pad10');          function get_pad20($atts) {         return '

';     }     add_shortcode('pad20', 'get_pad20');          function get_pad25($atts) {         return '

';     }     add_shortcode('pad25', 'get_pad25');          function get_pad50($atts) {         return '

';     }     add_shortcode('pad50', 'get_pad50');          function get_pad75($atts) {         return '

';     }     add_shortcode('pad75', 'get_pad75');          function get_pad100($atts) {         return '

';     }     add_shortcode('pad100', 'get_pad100');          function get_clr($atts, $content=null) {          return '
' . $content . '
';     }     add_shortcode( 'clr', 'get_clr' );          /* Alert Boxes */     function get_alertblue($atts, $content=null) {          return '
' . $content . '
';     }     add_shortcode( 'alertblue', 'get_alertblue' );          function get_alertgreen($atts, $content=null) {          return '
' . $content . '
';     }     add_shortcode( 'alertgreen', 'get_alertgreen' );          function get_alertyellow($atts, $content=null) {          return '
' . $content . '
';     }     add_shortcode( 'alertyellow', 'get_alertyellow' );          function get_alertred($atts, $content=null) {          return '
' . $content . '
';     }     add_shortcode( 'alertred', 'get_alertred' );          function get_alertgray($atts, $content=null) {          return '
' . $content . '
';     }     add_shortcode( 'alertgray', 'get_alertgray' );          /* Style Boxes */          function get_stylegreen($atts, $content=null) {          return '
' . $content . '
';     }     add_shortcode( 'stylegreen', 'get_stylegreen' );          function get_styleblue($atts, $content=null) {          return '
' . $content . '
';     }     add_shortcode( 'styleblue', 'get_styleblue' );          function get_styleyellow($atts, $content=null) {          return '
' . $content . '
';     }     add_shortcode( 'styleyellow', 'get_styleyellow' );          function get_stylered($atts, $content=null) {          return '
' . $content . '
';     }     add_shortcode( 'stylered', 'get_stylered' );          function get_stylegray($atts, $content=null) {          return '
' . $content . '
';     }     add_shortcode( 'stylegray', 'get_stylegray' );          function get_stylewhite($atts, $content=null) {          return '
' . $content . '
';     }     add_shortcode( 'stylewhite', 'get_stylewhite' );


Showing user ID on user main page from screen options

On the user main page in the screen options, you have some choices for displaying user information e.g.. e-mail, role, posts etc.. Is there a way to be able to display the user's unique ID?


Get List of all the Authors

How could i get List of all the Authors? author.php file shows the Information about Individual Author. for example: http://domain.com/author/bj that returns the Bj's Profile. if i enter http://domain.com/author it returns **404 Not Found** Author page shows author's avatar, Author's Name and description. how can i list out all the authors? Need Help!


Extending Widgets - Exclude # of posts field from Recent Posts Widget

I am currently using this code to extend WP_Widget_Recent_Posts, but I would like to exclude the field that gives the user the ability to show how many posts they want. I have a set number in my custom query to 4, so this box is useless and I don't want to confuse the user.               class JA_Recent_Work_Widget extends WP_Widget_Recent_Posts {          function __construct() {         $widget_ops = array('classname' => 'recent_work', 'description' => 'This widget will display 4 of your most recent works in the ART category Jay.');         $this->WP_Widget('ja_recent_work', 'Jay Alders Recent Work', $widget_ops);     }          function widget($args, $instance) {              extract( $args );              if( empty( $instance['number'] ) || ! $number = absint( $instance['number'] ) )                     $number = 10;              $title = empty($instance['title']) ? ' ' : apply_filters('widget_title', $instance['title']);             $r = new WP_Query('category_name=art&posts_per_page=4');             if ($r->have_posts()) :         ?>             <?php echo $before_widget; ?>             <?php if ($title) echo $before_title . $title . $after_title; ?>
             <?php while ($r->have_posts()) : $r->the_post(); ?>
<a href="<?php the_permalink() ?>" title="<?php echo esc_attr(get_the_title()); ?>"><?php echo the_title(); ?>             <a href="<?php the_permalink() ?>"><?php echo the_post_thumbnail(); ?>
             <?php endwhile; ?>
             <?php echo $after_widget ?>              <?php                     wp_reset_postdata();             endif;     }     }      function my_recent_widget_registration() {        unregister_widget('WP_Widget_Recent_Posts');        register_widget('JA_Recent_Work_Widget');     }        add_action('widgets_init', 'my_recent_widget_registration');


add_action in class and use it in theme

I'm programming a plugin in Wordpress and want to access some database functions with in my theme with the do_action feature. First I just included $fdb-> get_finaboo_footer(1); on my page for example but he couldnt find the object. I added global $fdb; Then it worked. But I dont want to globalize on every php file the $fdb. So I thought I do it with the do_action feature. The Problem is I just get "null" in my var dump.               <?php     /**     * Database Functions     */          class fdb {         public function __construct() {             global $wpdb;             $this->wpdb = &$wpdb;             add_action('finaboo_footer', array ( &$this, 'get_finaboo_footer'));         }                   public function get_finaboo_footer($footer_id) {             $sql =  $this->wpdb->prepare( "SELECT * FROM wp_finaboo_content_footer WHERE footer_id = '$footer_id' ORDER BY option_id ASC;" );             $results = $this->wpdb->get_results($sql, ARRAY_A );             return($results);         }     }          $fdb = new fdb();          ?>      And this would be my call in the theme php files:               <?php $footer1 = do_action('finaboo_footer', '1'); ?>      don't know why it dosent work :( Also I'm open for suggestions if this is not the smartest way in Wordpress :) Thanks for help


Conditional tag affecting taxonomy term and its children?

I am wondering how can I write a conditional tag that affects a custom taxonomy slug and its children? Found this in Wordpress Codex:               is_tax( 'flavor', 'mild')       > When the archive page for the flavor taxonomy with the slug of 'mild' is > being displayed. However with this code only 'mild' slug archive page is affected and not it's children taxonomy terms. Thanks!


Setting up a wordpress network with third level domains

I've been looking into setting up a WordPress network install. Everything has been going pretty smoothly until I get to the point where my desired domain layout doesn't fit well. I would like to have a layout as follows: blog.*.stackexchange.com so for example, I would like to have multiple sites in a network that look like: blog.wordpress.stackexchange.com   blog.apple.stackexchange.com   blog.$site.stackexchange.com I _think_ I could get this working with some creative re-write rules, and manual DNS intervention but I'd rather have a setup where I can hand off the creation of everything but the DNS to someone else (we already have a process for automatically creating all sub-domains needed in DNS) From my playing around and reading WP _really_ wants the sites to be the next level domain, so in my above example, it wants the main WP blog to be at stackexchange.com and the network blogs to be at wordpress.stackexchange.com. Is there any way to achieve my desired effect or should I just go the route of doing blog.stackexchange.com/$site ?


How to fix 404 page error on theme

I am using the MidMo Clean theme and for some reason the 404 error page isn't working. Parse error: syntax error, unexpected T_STRING in /home/wpversec/public_html/UXJobsLA.com/wp-content/themes/clean-home/404.php on line 14 http://uxjobsla.com/error Short of me disabling all my plugins and re-installing a out of the box version of the theme, anyone have any ideas please? Thanks!


Adding some HTMl code as posts doesn't work but it does if it is added directly in the file?

I had some code in a template file. When I pasted it from the backend's post panel (HTML tab) as a post, and retrieved it as custom loop, the code didn't output well. Any suggestions? Adding them as posts:               <?php     /**      * Template Name: Lyrics Page      * @package WordPress      * @subpackage Prominent      * @since Prominent 1.0      */     get_header(); ?>

             <?php // Run main loop (The Loop). ?>             <?php if ( have_posts() ) while ( have_posts() ) : the_post(); ?>

             <?php endwhile; ?>

                 <?php $custom_posts = new WP_Query(); ?>                 <?php $custom_posts->query('category_name=Lyrics'); ?>                 <?php while ($custom_posts->have_posts()) : $custom_posts->the_post(); ?>                     <?php the_content(); ?>                 <?php endwhile; ?>

             <?php get_sidebar(); ?>

     <?php get_footer(); ?>      Directly on the file:               <?php     /**      * Template Name: Lyrics Page      * @package WordPress      * @subpackage Prominent      * @since Prominent 1.0      */     get_header(); ?>

             <?php // Run main loop (The Loop). ?>             <?php if ( have_posts() ) while ( have_posts() ) : the_post(); ?>
                 <?php the_content(); ?>
             <?php endwhile; ?>

                             There is one obvious advantage:

                                     You've seen it coming!
                                     Buy now and get nothing for free!
                                          Well, at least no free beer. Perhaps a bear,
                                     if you can afford it.

                             Now that you've got...

                                     your bear, you have to admit it!
                                          No, we aren't selling bears.

                             Rent one bear, ...

                                     get two for three beer.

                                          And now, for something completely different.
                                     And now, for something completely different.
                                     And now, for something completely different.
                                     And now, for something completely different.
                                     And now, for something completely different.
                                     And now, for something completely different.
                                          And now, for something completely different.
                                     And now, for something completely different.
                                     Period.

             <?php get_sidebar(); ?>

     <?php get_footer(); ?>      Output of the post when I add via admin panel:               <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"         "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">                      <meta name="generator" content=       "HTML Tidy for Linux/x86 (vers 11 February 2007), see www.w3.org" />            <title></title>

                 There is one obvious advantage:

You’ve seen it coming!

                   Buy now and get nothing for free!

Well, at least no free beer. Perhaps a bear,

                   if you can afford it.

Now that you’ve got…

your bear, you have to admit it!

No, we aren’t selling bears.

Rent one bear, …

get two for three beer.

And now, for something completely different.

                   And now, for something completely different.

                   And now, for something completely different.

                   And now, for something completely different.

                   And now, for something completely different.

                   And now, for something completely different.

And now, for something completely different.

                   And now, for something completely different.

                   Period.


Limit Amount of Pages users can create in Custom Post Types

Is there a way to limit how many pages a user can make inside a custom post type? This would be pretty effective for commercial WP plugins and I am making one, but have come across a little problem and I would need to figure out how to do this. Thanks.


Is codex right on deleting post?

The codex has this to say on wp_delete_post. > When the post and page goes, everything that is tied to it is deleted also. > This includes comments, post meta fields, and terms associated with the > post. Which kind of suggests that if a post that had the tags a,b,c attached to it gets deleted, then, all the a,b and the c tags are also deleted from the wp_terms, and wp_term_taxonomies tables **even if those tags were to be associated with some other living posts!*** - which I doubt is the case. Why would WP API delete the terms that are working for some other posts?


Test site pages go to main site

I have a test site installed on www.mydomain.com/testsite. The problem I have is that if I type in the url www.mydomain.com/testsite/about I get redirected to www.mydomain.com/about. My page for my test site gives me the permalink: www.mydomain.com/testsite/about If I click View Page from the page editing screen in the dashboard, I get redirected to www.mydomain.com/about instead of being sent to the permalink. My htaccess file is located in my root folder and is as follows:               # BEGIN WordPress     <IfModule mod_rewrite.c>     RewriteEngine On     RewriteBase /     RewriteRule ^index\.php$ - [L]     RewriteCond %{REQUEST_FILENAME} !-f     RewriteCond %{REQUEST_FILENAME} !-d     RewriteRule . /index.php [L]     </IfModule>          # END WordPress          ErrorDocument 404 /404.php          <Files delete.php>     order allow,deny     deny from all     </Files>      Can anyone help?


get_categories listing foreach with children

My code for loop of categories               <?php     $categories = get_categories('hide_empty=1&exclude=1&orderby=slug&order=ASC');     foreach ($categories as $category) {         echo '
cat_ID.'">';         echo 'slug.'">';         echo $category->cat_name;         echo "";         echo ' ('.$category->category_count.')';         echo '
';     }     ?>      Preview the code above:

Category one

Category two

CHILDREN OF Category third

Category third

      I would like to stay:

Category one...

Children primary of Category one

Children second of Category one

Children third of Category one

Category two...

Category third...

Children primary of Category third

Children second of Category third

Children third of Category third

      understand?


Multiple versions of RSS feed? One with full content, one with the excerpt

I'm not sure how to word my question and I have been searching all day, to no avail. I am looking for a method to create two versions of my RSS feeds, one with the full content and one with only the excerpt. Mainly, I want to do this for the "Author" feeds. I would like two feeds created for each Author. One with the full content and one with the excerpt. If nothing else, I would like the author RSS feed to only have excerpts, but the main website RSS feed must ALWAYS be a full content feed. The reason? The website in question is a sports website. I want to offer the RSS in full content for those who want it, but I also automatically post my own articles on my personal website (a few others do as well). When the article is posted to my own website, I want to only include the excerpt, with a link to the full original article. I do not care the method used, whether code or plugin. **UPDATE** I have been working to try to get the methods described by Michael Ecklund and Ian Dunn to work. I have not been able to get either to work. Both methods still show the complete article in the RSS feed and not the excerpt. I'm not sure if it makes a difference, but I just remembered I use the Advanced Excerpt plugin to manage the excerpts on my website. I have not tried disabling this plugin, as it controls the homepage, category pages, tags pages, author pages and more.


On this day PHP code

I'm working with this code snippet for an "on this day" type post. However it is only showing 1 year in the past. I'm looking to automate this so it shows on this day in 2009, 2010, 2011... and as the years advance, keep these years showing. With the way it's written as a -1, -2, it will be a dynamic "year ago" rather than a static "in 2009". Is there a way to automate this to go back 2, 3 4 years without having to duplicate the code for (-2, -3, -4, etc)?               function on_this_day() {     $on_this_day = get_posts('year='.(date('Y')-1).'&monthnum='.date('n').'&day='.date('j'));     if( $on_this_day ) {         echo '';         echo 'On this day in '.(date('Y')-1);         echo '';     } else {         echo ''.'On this day in '.(date('Y')-1).'';     }


Fatal error: Call to undefined function term_exists()

In Which version of WordPress did term_exists() first appear?


Getting taxonomy terms used by custom post type

I have a custom post type - **case** - for which I am building an archive page. There are three custom taxonomies for this type - **micro_organisms** , **infection_types** , and **antibiotic_types**. These taxonomies are hierarchical, and have a variety of terms, up to three levels deep. For the given post type, I'm wanting to list terms for, say, the **antibiotic_types** taxonomy, that are used by any **case** entries. While a term within the **antibiotic_types** taxonomy may be used by any of the **case** entries, I want to show the hierarchy leading to the selected term. So far, I've got the following working, which results in a flat list of just the selected terms, not reflecting the hierarchy the terms are in.               // sourced from:     // http://wordpress.stackexchange.com/questions/66015/how-to-get-a-list-of-taxonomy-terms-which-are-being-used-only-within-certain-pos     function get_terms_by_post_type( $taxonomies, $post_types ) {         global $wpdb;         $query = $wpdb->get_results( "SELECT t.*, COUNT(*) AS count from $wpdb->terms AS t INNER JOIN $wpdb->term_taxonomy AS tt ON t.term_id = tt.term_id INNER JOIN $wpdb->term_relationships AS r ON r.term_taxonomy_id = tt.term_taxonomy_id INNER JOIN $wpdb->posts AS p ON p.ID = r.object_id WHERE p.post_type IN('" . join( "', '", $post_types ) . "') AND tt.taxonomy IN('" . join( "', '", $taxonomies ) . "') GROUP BY t.term_id");         return $query;     }     ?>     ...
     <?php     $terms = get_terms_by_post_type(array($tax), array('case'));          foreach ($terms as $term):         $termData = get_term_by('id', $term->term_id, $tax);         $termName = $termData->name;         $termUrl = get_term_link($termData);     ?>
<a href="<?php echo $termUrl; ?>?post_type=<?php echo $type; ?>"><?php echo $termName; ?> (<?php echo $term->count; ?>)
     <?php     endforeach;     ?>
      The output resembles:   * penicillin-g   * ceftriaxone   * amphotericin-b   * 5-flucytosine While the desired output is:   * beta-lactams      * cephalosporins        * ceftriaxone     * penicillins        * penicillin-g   * antifungals      * amphotericin-b     * 5-flucytosine I've also tried using the following:               wp_list_categories(         array(             'taxonomy' => 'antibiotic_types',             'hierarchical' => 1,             'hide_empty' => 1,             'title_li' => ''         )     );      Which shows _all_ of the terms for the given taxonomy, even those not used by any **case** entries. Having browsed the function reference, it doesn't look as if there is any built-in function for doing what I want to achieve, not directly anyway. I haven't done much with taxonomy queries until now. Any suggestions?


WP_Remote_Get feed from .php file

I have a bunch of wordpress sites which sit on different domains, and I want to track all the user data on one central site. I wrote a simple file for each wordpress site to display user counts in an xml file called `userxml.php` and uploaded it to my different site directories:               <?php     /* Open API */     $secretcode = 'mysecretcode1234';     if ($_POST['secretcode'] == $secretcode || $_GET['secretcode'] == $secretcode) {     define('WP_USE_THEMES', false);     require('wp-blog-header.php');     /* Variables */     $pending = count(get_users( array( 'role' => 'pending' ) ));     $subscriber = count(get_users( array( 'role' => 'subscriber' ) ));     $editor = count(get_users( array( 'role' => 'editor' ) ));     $author = count(get_users( array( 'role' => 'author' ) ));     $administrator = count(get_users( array( 'role' => 'administrator' ) ));     /* Start XML */         header("Content-type: text/xml");         $xml_output = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n";         $xml_output .= "<mysiteapi>\n";         $xml_output .= "<pending>".$pending."</pending>\n";         $xml_output .= "<subscriber>".$subscriber."</subscriber>\n";         $xml_output .= "<editor>".$editor."</editor>\n";         $xml_output .= "<author>".$author."</author>\n";         $xml_output .= "<administrator>".$administrator."</administrator>\n";         $xml_output .= "</mysiteapi>";         echo $xml_output;     /* Close API */     } else {         echo 'you are not supposed to be here, sad face :-(';     }     ?>      which outputs xml which is great and exactly what I need, but i can't seem to pull the data from the xml file because my xml data is in a php file. So far I've tried using both `fetch_feed()` and `wp_remote_get` like               <?php     define('WP_USE_THEMES', false);     require('wp-blog-header.php');          if (!file_exists('wp-blog-header.php')){      echo 'no file';     }          $url = 'http://www.mysite.com/mysiteapi.php?secretcode=mysecretcode1234';          $response = wp_remote_get($url);     $xml  = simplexml_load_string($response);     echo $xml->mysiteapi->pending;          echo $xml;      I used `fetch_feed()` and tried to echo out the items with a foreach loop with no success. Anyone have an idea on how I could retrieve simple statistics from one wordpress site into another? Or do I need to use php to create an actual `.xml` or `.html` file to read? Thanks


Is there any necessary to use tag plugins like simple tagging in wordpress 3.0+

As there is tagging feature built-in wordpress already, but why so many people recommend "simple tagging" plugin. Now i just need a feature of tags link. Is there the built-in a easy way to implement it by built-in tag system? I often feel confused there are two places to input tags before my eye when editing post. And i'm afraid my tags will lost if one day i do not use this plugin anymore for some reasons


How to expand picture to cover entire header area? (twenty-twelve theme)

I am running twenty-twelve theme and have applied a header background on the .site-title class. Header shows up but it's width is only 960px. How do I disable the left and right margins/padding of this theme so I can expand the picture to cover entire header area? ( I don't know what css code to add) Here's a picture if it makes more sense: http://imgur.com/yBdPmRT Thank you in advance!


How to get latest post excerpt from a specific category?

I'm working on a theme homepage and would like to include an excerpt from the latest post in a specific category. In this case, the category slug is "gear". I've tried a couple options with `WP_Query` but am unable to get it to return only one post. Here's my current code:               <?php $latest1 = new WP_Query();     $args=array('category_name=gear','posts_per_page=1');     $latest1->query($args);     while ($latest1->have_posts()) : $latest1->the_post(); ?>
<a href="<?php the_permalink() ?>"><?php the_title(); ?>

     <?php the_excerpt(); ?>
     <?php endwhile; wp_reset_query(); ?>      There are currently two posts in the "gear" category, and both are being returned. I must be misunderstanding the posts_per_page option. If there's a better way to do this than WP_Query (making this call three times on the page, once for each category), I'm open to that as well.


Additional form options based on category selected not working

I have a conditional statement to show certain images to choose from (radio buttons) based on the category chosen, however when the category is chosen, the radio buttons don't show? What am I doing wrong?                   <fieldset class="category">                                  Post Category:                                  <?php wp_dropdown_categories( 'tab_index=3&taxonomy=category&hide_empty=0' ); ?>                      </fieldset>     <?php $categoryId = $_POST['cat']; ?>         <?php if ($categoryId == '3') { ?>                         <fieldset class="cat1">                              Please choose from 1 of the images below for your Post:
         <input type="radio" name="hate" value="<?php bloginfo('url'); ?>/wp-content/uploads/2012/08/hate1.jpg" id="hate1" /> <img src="<?php bloginfo('url'); ?>/wp-content/uploads/2012/08/hate1.jpg" alt="" height="167" />
         <input type="radio" name="hate" value="<?php bloginfo('url'); ?>/wp-content/uploads/2012/08/hate2.jpg" id="hate2" />          <img src="<?php bloginfo('url'); ?>/wp-content/uploads/2012/08/hate2.jpg" alt="" height="167" />                         </fieldset>              <?php } elseif ($categoryId == '4') { ?>                         <fieldset class="cat2">                              Please choose from 1 of the images below for your Post:
         <input type="radio" name="love" value="<?php bloginfo('url'); ?>/wp-content/uploads/2012/08/love1.jpg" id="love1" /> <img src="<?php bloginfo('url'); ?>/wp-content/uploads/2012/08/love1.jpg" alt="" height="167" />
         <input type="radio" name="love" value="<?php bloginfo('url'); ?>/wp-content/uploads/2012/08/love2.jpg" id="love2" /> <img src="<?php bloginfo('url'); ?>/wp-content/uploads/2012/08/love2.jpg" alt="" height="167" />                          </fieldset>               <?php } else echo 'Damnit!'; ?>


Modify text after post count

On my Archives page, I list categories with post counts. I've modified the post count by removing the parentheses, wrapping them in a span that floats them to the right, and putting the word "Entries" after each post count. But I'd like the text after the count to change for categories with only a single post (i.e. "Entry" instead of "Entries"). My current code for this is:               <?php     $variable = wp_list_categories('title_li=&echo=0&show_count=1');     $variable = str_replace( '(', '', $variable);     $variable = str_replace( ')', ' Entries', $variable);     echo $variable;     ?>      How can I modify this so that categories with 1 post say "1 Entry" and those with more than 1 say "X Entries"? You can see my Archives page here


Display featured image file size, extension, filename, type, orientation?

How to display some information of featured image in post. I need to display: **1.** a. **Image file size (in kb or MB)** b. **Image type (.jpg,.gif...)** , c. **Bare image name, with and/or without image extension (some-image-file- name.jpg)**. Also, if it possible it would be nice to show this too: d. orientation of image (landscape, portrait) Maybe it will be helpful if I say that I do not have any image in post content, only as featured image. It would be great to have separate functions to display that info of "medium" and image in "full" size, or at least of "full" size. _Could you please give me some functions which I can put in my theme files to display that info of featured image?_ **2.** I managed to show image title, caption and description of featured post image with: `echo get_post(get_post_thumbnail_id())->post_title; echo get_post(get_post_thumbnail_id())->post_excerpt; echo get_post(get_post_thumbnail_id())->post_content;` _But, how to show image alt ("Alt Text") of featured image?_


How to show comments for a specific category of posts with a shortcode

Referring to this post category specific comments here Display category- specific comments in sidebar I need to ask 2 further related questions. 1/ Is this code still valid for WP3.9? 2/ How can I use this method so that I can create a page using a shortcode rendering a list of comments belonging to posts in any specific category 3/ with excerpt linking to the comment single post 4/ with comment excerpt of 'x' character/ words 5/ with shortcode that allows cat ID/slug to be called per iteration of the shortcode used on other pages Thank-you.


Using get_query_var() from a plugin

I'm trying to do a redirect feature in a plugin and i have an issue. First, the code:               add_action( 'init', function(){         add_rewrite_rule( 'go/([^/]+)/?$', 'index.php?redirect_to=$matches[1]', 'top' );         add_rewrite_tag( "%redirect_to%", '([^&]+)' );`     } );      Ok, so, the rule is set. The tag is set. If i'm using `get_query_var('redirect_to')` inside of `functions.php` (or anywhere in the theme actually) it works, but if i'm trying to use the same query var from the plugin files, it silently fails. And since it's a plugin, there is no way to ask users to edit their themes :) Things i did:   * i'm using it inside of `init` hook set as priority 999   * it works if i use `wp_head` instead of `init`, but this way i can't do the redirect anymore   * i flushed rewrite rules So, my question is: how do i use the damn `get_query_var('redirect_to')` inside of my plugin files? Thanks!


Changing the search URL?

I want to change the search URL from `example.com/search/keyword` to `example.com/result` or `topic/keyword`.


How to show certain data on certain interval of period

I have three sets of period of time, each with several interval of date: Event A   Jan 1 - March 1   Dec 1 - Dec 31 Event B   Mar 2 - April 15   Jun 1 - Jul 15   Sept 1 - Oct 15   Event C   Apr 16 - May 31   Jul 16 - Aug 31   Oct 16 - Nov 30   I really would like to know how to show a custom field if today's date is fall between a certain period. Say today is April 22, then custom field to show is "Event C". Really appreciate if someone can help me resolve this issue.


Custom Taxonomy - Archive for the whole Custom Taxonomy (and not just single term)?

My question/problem is probably unclear/confusing, so here's an example what I would like to do. I have a custom post type for recipes and a custom taxonomy for ingredients. The following url works just fine: mywebsite.com/recipes/ingredients/fish/ Now what I would like to have is something like mywebsite.com/recipes/ingredients/ to show a list of the different taxonomies (ingredients). But I just get a 404. Somebody had a similar problem here: Creating a page for custom taxonomy archive and solved it by creating a page. I've created a "recipes" and "ingredients" page, but still get a 404 error when opening the "/recipes/ingredients" page (guess some sort of conflict due to the same slugs). I've also tried the different options of the template hierarchy (http://codex.wordpress.org/images/1/18/Template_Hierarchy.png), but hadn't any luck so far. I'm not sure if it can work at all, because there's no standard "/category/" page in wordpress either. But maybe there's a way? The code looks as follows:               // Register Custom Taxonomy     function ingredients() {          $labels = array(         'name'                       => _x( 'ingredients', 'Taxonomy General Name', 'text_domain' ),         'singular_name'              => _x( 'ingredient', 'Taxonomy Singular Name', 'text_domain' ),         'menu_name'                  => __( 'ingredients', 'text_domain' ),         'all_items'                  => __( 'All ingredients', 'text_domain' ),         'parent_item'                => __( 'zz ingredient', 'text_domain' ),         'parent_item_colon'          => __( 'zz ingredient:', 'text_domain' ),         'new_item_name'              => __( 'new ingredient', 'text_domain' ),         'add_new_item'               => __( 'ingredient hh', 'text_domain' ),         'edit_item'                  => __( 'ingredient bb', 'text_domain' ),         'update_item'                => __( 'ingredients bb', 'text_domain' ),         'separate_items_with_commas' => __( 'ingredients sep', 'text_domain' ),         'search_items'               => __( 'ingredients search', 'text_domain' ),         'add_or_remove_items'        => __( 'ingredient add delete', 'text_domain' ),         'choose_from_most_used'      => __( 'most used', 'text_domain' ),         'not_found'                  => __( 'not found', 'text_domain' ),     );     $rewrite = array(         'slug'                       => 'recipes/ingredients',         'with_front'                 => true,         'hierarchical'               => true,     );     $args = array(         'labels'                     => $labels,         'hierarchical'               => true,         'public'                     => true,         'show_ui'                    => true,         'show_admin_column'          => true,         'show_in_nav_menus'          => true,         'show_tagcloud'              => true,         'rewrite'                    => $rewrite,         'exclude_from_search' => false,     );     register_taxonomy( 'ingredients', array( 'recipes' ), $args );}     // Register Custom Post Type     function recipes_posts() {          $labels = array(         'name'                => _x( 'recipes', 'Post Type General Name', 'text_domain' ),         'singular_name'       => _x( 'recipe', 'Post Type Singular Name', 'text_domain' ),         'menu_name'           => __( 'recipes', 'text_domain' ),         'parent_item_colon'   => __( 'Übergeordnete recipe:', 'text_domain' ),         'all_items'           => __( 'All recipes', 'text_domain' ),         'view_item'           => __( 'recipe cc', 'text_domain' ),         'add_new_item'        => __( 'recipe bb', 'text_domain' ),         'add_new'             => __( 'ww hinzufügen', 'text_domain' ),         'edit_item'           => __( 'recipe zz', 'text_domain' ),         'update_item'         => __( 'recipe uu', 'text_domain' ),         'search_items'        => __( 'recipe ss', 'text_domain' ),         'not_found'           => __( 'not found', 'text_domain' ),         'not_found_in_trash'  => __( 'nf trash', 'text_domain' ),     );     $rewrite = array(         'slug'                => 'recipes',         'with_front'          => true,         'pages'               => true,         'feeds'               => true,     );     $args = array(         'label'               => __( 'recipes', 'text_domain' ),         'description'         => __( 'div. recipes.', 'text_domain' ),         'labels'              => $labels,         'supports'            => array( 'title', 'editor', 'thumbnail', 'comments', ),         'hierarchical'        => false,         'public'              => true,         'show_ui'             => true,         'show_in_menu'        => true,         'show_in_nav_menus'   => true,         'show_in_admin_bar'   => true,         'menu_position'       => 10,         'menu_icon'           => '',         'can_export'          => true,         'has_archive'         => true,         'exclude_from_search' => false,         'publicly_queryable'  => true,         'rewrite'             => $rewrite,         'capability_type'     => 'post',     );     register_post_type( 'recipes', $args );}