Featured image always rendered with 198px of height?

I added the following to my **functions.php** file:               set_post_thumbnail_size( 500, 500);      I enabled **featured image** (`support => 'thumbnail'`) in a custom post type a created (called Page Content). When I set an image as featured image (the image I'm using has **500px** of height) , the image is always rendered with 198px of height. **EDIT:** It renders 198px in final page and 117px in the admin panel. This is the code of the final output:               <img class="attachment-post-thumbnail wp-post-image" width="448" height="198" title="2974999772_7085da4d34" alt="2974999772_7085da4d34" src="http://localhost/wp-alex-chen/wp-content/uploads/2011/01/2974999772_7085da4d344-448x198.jpg      This is the code of the featured image in the admin panel:                     Edit Post panel: ![enter image description here](http://i.stack.imgur.com/Hbjb1.png) Any suggestions to solve this? (the 'normal' Posts have also the same problem (height= 198px) **EDIT2: I aded this to functions.php:**               if ( function_exists( 'add_image_size' ) ) add_theme_support( 'post-thumbnails' );     if ( function_exists( 'add_image_size' ) ) {         add_image_size( 'thumb-1', 320, 280, true );     }      It is set to have hard-crop but the image is rendered as 250px 280px (it should render as 320px x 280px).


How can I hide a category from Contributors in the edit/add new post screen?

I have a situation where I need to hide a specific category and it's children from users who are logged in as Contributors. I don't want them to see this category and it's children in the categories meta-box on the add new post screen. I can't find a plugin (that works) to do this, wondering if someone else knows of one, or even better if there is a function I can use to do this?


The reverse of wp_insert_post

When you need to delete a post programmatically what wp function do you use so that if takes care of the wp_term_relations too?


Deleting terms from the Wordpress wp terms table

what wp function do i use so that I can delete a term without worrying about the related tables such as wp term relationships and wp term taxonomy? Also if a post has a relationship to the deleted term and it's the only relationship to any term does wp take care of the necessary and it's associated back to uncategorized ? What if there is no uncategorized term neither?


Make thumbnails on product-category pages the same size [WooCommerce]

I have searched and didn't find a specific thread about my question. You can see what is happening on the following page: http://hubbardracinginc.com/product-category/98-02-camarofirebird/ The issue occurs on all product-category pages. The image thumbnails that are automatically created for products on WooCommerce are different sizes. My client wants them uniform. As of now, all I can think of is manually creating square thumbnails in Photoshop CC ( which would be very time consuming ). I'm assuming there is a feature or plugin that will automatically make all thumbnails the same size? Just not seeing it..


Imported blog page layout messed

http://uma.lohray.com/weblog/moots-part-ii/ is a blog I imported from blogger. The front page is fine, but when one clicks to read a blog post, the end of the post has parts of the right side bar widgets. I tried different templates, but the problem persists. I exported the blog as .xm and tried to see the data in the CDATA section to look for malignant tags, but it seems fine. Any new posts I make from wordpress are also messed in the blog page. I am at my wits end on fixing this :-( I am running a multi-site network.


Using is_plugin_active within functions.php

I'm trying to use `is_plugin_active` within functions.php. I need to wrap my `useragent_shortcode` function within `is_plugin_active` because when Contact Form 7 gets deactivated, I get a white screen. I've included `wp-admin/includes/plugin.php` as shown in other WPSE answers because this is outside of admin, but no luck. The shortcode function doesn't run and the raw shortcode is echoed to the page. Any ideas? Is my code too complex for what I want to do? _**4/16/12 Update: My own answer is below._** This works in functions.php:                If (in_array( 'contact-form-7/wp-contact-form-7.php', apply_filters( 'active_plugins', get_option( 'active_plugins' ) ) ) ) {               function useragent_shortcode($tag) {              if ( ! is_array( $tag ) )             return '';              $options = (array) $tag['options'];         foreach ( $options as $option ) {             if ( preg_match( '%^name:([-0-9a-zA-Z_]+)$%', $option, $matches ) ) {                 $name_att = $matches[1];             }                    $userAGENT .= $_SERVER['HTTP_USER_AGENT'];          }               $user_agent = $userAGENT;          $html = '<input type="hidden" name="' . $name_att . '" value="'.$user_agent.'" />';          return $html;     }     wpcf7_add_shortcode('useragent', 'useragent_shortcode', true);          }


How to replace regular jquery calls with CDN calls from Google?

I will like to implement a few of the boilerplate template features in one of my instance WordPress. I am trying to figure out how to exchange the regular jquery calls below               <script type='text/javascript' src='http:/.../wp-includes/js/jquery/jquery.js?ver=1.4.4'></script>     <script type='text/javascript' src='http://.../wp-includes/js/jquery/ui.core.js?ver=1.8.9'></script>      to this:               <!-- Grab Google CDN's jQuery, with a protocol relative URL; fall back to local if necessary -->     <script src="//ajax.googleapis.com/ajax/libs/jquery/1.5.1/jquery.js"></script>     <script>window.jQuery || document.write("<script src='js/libs/jquery-1.5.1.min.js'>\x3C/script>")</script>


Change 'Back To Website' link in wp-login.php

The login form on the page wp-login.php has a link at the bottom that says "Back to _website-name_ " This link always redirects to the home page I would like it to redirect to the page the user has come from. I imagine this requires a hook added to functions.php but I'm not sure how and could not find anything while searching. Any ideas?


set post to draft after set period based on post_modified date

I have a custom post type for a users profile page. My client wants all users to update their profile at least once a month. So we want their profile (custom post) to be automatically set to draft after 30 days. They will then receive an email asking them to update the post. The post then needs to be set to draft again 30 days after the last modified date and another reminder sent out etc etc. So far I have this code to expire the posts after 30 days of the published date - which doesn't seem to work. I assume I am missing something regarding the cron scheduling:               if ( ! wp_next_scheduled( 'run_post_expiration' ) ) {     wp_schedule_event( time(), 'hourly', 'run_post_expiration' );     }          add_action( 'run_post_expiration', 'expire_posts' );          function expire_posts() {     global $wpdb;     $daystogo = "30";     $sql = "UPDATE wp_posts SET `post_status` = 'draft' WHERE `post_type` = 'profile' AND DATEDIFF(NOW(), `the_date`) > '$daystogo')";     $wpdb->query($sql);     }     add_action('init', 'expire_posts');      And I have this code to set the post_date to the post_modified date, therefore enabling the code above to still work every 30 days:               function reset_post_date_wpse_121565($data,$postarr) {          $data['post_date'] = $data['post_modified'];     $data['post_date_gmt'] = $data['post_modified_gmt'];          global $post;     if ($post->post_type == 'profile'){     return $data;     }      }     add_filter('wp_insert_post_data','reset_post_date_wpse_121565',99,2);      The above code to modify the post_date does actually work but it is also causing some problems with other post types which I wasn't expecting - so think there may be an error somewhere. So my question is, can anybody help me to get this to work? Or am I evening going about this in the right way? Perhaps there is a better solution. I have tried the post expirator plugin but this only works with the post_date - so once someone has updated their profile once it no longer works. Many thanks D **EDIT:** So I edited the original code to set the posts to draft to this (based on some code I found elsewhere):               add_action( 'my_trash_hook', 'my_trash_hook_function' );     if (!wp_next_scheduled('my_trash_hook')) {     wp_schedule_event( time(), 'hourly', 'my_trash_hook' );     }          function my_trash_hook_function() {     global $wpdb;     $daystogo = "1";     $sql = "UPDATE {$wpdb->posts} SET 'post_status' = 'draft' WHERE 'post_type' = 'tests' AND DATEDIFF(NOW(), 'the_date') > '$daystogo')";     $wpdb->query($sql);     }      I have another function set up to send me an email when the post is set to draft and another to send me an email when the post is published again. What is happening is that when I log in to the site I am sent an email saying the post has been published but not one saying the post was set to draft. Not sure if the two peices of code are conflicting with each other or just plain wrong! Anyone got an ideas?


Why is setlocale() returning false on WPEngine?

It appears that WPEngine does not have support for different locale strings, rendering `setlocale()` useless. `setlocale(LC_ALL, "es_ES");` returns `false` and immediately after that, `setlocale(LC_ALL, 0)` (as you would expect from the previous `false`, returns `"en_US"`.


Will mass deleting WP Users then reimporting CSV with the same userid break WP?

Strange situation, but a Wordpress site i'm building has 1200 users already imported via csv, and they all have posts associated with them. I now need to add a number of extra fields to each user, but the only way I know how to is mass delete all users, and re-upload the new CSV with all the extra fields(and with the current USERID to match existing). My question, is how can I do this and keep all posts associated to a user? Has anyone done this before? Will it totally break the website? Is there a workaround that I havn't mentioned here??


your comment awaiting moderation message sometimes not appearing

On a new wordpress site I realise that sometimes when testing the comments feature for posts that the "your comment is awiting moderation" message does not appear. When a comment is posted, the url of the page when it refreshes contains an anchor to the wrapping div of the new comment. In that div instead of showing the comment when a normal user makes the comment, a message "your comment is awaiting moderation" normally appears. When this problem occurs though, although the anchor is still in the url of the returning page, the entire comment element isn't in the html. This means that the anchor point doesn't exist, so when the page loads, instead of jumping down to the last comment point it stays at the very top. Repeating this problem reliably has been incredibly difficult. There was a hunch to start with that it occured only for certain browsers. Then when I realised that the returning html from the php simply was missing the comment just made (or its wrapper and awaiting message at least) I realised something very fundamental had to be going on. My hunch is that this is beccause my test messages (which often contain just a few words or characters and aren't really accurate representations of a real message) were caught by Askimet (yes its installed and running) and marked as spam. I've found some of my tests as marked as spam and so I've concluded this is probably the reason for the awaiting moderation message not appearing. However I've also definitely not had the message appear and the test comment I made was cleared as ok by askimet. So I'm not sure if my assumption is completely/at all correct. Does anyone know about the internal workings of this and can confirm why this message may not appear?


Post relationship with custom excerpts for each related post

I'm building a recommendations site, where people can recommend other posts and give their opinion (a short text) on that post. So in the admin, I want to include, on the "Post Edit" screen, an option for users to:   1. select x number of posts to feature (their recommendations)   2. Write a custom excerpt for the featured post (which will, on that  I've tried with the Advanced Custom Fields plugin (ACF) relationship feature. I solves problem 1) from above (select x number of posts to feature), but does not allow to write custom text for each selected post. Does anybody have a solution to this problem? Or any idea of alternative ways of featuring x number of posts in a post/page with custom, post-specific excerpts? Your help is greatly appreciated!


Custom Gravatar not working

I'm trying to upload a custom Gravatar to Wordpress, however something is breaking the image link and I'm not sure how to fix it.               add_filter( 'avatar_defaults', 'new_default_avatar' );          function new_default_avatar ( $avatar_defaults ) {         //Set the URL where the image file for your avatar is located         $new_avatar_url = get_bloginfo( 'template_directory' ) . '/img/icons/avatar.jpg';         //Set the text that will appear to the right of your avatar in Settings>>Discussion         $avatar_defaults[$new_avatar_url] = 'New Default Gravatar';         return $avatar_defaults;     }      The code works, because I get a radio button with the option to add the Gravatar. The only thing that is broken is the actual image. When I right click on the image I get this URL: > http://i2.wp.com/localhost/wordpress/wp-content/themes/blog- > theme/img/icons/avatar.jpg I'm not sure where i2.wp.com is coming from, or what it's doing. When I remove that and do > loalhost:888/wordpress/wp-content/themes/blog-theme/img/icons/avatar.jpg I can see the Gravatar image. When I googled this, I saw a lot of people have this problem because of the Jetpack and Photon plugins, but I do not have any plugins installed.


solved magic-quotes - breaks admin totally

running wp 3.9 fresh install **update** - now all is fixed: now - with the new values               magic_quotes_gpc    Off On     magic_quotes_runtime    Off On     magic_quotes_sybase Off Off      > left is: local value right is: master value **all goes well -** the broken admin area is gone --- all goes nicely findings; on the page where I can configure the widgets I cannot get anything done. I cannot add widgets and I do not know why. i finally runned the wp-file-permissions-check that is derived from that url https://wordpress.org/plugins/wp-file- permission-check/ get back the following **errors:**               Error: SplFileInfo::getPerms() [splfileinfo.getperms]: open_basedir restriction in effect.      File(/home/vhost/WWW/literaturen.org/..) is not within the allowed path(s):      (/home/vhost/WWW/literaturen.org/:/usr/local/httpd/icons/:/usr/local/httpd/phptmp/)       how to treat this finding - what does this tell us!? I am thinking that due to the permissions, the proper jQuery files for the WordPress core are not being loaded and thus breaking the admin backend. Switching the theme and turning off all of the plugins still causes the issues, so it is most likely that. another thought: probalby a jQuery library is missing, has been replaced, or is somehow different from the version **update** here the values of open_basedir according the php-ini - as it shows the current settings of the server:               **open_basedir**        **local value**: /home/vhost/WWW/literaturen.org/:/usr/local/httpd/icons/:/usr/local/httpd/phptmp/        **master value**: /usr/local/httpd/docroot      and i guess that this can cause lots of issues and confusion - what do you say!? **explanation:** The open_basedir setting is primarily used to prevent PHP scripts for a particular user from accessing files in another user's account. So usually, any files in your own account should be readable by your own scripts. end of update:! see the errors:   * cannot configure the widgets   * cannot access the set-options-page   * cannot switch the accessible-mode -(in the set options-page) I have the following errors in the firebug console:               POST http://literaturen.org/wp-admin/admin-ajax.php          200 OK             1,39s        jquery...=1.11.0 (Zeile 4)     GET http://fls-eu.amazon.de/1/batch/1/OE/A1PA6795UKM...26pc0%3D831%26ld0%3D831%26t0%3D1399322099520:831          204 No Content             197ms        csm-ba..._V1_.js (Zeile 232)     Content Security Policy: Ungültige Quelle chrome-extension://lifbcibllhkdhoafpjfnlhfpfgnpldfl kann nicht verarbeitet werden     Content Security Policy: Unbekannte Quelle chrome-extension://lifbcibllhkdhoafpjfnlhfpfgnpldfl konnte nicht verarbeitet werden          Given URL is not permitted by the application configuration.: One or more of the given URLs is not allowed by the      App's settings.  It must match the Website URL or Canvas URL, or the domain must be a subdomain of one of the App's domains.          ping?c...dk=joey (Zeile 1)      and the following errors:               SyntaxError: illegal character          !function(a,b){\"object\"==typeof module&&\"object\"==typeof module.exports              load-s...ver=3.9 (Zeile 2, Spalte 15)     SyntaxError: illegal character          ...c,d){var f;return f=c&&c.hasOwnProperty(\"constructor\")?c.constructor:function(...          load-s...ver=3.9 (Zeile 1, Spalte 60)     ReferenceError: jQuery is not defined          })( jQuery );          customize.php (Zeile 560)     ReferenceError: jQuery is not defined          jQuery(document).ready(function()      what do you say!? it might be possible that the errors steem form the wrong openbase-dir!?


Taxonomy filter under Polylang

The filter code below is from Themeskingdom Exclusy theme. It makes a sql query for posts ids and then queries the taxonomy terms associated with those posts. I then uses isotope jquery plugin to serve a list of years (the terms) that the user can filter the posts by. My problem is that I'm creating a bilingual site with Polylang. And, although, when I'm in the english version of the site, I get just a list of english language posts, I get all the years available for filtering, from both english and native language posts. I believe I must replace that sql query with a query that takes polylang's `lang` parameter, and enclose it with a current locale conditional. But I need a query function that can return ids so I don't change the original too much. Or is there a simpler way? Thank you,
                 <?php _e('Filter:', tk_theme_name) ?>                 <?php _e('All', tk_theme_name) ?>                 <?php                 global $wpdb;                 $gallery_orderby = get_theme_option(tk_theme_name . '_gallery_gallery_orderby');                 $gallery_order = get_theme_option(tk_theme_name . '_gallery_gallery_order');                 $post_type_ids = $wpdb->get_col("SELECT ID FROM $wpdb->posts WHERE post_type = 'texto' AND post_status = 'publish'");                 if (!empty($post_type_ids)) {                     $post_type_cats = wp_get_object_terms($post_type_ids, 'ano', array('orderby' => 'name', 'order' => 'DESC', 'fields' => 'ids', 'hide_empty' => true ));                     if ($post_type_cats) {                         $post_type_cats = array_unique($post_type_cats);                     }                 }                 $include_category = null;                 if (!empty($post_type_ids)) {                     foreach ($post_type_cats as $category_list) {                         $cat = $category_list . ",";                         $include_category = $include_category . $cat;                         $cat_name = get_term($category_list, 'ano');                         ?>                         <a href="#" data-filter="<?php echo '.class-' . $category_list ?>"><?php echo $cat_name->name ?>                     <?php }                 } ?>


wordpress admin part is not accesbile after server shifting

one of my site's wp-admin is not accesible but the site front part is loading. This happens after i accessed the site from my new server second time. at first nothing happens and i can logg into dashboard. then after i logged out and second time try to login this error happens. when accessing the mysite.com/wp-admin the page shows               The page isn't redirecting properly.Firefox has detected that the server is redirecting the request for this address in a way that will never complete.     This problem can sometimes be caused by disabling or refusing to accept cookies.      in the public_html/error_log :               PHP Warning:  require(/home/mysite/public_html/wp-includes/pomo/mo.php) [function.require]: failed to open stream: Permission denied in /home/mysite/public_html/wp-settings.php on line 76     PHP Fatal error:  require() [function.require]: Failed opening required '/home/mysite/public_html/wp-includes/pomo/mo.php' (include_path='.:/usr/lib/php:/usr/local/lib/php') in /home/mysite/public_html/wp-settings.php on line 76      cpanel error_log shows:               Permission denied: /home/mysite/public_html/wp-admin/.htaccess pcfg_openfile: unable to check htaccess file, ensure it is readable      the htaccess have 644 permission. but i changed it into 775 and 755 and checked. the same happens. what could be the reason? how to solve this?


Buddypress Language Files Question

I have one question. I use latest Wordpress and Budypress. I have language files for buddypress - .po and .mo. My question is where I need to put the files, how I need to rename them and is there any function that I need to add somewhere (for example functions.php) to load them. I checked this page and try to follow the instructions, but my site is still in english. Thank you in advance :)


wp_dropdown_pages in widget form

I have a small quirk somewhere in my widget form. Upon saving the widget instance, the form refreshes with the wrong selected 'page_id' from the wp_dropdown_pages input. If I refresh the widgets page, the correct, saved page_id is selected in the dropdown. Here's the portion of code:               public function form( $instance ) {         if( isset( $instance['page_id'] ) ) {             $page_id = $instance['page_id'];         } else {             $page_id = 0;         }         ?>
Select a post to display it's excerpt
         <?php         $args = array(             'id' => $this->get_field_id('page_id'),             'name' => $this->get_field_name('page_id'),             'selected' => $page_id         );         wp_dropdown_pages( $args );     }          public function update( $new_instance, $old_instance ) {         $instance = array();         $instance['page_id'] = ( !empty( $new_instance['page_id'] ) ) ? (int)$instance['page_id'] : '';         return $instance;     }      So error_logging $page_id will output 0 when I hit save, but if I refresh, $page_id will be the correct page id I need. Any thoughts?


Order wp-admin posts by ID instead of post_date

I'm running into a situation with my log system (based on a cpt) where logs with the same post_date (due to rapid entry) are showing up out of order on the posts listing section in edit.php. You can see a similar topic here: http://wordpress.org/support/topic/custom- meta-date-order-wont-show-two-posts-with-same-date I think my only viable work around is to hack the query and order posts by ID when viewing the post listing section. Anyone know the best way to hook into the cpt and do this?


Best way of developing a sales report wordpress portal for several users?

I'm developing a WP portal that will be able to show different health agencies and its agents all details from their sales. It has a hierarchy where the agency see everyones information, managers see agents information and agents only see their own information. The information comes from 1.Sales input from agents (a form on the front-end), 2.from xml table uploaded weekly by agency. Can you recommend the best plug ins, do I need to come up with my own plug in? Some help please, this is my first time working with WP. Before I only developed sites on HTML, JAVA and lite PHP.


wp_list_pages show all pages in sitemap

I am trying to list the pages of my site but actually list them all. I can use `wp_list_pages();` However I have a custom post type "services" with archive false. I also have a page named services that was created in the backend. So services posts have services pages as their parent permalink : example.com/services/ I'm trying to get my custom post types that have a page as the parent to show up in the site tree like I would with subpages using `wp_list_pages();`. I'm thinking I need to somehow use a custom query maybe with `get_post_types();` and a foreach statement but I cant figure it out. Basically, I'm trying to output an html sitemap similar to the way a search engine would crawl all the actual public facing pages.


Next page link via the custom menu

I would like to display a "next link" at the bottom of several page templates, using the actual custom menu in which they sit in. I built a function that mostly works except for an edge case (explained further). I wonder if you might see an obvious mistake of mine that could explain these? Here is my function (inside functions.php)               /*         FIND WHAT IS THE NEXT MENU ITEM FROM A GIVEN PAGE TEMPLATE         used in The School pages to present teaser (bottom of the pages)              usage: $next_post = get_next_menu_item('menu-id-name');     */     function get_next_menu_item($menu_name){         global $post;         $menu = wp_get_nav_menu_object( $menu_name );         $menuitems = wp_get_nav_menu_items( $menu->term_id, array( 'order' => 'DESC' ) );         $i=-1;         foreach ( $menuitems as $item ):             $i++;             $id = get_post_meta( $item->ID, '_menu_item_object_id', true );             if ($id == $post->ID){                 $next_id = $i;             }         endforeach;         $next = $menuitems[$next_id+1];         $next = get_post_meta( $next->ID, '_menu_item_object_id', true );         return get_post($next);          }      # Case where it returns a wrong menu object I have a custom post type "staff". To be able to have a link to its content from the custom menus, I've created a page using the archive-staff.php template. On that page, my function retrieves an incorrect post. The staff template recreates the main loop independently from the query_vars. Here it is, just in case it is important.               global $wpdb;     global $post;          $sql = "SELECT * FROM `bj_posts` p          LEFT JOIN (         SELECT post_id, meta_value as purpose         FROM `bj_postmeta` pm          WHERE  `meta_key`='_staff_purpose'         ) pm ON p.ID=pm.post_id     WHERE p.`post_type`='staff' AND p.`post_status`='publish'     ORDER BY purpose ASC, post_title ASC";          $staff_members = $wpdb->get_results($sql, ARRAY_A);      Results through which I loop, and before calling my function, I reset the query.                wp_reset_query();     wp_reset_postdata();     $next_page = get_next_menu_item('the-school');


Admin First hook that outupts html?

I think load- is the first hook in the admin screen that deals with outputting html, but I'm not totally sure . Basically I'm looking for the equivalent to `template_rediect` or `get_header` which correct me if I'm wrong don't work on the admin side. I'd like to hook into every admin page... My guess is something like this using either $page_now or get_current_screen() but my mind is going blank on how I'd implement them on all pages:               $page = get_current_screen()->parent_file;     add_action( 'load-$page.php', 'add_action_all_load_hook', 1, 0 );      On frontend I would do this:                       function link_rel_buffer_callback($buffer) {                 $buffer = preg_replace('ORIGINAL', 'NEW', $buffer);                 return $buffer;             }                  function link_rel_buffer_start() {                 ob_start("link_rel_buffer_callback");             }             function link_rel_buffer_end() {                 ob_flush();             }             add_action('template_redirect', 'link_rel_buffer_start', -1);             add_action('get_header', 'link_rel_buffer_start');             add_action('wp_footer', 'link_rel_buffer_end', 999);      I'm thinking the equivalent would be:                add_action('load-$page', 'link_rel_buffer_end', 1, 0);      add_action('in_admin_footer', 'link_rel_buffer_end', 999);      But I cant grasp how to do load- on every load.


.htaccess restrict subdomain by IP - Wordpress Multisite

I'd like to redirect traffic away from a subdomain install of Wordpress Multisite unless it's coming from a specific IP address/range, and without affecting the root domain traffic. Is this possible? Conceptually, I've been thinking something like this:               # IF we're dealing with the subdomain     RewriteCond %{HTTP_HOST} subdomain\.example\.com [NC]          # AND the user is NOT from our allowed IP     RewriteCond %{REMOTE_ADDR} !111\.222\.333\.444          # THEN redirect them to the root domain     RewriteRule ^(.*)$ example\.com [L,R=302]      In other words, restrict access to the subdomain from all traffic that doesn't originate from a defined IP address. I've literally just learned regex and .htaccess for this, so apologies in advance for anything that's glaringly wrong. The reason I'm not doing this with directory specific .htaccess is that I'm working with a subdomain install of Wordpress Multisite, so there are no directories. It's all in the URL. Some possible complications that come from Wordpress itself:   1. Ideally these rules should be added in such a way that they aren't overwritten every time the permalink cache is refreshed in WP.   2. I'm not sure what `RewriteBase /` evaluates to, or how it's affecting URIs (if that's the correct acronym) in my file.


Building a plugin into a theme

Firstly, I know this is 'bad' practice for several different reasons, but for reasons that I won't waste your time with it's something I need to do. Using a fairly simple plugin and I've tried copying it into functions.php and updating the file paths and dependences, but I'm having some trouble. Plugin file looks like this:-               $plugin_headers = get_file_data( __FILE__, array( 'Version' => 'Version', 'Name' => 'Plugin Name' ) );               /**      * We store our plugin data in the following global array.      * $my_unique_name with your unique name      */     global $my_unique_name;     $my_unique_name = array();     $my_unique_name['version_key'] = strtolower( str_replace( ' ', '_', $plugin_headers['Name'] ) ) . '_version';     $my_unique_name['version_value'] = $plugin_headers['Version'];               /**      * When the user activates the plugin we add the version number to the      * options table as "my_plugin_name_version" only if this is a newer version.      */     function inline_comments_acitvation(){              global $my_unique_name;              if ( get_option( $my_unique_name['version_key'] ) && get_option( $my_unique_name['version_key'] ) > $my_unique_name['version_value'] )             return;              update_option( $my_unique_name['version_key'], $my_unique_name['version_value'] );          }     register_activation_hook( __FILE__, 'inline_comments_acitvation' );               /**      * Delete our version number from the database when the plugin is activated.      */     function inline_comments_deactivate(){         global $my_unique_name;         delete_option( $my_unique_name['version_key'] );     }     register_deactivation_hook( __FILE__, 'inline_comments_deactivate' );               if ( is_admin() )         require_once plugin_dir_path( __FILE__ ) . 'admin/admin-tags.php';          /**      * Theme only functions      */     require_once plugin_dir_path( __FILE__ ) . 'inc/template-tags.php';               function inline_comments_enqueue_scripts(){              $plugin_headers = get_file_data( __FILE__, array( 'Version' => 'Version', 'Name' => 'Original Plugin Name' ) );         $clean_name = strtolower( str_replace( ' ', '-', $plugin_headers['Name'] ) );              wp_register_style( $clean_name . '-style', plugin_dir_url( __FILE__ ) . 'inc/css/style.css' );         wp_register_script( 'textarea_auto_expand-script', plugin_dir_url( __FILE__ ) . 'vendor/textarea-auto-expand/jquery.textarea_auto_expand.js' );         wp_register_script( $clean_name . '-script', plugin_dir_url( __FILE__ ) . 'inc/js/script.js', array('jquery', 'textarea_auto_expand-script') );     }          add_action('wp_enqueue_scripts', 'inline_comments_enqueue_scripts', 2);      After moving the plugin to the theme folder I've done the following: I've removed the pointless parts and in my functions.php I'm loading the main script.js (it loads) and the css, like so.               function inline_comments_enqueue_scripts(){     if ( is_singular() || is_page() ) {              wp_enqueue_style( 'inline-style', get_template_directory_uri() . '/css/inline-style.css', '10000', 'all' );              wp_enqueue_script( 'inline-script', get_template_directory_uri() . '/js/inline-script.js', array( 'jquery' ), MEDIUM_VERSION);     }             }          add_action('wp_enqueue_scripts', 'inline_comments_enqueue_scripts', 2);      Ok, so our script loads with our css. The problem is the main part of the plugin that contains the templates, the functions and the ajax calls I can't get to load. This part:- `require_once plugin_dir_path( __FILE__ ) . 'inc/template- tags.php';` I've tried pasting this file into functions.php and nothing happens, it just doesn't work. Probably making a really stupid mistake somewhere(other than building a plugin into a theme, heh).


Get Taxonmy Term ID For Current Post

If I wanted to get the category ID for the current post, I would use something like this:               <?php foreach((get_the_category()) as $category) { echo $category->cat_ID . ' '; } ?>      How can I do the same for a a term ID from a specific Taxonomy?


Sidebar links for different pages

Hey all i am wondering what i need to add in order to have a different sidebar for a set page? I created a category for the page ( **called PatientEdu** ): ![patcat](http://i.stack.imgur.com/dsVaj.jpg) And made sure the page was linked to the category: ![patcat2](http://i.stack.imgur.com/QK8lx.jpg) But it still seems to be using the other category sidebar (Which i also do not know where its at)? ![parcat3](http://i.stack.imgur.com/bqKoW.jpg) So any help would be great! **UPDATE** My current sidebar.php code is this:               <?php if (is_active_sidebar('default-sidebar')) : ?>

Default Sidebar
         <?php dynamic_sidebar('default-sidebar'); ?>
     <?php endif; ?>      and the function code: ![function](http://i.stack.imgur.com/HcgXA.jpg) **update 2** Looks like its using the single.php page to populate the sidebar?               <?php if (have_posts()) : ?>

<?php echo get_cat_name(CAT_DOCTORS); ?>

                  <?php while (have_posts()) : the_post(); ?>                   <li <?php if ($post_id == get_the_ID()) {echo 'class="active"';} ?>>                    <a href="<?php the_permalink(); ?>">                      <?php the_title(); ?>
                 <?php endwhile; ?>

     <?php endif; ?>


Any docs for wp_nav_menu's "items_wrap" argument?

I'm using **wp_nav_menu** and am trying to create custom output for the sub- level drop downs. I came across the "items_wrap" argument but there's really not much information as to what it is, how it works, and what kind of things can be done with it. What exactly _is_ " **%1$s** " and " **%2$s** "? (Can anyone explain it in layman's terms?)


WordPress Nonce and check admin referer help needed

Just before I start please note that I am new at any type of WordPress/PHP security. Few days ago friend of mine asked me to create Theme Options for his Theme, all set and working fine, however he had few minor issues with his Theme in the past and I would like to make sure that Nonce and check_admin_referer is set properly. Here is what I used: http://codex.wordpress.org/Function_Reference/check_admin_referer http://codex.wordpress.org/WordPress_Nonces And now my question is: where exactly wp_nonce_field needs to be in and where check_admin_referer? Before the form start I have:                   if ( !empty($_POST) && check_admin_referer('crt_nonce') )         {     $saved = false;     if (  isset( $_REQUEST['action'] ) && 'save' == $_REQUEST['action'] ) {      and just before form closes the wp_nonce_field                   <form action="" id="save" method="post">         <?php wp_nonce_field('crt_nonce'); ?>         </form>      There are few articles about this around, but they don't help me at all. If anyone can and wants to assist me here I would very much appreciated. And I will do my best to follow your instructions religiously and try to avoid more questions ;) PS Oh, so that I don't forget :) wp_nonce_field and check_admin_referer needs to be set once correct, not for each field options that I've created? Thanks, Draga


How to Check the Directory Where WordPress is Installed?

I have a client who has a live WordPress site. I logged into their FTP and it's hard to tell what directory it is actually installed. How can I verify through WordPress interface in what directory it is located in?


Can I change a custom post type label from a child theme?

I'm developing a child theme of a premium template, this comes with a custom post type with the label name of "Projects" but I'd like to change it to something else, I know that if I go to the functions.php file of the main theme I can change it easily but I'd like to change it from my child theme so I don't have to edit any of the original files, is it possible? Thanks in advance!


Get images only if parent status is publish

I have a site which uses a custom template page for each image, and users can favorite an image. I am then pulling a page of most favorited images:               $args = array(     'post_type' => 'attachment',     'post_mime_type' => 'image/jpg',     'post_status'=>'inherit', // there for testing     'meta_key' => 'favorites',     'orderby'=>'meta_value_num',     'order'=>'DESC',     'posts_per_page'=>25,     'nopaging' =>true       );     $query = new WP_Query( $args );      However I only want the images to show there if the parent post status is 'publish'. There will be occasions where the status changes temporarily to 'draft' then later back to 'publish' again - this happens programatically and is done based on author ID to all post which belong to that author. I could see only two possible ways of doing this:   1. At the time when the post status of the parent is changed set the post status of attachments which belong to this author to something (Draft? Pending? Something else?) then change it back to inherit at the time I restore the authors posts. However when I tried this, the status of the attachemnt image remained unchanged, so there must be some function in WP that prevents it.   2. Check each images parent post status before showing them, but this means 25 database calls (yuck) and means I won't necessarily get 25 images (not a disaster).   3. Is there a 3?


Multisites, upload issues, and iOS!

This question has changed significantly. I have the latest version of Wordpress and am hosting it on an Apache server. Link to Blog: http://blogs.bzaeds.org/test/2012/05/11/video-test/ Now, here's the thing. When I upload a video to Wordpress it will play on a Mac in Firefox with the Wordpress URL the item is given (ex: http://blogs.bzaeds.org/test/files/2012/05/720-dunk.mp4" provider="video). In fact, I can go to that link right now on my Firefox browser and have no problems, it plays fine. However, if I upload a video to Wordpress and use the Wordpress URL (ex: http://blogs.bzaeds.org/test/files/2012/05/720-dunk.mp4" provider="video) **it will not play on an iPad or iPhone.** Where this gets fun is -- if I use the APACHE location for the file (ex: http://blogs.bzaeds.org/wp-content/blogs.dir/5/files/2012/05/bunny.mp4) **it will play just fine on the Mac AND the iPad & iPhone.** I have been working on this issue for 4 days and I'm exhausted. I've finally narrowed it down to this, but I'm not sure what config setting would be causing an issue like this. Any help would be greatly appreciated! Edit: It is looking like it's the fact that Wordpress can't do byte handling and join this with Multi-site and different directories and you get chaos. I realize this is the issue, but I'm not sure what I'd do to workaround this issue and installing mod_xsendfile didn't seem to work nor editing the jwplayer code (which I'll try again, perhaps I did it wrong.)


Finding a post's slug

I'm using `wp_query()` to get custom posts from the database. I want to list these out as links to the entries, so I'm thinking I could use the slugs. Sadly these don't seem to be included in the `wp_query` object. Here's my code:                   $oWP = new wp_query(array(             'post_type' => 'letters_of_ref'             , 'orderby' => 'meta_value'             , 'meta_key' => 'aaaConsultant_dateofletter'         ));      So, given the post ID, how do I get the post's slug? Alternatively, am I going down the right path to construct the link? **Update** : just found the `get_permalink()` and `the_permalink()` functions, so I'm good for the link. Still want to find the slug though.


Site Rss not seen by browser

We have a site http://ort.org.il built with WP 3.1.2. Its RSS address should be http://ort.org.il/feed/, but nothing shows up there. I can see the feed in the View Source, but not in the browser, and not in one of our other applications, that reads the RSS from this site. What could be the problem, and how can I fix it?


Getting a list of custom posts by author

I'm trying to have a page where a user can view all of the custom post types after they click on an author from a previous page, but I'm having no luck with anything I can find in the built-in PHP functions with Wordpress. Is this some easy to query? I haven't found much online about it.


Change the link URL in default RSS feeds

My wordpress feeds post item looks following:               <item>        <title>Taste Trail – Lima and Cusco’s Best Eats</title>        <link>        http://example.com/taste-trail-lima-and-cuscos-best-eats/</link>        <comments>http://example.com/taste-trail-lima-and-cuscos-best-eats/#comments</comments>        <pubDate>Tue, 16 Apr 2013 03:24:37 +0000</pubDate>        <dc:creator>anzprod</dc:creator>        <guid isPermaLink="false">http://example.com/?p=717</guid>        <description>           <![CDATA[Data]]>        </description>        <wfw:commentRss>           http://example.com/taste-trail-lima-and-cuscos-best-eats/feed/        </wfw:commentRss>        <slash:comments>0</slash:comments>     </item>      I want to change the URL of the post to something like               http://example.com/#!view/taste-trail-lima-and-cuscos-best-eats      Please help me with how to do this! Thanks


style being attatched to <html> tag from outside of style sheets

I'm developing an online store using wp e-commerce plugin. Whilst working on it locally the problem didn't occur, but after I started testing it online a large gap began appearing before the top of the page. Using Firebug I've been able to see that the styling causing it is: html {margin-top: 28px !important; } which firebug is telling me comes from a file that has the same name as the page ie: if example.com/products-page is the page being viewed it says that the style in question is being created by http://example.com/products-page on (line63) I have used dreamweaver to search the entire wordpress folder locally for the style causing the error but it doesn't exist - it seems to be only occurring when the site is live online. I considered that possibly something could be getting added at a server level so I uploaded the site to an account on a different host - but same problem. I'm using a reset.css file that would normally overcome this style being recognised - but than !important is what keeps it from being ignored. Any insights or suggestions greatly appreciated


How to use hook admin_init for add_action for custom post type column

I'm adding a post thumbnail column to the edit custom post screen. The post thumbnails are showing up fine however I would like to hook it with admin_init to take some load off the website. This is my code for adding the thumbnail's to my edit custom post screen:               add_filter( 'manage_edit-model_columns', 'my_columns_filter', 10, 1 );     function my_columns_filter( $columns ) {     $column_thumbnail = array( 'thumbnail' => 'Thumbnail' );          $columns = array_slice( $columns, 0, 1, true ) + $column_thumbnail + array_slice(  $columns, 1, NULL, true );          return $columns;     }               add_action( 'manage_model_posts_custom_column', 'my_column_action', 10, 1 );     function my_column_action( $column ) {     global $post;     switch ( $column ) {         case 'thumbnail':             echo get_the_post_thumbnail( $post->ID, 'edit-screen-thumbnail' );             break;         }     }      Could someone explain (show me how) to use the admin_init hook for my thumbnail column code? Thanks.


Why might a plugin's 'do_shortcode' not work in an AJAX request?

**tl;dr:** Contact Form 7's shortcode doesn't work in an AJAX request when called with `do_shortcode` _functions.php_               add_action('wp_ajax_ps_get_survey_form', 'ps_get_survey_form');     add_action('wp_ajax_nopriv_ps_get_survey_form', 'ps_get_survey_form');          function ps_get_survey_form() {         echo do_shortcode( '[contact-form-7 id="397" title="Contact form 1"]' );         die();     }      _script.js_               jQuery(document).ready(function($){              $('#survey-modal').fancybox({             href: ajaxurl,             ajax: {                 type : "POST",                 data : {action: 'ps_get_survey_form'}             }         });     });      However,               echo do_shortcode( '[contact-form-7 id="397" title="Contact form 1"]' )      returns the shortcode string itself. It works fine if I put it in a template. Try as I might (ludicrous things like wrapping it in a post/applying the_content filter, manually firing various actions that CF7 hooks into, etc) it refuses to translate itself into a form. How do I debug this? **EDIT** @Kaiser sensibly suggests that I don't have access to do_shortcode. I tried to check this, with the following result:               function ps_get_survey_form() {              //include( ABSPATH . 'wp-includes/shortcodes.php' );          //Causes fatal error: cannot redeclare add_shortcode              if ( function_exists( 'do_shortcode ' ) )  {             echo "do_shortcode exists";         } else {             echo "do_shortcode doesn't exist";  // this gets echoed         }              do_shortcode( 'foo' );      // this fails silently, even though the function apparently hasn't been defined         //foo();                    // Causes fatal error as expected              //echo do_shortcode( '[contact-form-7 id="397" title="contact form 1"]' );         die();     }


Need All the posts with id, title and date

I need all the post ids with the corresponding title and post date. Currently getting only ids                $posts_array = get_posts( 'posts_per_page=999999999999&fields=ids' );      need               [{     "id" : 9,     "post_date" : "2014-06-11 07:04:55",     "post_title" : "title.."     },          {..},          {..},..     ]      * * * Scenario:   1. Post will be used to show in tablet/Mobile (with infinite scroll).   2. Call web service to get Posts.    3. the post must return result in a paging manner like 1-20, 20-40 (from all posts) for subsequent calls.   4. Don't want to load all the posts as it will arise performance issue.


Uninstalling plugins across all sites

I apologize for the weakness of my search-fu if this has been answered already. I'm in the process of cleaning up and updating an aging multisite installation. One step in this is to identify and remove plugins that are no longer needed or just don't work. Unfortunately, most of these plugins were activated on a per-site basis and there are enough sites to make manual deactivation too impractical. I could, of course, just delete the plugin directories and move on but since some of the plugins have deactivation/uninstall hooks I'd rather have the plugins clean up after themselves first. Is there an elegant way of doing so? I guess I could look up the relevant functions and write a script to walk all sites and deactivate the plugins in question but if there's a better way I'd prefer that.


Conditionally call add_action depending on post_type?

When building a plugin, I know that you can hook into a function to run some code like               add_action('admin_footer', array($this, 'custom_function'));      And within that function, test for post_type like so:               public function custom_function() {                 $screen = get_current_screen();                 if (self::CUSTOM_POST_TYPE == $screen->post_type) {                     // Do something                 }             }     }      Over the entire plugin, I'm testing the post_type of the screen in many different functions. In the spirit of D.R.Y., my question is, is there a way to conditionally add the actions in a group based on the current post_type? Instead of having many functions that make the same test for the post_type like:                   public function custom_function_1() {                     $screen = get_current_screen();                     if (self::CUSTOM_POST_TYPE == $screen->post_type) {                         // Do something                     }                 }         }         public function custom_function_2() {                     $screen = get_current_screen();                     if (self::CUSTOM_POST_TYPE == $screen->post_type) {                         // Do something                     }                 }         }      is it possible to test the post_type and then call the actions needed for that post type, something like:               $screen = get_current_screen();     if (self::CUSTOM_POST_TYPE == $screen->post_type) {         add_action('admin_footer', array($this, 'custom_footer_function'));         add_action('save_post', array($this, 'custom_save_function'));         add_action('delete_post', array($this, 'custom_delete_function'));         add_filter('enter_title_here', array($this, 'custom_title_placeholder'));     }      where the conditional test can be removed from all the functions? Is there a particular hook where a test and calls like this could take place so many of the plugin's functions don't have to have the same code? Thank you for any advice.


Enabling jquery when dragging available widget to sidebar area

So I have some widgets that are using some custom jquery on the backend. I can get the widget forms to call the jquery files but only AFTER I've saved the widget and reloaded the page. Is there anyway to use that jquery as soon as I've dragged it from the "Available Widgets" area to the sidebar area? So in my widget code, in the form function, I have this:               function form( $instance ) {          wp_enqueue_media();     wp_enqueue_script('kjd_widgets',plugins_url('lib/kjd_widgets.js',__FILE__),null);      so that works but only after ive reloaded the page. How can I get the JS to load when the widget is activated and? And would I have to add something to my jQuery to bind the new widget form to the jQuery?


Create digital-virtual-downloadable WooCommerce products from the frontend using Gravity Forms?

A little background about my issue: I'm running WP + WooCommerce + Gravity Forms and want to enable users to create WC digital-virtual-downloadable products from the frontend using GF. Essentially, users upload audio files using GF's Custom Field values (File Uploads) with **mp3** as the _meta key_ (the **file path/URL** to the uploaded file is the _meta value_ ). Since WC stores digital products as post meta fields, as well, under the **_file_paths** meta key, I thought I could go that route, but it turns out that it's not as simple as that. The _meta value_ for WC's _file_paths is actually stored as an array with an MD5 hash. My questions is, how do I duplicate the **mp3** _meta value_ under the WC's **_file_paths** _meta key_ and store it as an array with that md5 hash. Alternatively, if there's another way to accomplish this, I'm totally open to that, as well (ie. store _meta value_ as an array under **_file_paths** _meta key_ and somehow throw in that hash). Here's something that might help with the answer - http://docs.wedevs.com/woocommerce-downloadable-product/


Can’t get the phpunit core test for WordPress to work

I’m trying to set up the test for the WordPress core to make sure that the plugin I’m developing doesn't break anything. But I’m having a problem which I really have no idea how to fix. I downloaded the files located at www.develop.svn.wordpress.org/trunc (I know I can use Subversion, but I’m having some troubles setting it up in PhpStorm, so I’m focusing on this problem), and set everything up. I get the tests running, but about half way through the tests, I get an error, which I have no idea where originates. It’s too long to post here, but it seems to repeat itself, so here is a a sample of the first lines               WordPress database error Table 'multipress_testc.wptests_4_options' doesn't exist for                 query INSERT INTO `wptests_4_options` (`option_name`, `option_value`, `autoload`) VALUES        ('active_plugins', 'a:1:{i:0;s:9:\"hello.php\";}', 'yes') ON DUPLICATE KEY UPDATE      `option_name` = VALUES(`option_name`), `option_value` = VALUES(`option_value`), `autoload`      = VALUES(`autoload`) made by PHPUnit_TextUI_Command::main, PHPUnit_TextUI_Command->run,       PHPUnit_TextUI_TestRunner->doRun, PHPUnit_Framework_TestSuite->run,      PHPUnit_Framework_TestSuite->run, PHPUnit_Framework_TestSuite->runTest,      PHPUnit_Framework_TestCase->run, PHPUnit_Framework_TestResult->run,      PHPUnit_Framework_TestCase->runBare, PHPUnit_Framework_TestCase->runTest,      ReflectionMethod->invokeArgs, Tests_MS->test_active_network_plugins, activate_plugin,      update_option, add_option      The last errors I get are PHP errors saying               PHP Fatal error:  Call to a member function to_array() on a non-object in /Applications/MAMP/htdocs/(folder-name)/(WordPress root folder)/wp-includes/post.php on line 411          Fatal error: Call to a member function to_array() on a non-object in     /Applications/MAMP/htdocs/(folder-name)/(WordPress root folder)/wp-includes/post.php on line 411      The value of the non-object is bool(false) I’m running the multisite tests.


Login cookies set as wrong domain

I'm building a plugin that allows oauth2 logins from providers (eg google). My code is setting the `wordpress_logged_in_{$hash}` cookie domain as `/wp- admin`, for some reason, whereas using the normal wordpress login the domain for that cookie is `/`. This means that when I log out, wordpress tries to clear the cookie with `/` domain. So for anybody using my plugin they will stay logged in. The code I'm using to programatically login the user is:               //get user     $user = get_userdata( $user_id );     if ( !$user || ( !get_class( $user ) == 'WP_User' ) )         continue;     //login     wp_set_current_user( $user->data->ID, $user->data->user_login );     wp_set_auth_cookie( $user->data->ID );     do_action( 'wp_login', $user->data->user_login );     //redirect to admin page     wp_redirect( admin_url() );      My code should work, according to: http://kuttler.eu/code/log-in-a-wordpress- user-programmatically/ and http://stackoverflow.com/a/10041701 issue seems to be with `wp_set_auth_cookie()` - completely at a loss here so any help is appreciated, daithi


How can I check which archive has referred the single?

I have a single page that displays one and only one category of the post that is showing. However the post can have more than one category. If the user arrives from a category page I want to show that category name, and a random one otherwise. Which is the quickest way to achieve this?


Capabilities for custom post type visible in backend but not working

In my plugin I have created a custom post type and defined capabilities for both the subscriber and the administrator role. When I go into the backend and look at the capabilities that are in the list of capabilities for the administrator role, all the capabilities I added are checked. However if I login as admin and try to move a post of type 'pp_zoekertje' to trash, wordpress tells me I am not allowed to do so. I have of course, searched on stackexchange and various other sites but the only solutions I can find are telling me to do exactly what I am already doing. Any help is appreciated.               function create_pp_zoekertje_post_type(){     register_post_type('pp_zoekertje',         array(             'labels' => array(                 'name' => 'Zoekertjes',                 'singular_name' => 'Zoekertje',                 'add_new' => __('Nieuw Zoekertje'),                 'add_new_item' => __( 'Nieuw Zoekertje' ),                 'edit' => __( 'Bewerk' ),                 'edit_item' => __( 'Bewerk Zoekertje' ),                 'new_item' => __( 'Nieuw Zoekertje' ),                 'view' => __( 'Bekijk' ),                 'view_item' => __( 'Bekijk Zoekertje' ),                 'search_items' => __( 'Zoek Zoekertjes' ),                 'not_found' => __( 'Geen zoekertjes gevonden' ),                 'not_found_in_trash' => __( 'Geen zoekertjes gevonden in prullenbak' ),                 ),             'public' => true,             'has_archive' => true,             'show_ui' => true,             'publicly_queryable' => true,             'exclude_from_search' => false,             'hierarchical' => false,             'query_var' => true,             'supports' => array(                 'title',                 'editor',                 'revisions',             ),             'map_meta_cap' => true,             'capability_type' => 'pp_zoekertje',             'capabilities' => array(                 'edit_post' => 'edit_pp_zoekertje',                 'edit_posts' => 'edit_pp_zoekertjes',                 'edit_others_posts' => 'edit_others_pp_zoekertjes',                 'publish_posts' => 'publish_pp_zoekertjes',                 'edit_published_posts' => 'edit_published_pp_zoekertjes',                 'read_post' => 'read_pp_zoekertje',                 'read_private_posts' => 'read_private_pp_zoekertjes',                 'delete_post' => 'delete_pp_zoekertje',                 'delete_others_posts' => 'delete_others_pp_zoekertjes'             ),     //            'taxonomies' => array('pp_zoekertje_taxonomy','category'),         )     );          $subscriber_role = get_role('subscriber');     $subscriber_role->add_cap('edit_pp_zoekertje');     $subscriber_role->add_cap('edit_pp_zoekertjes');     $subscriber_role->add_cap('publish_pp_zoekertjes');     $subscriber_role->add_cap('read_pp_zoekertje');     $subscriber_role->add_cap('read_private_pp_zoekertjes');     $subscriber_role->add_cap('delete_pp_zoekertje');     }          function poppunt_classifieds_search_Init() {         create_pp_zoekertje_post_type();         if (!is_admin()) {             wp_enqueue_script('jquery');             wp_enqueue_script( 'poppunt-classifieds-handlebars', plugins_url( '/js/handlebars.js', __FILE__ ));         }     }     add_action('init', 'poppunt_classifieds_search_Init');          add_action('admin_init', 'plugin_admin_init');     function plugin_admin_init(){         $administrator_role = get_role('administrator');         $administrator_role->add_cap('edit_pp_zoekertje');         $administrator_role->add_cap('edit_pp_zoekertjes');         $administrator_role->add_cap('edit_others_pp_zoekertjes');         $administrator_role->add_cap('publish_pp_zoekertjes');         $administrator_role->add_cap('read_pp_zoekertje');         $administrator_role->add_cap('read_private_pp_zoekertjes');         $administrator_role->add_cap('delete_pp_zoekertje');         $administrator_role->add_cap('edit_published_pp_zoekertjes');         $administrator_role->add_cap('delete_others_pp_zoekertjes');              register_setting( 'pp_options', 'pp-options', 'pp_plugin_options_validate' );              add_settings_section('pp_options_main', 'Algemene instellingen', 'pp_options_main_output', 'pp_options_menu');              add_settings_field(             'pp_zoekertjes_option_input_page',             __('Pagina met invulformulier voor zoekertje (toevoegen/bewerken)'),             'pp_zoekertjes_option_input_page',             'pp_options_menu',             'pp_options_main');              add_settings_field(             'pp_zoekertjes_option_my_ads_page',             __('Mijn zoekertjes pagina'),             'pp_zoekertjes_option_my_ads_page',             'pp_options_menu',             'pp_options_main');     }


Category and tags goes 404

I made a custom theme for a website and I'm having some trouble with the category and tag pages, since they redirect to pages with the same slug or to 404 (when there is no pages). On my website I have 3 custom type posts, each with about two customs taxonomies (none of then with category or tag as name). Besides that I also using the custom permalink %postname% and all the site beside that two pages are working fine. My .htaccess look like this:                   <IfModule mod_rewrite.c>         RewriteEngine On         RewriteBase /brazcubas/         RewriteRule ^index\.php$ - [L]         RewriteCond %{REQUEST_FILENAME} !-f         RewriteCond %{REQUEST_FILENAME} !-d         RewriteRule . /brazcubas/index.php [L]         </IfModule>      I don't know what I'm maybe doing wrong. What I've already tried was:   * Disable and Enable the permalink structure.   * Create custom category pages   * Create custom archives pages   * Change to other theme. Even with other themes the error still going. What could it be?


wp_link_pages return value even when is condition inside if statement

I am trying to check if wp_link_pages is true in this way:                                       <?php                                  the_content();                                  if( wp_link_pages() ):                             ?>

                                     <?php if( !isset( $_GET['view'] ) && $_GET['view'] != 'all' ) : ?>                                         <a href="<?php the_permalink(); ?>?view=all" class="dharmagothicc-regular gold">SINGLE PAGE -                                      <?php endif; ?>

                                     <?php wp_link_pages(array('next_or_number'=>'number', 'before'=>'')); ?>

                             <?php endif; ?>      The problem is that `wp_link_pages()` return the value two times - even when is the condition in the `if()` statement. Is there a way to escape this?


Breaking Bootstrap Grid at Post Count with Tax Terms

I'm trying to get my custom tax term grid to break (insert a clearfix) after my 4th column. Below is my code. I've seen and done this before using a technique similar to what's demonstrated at this link. However, I'm not using a traditional loop so I'm really not sure how to go about implementing this. Look forward to your feedback. Below is the code @Josh Mountain suggested. The break is not appearing at the correct place. I have also attached a screen shot of what I'm trying to accomplish as well as the current result. ![enter image description here](http://i.stack.imgur.com/8QpKc.jpg) Code below updated 8-19-20 1:51 cst.
              <?php              $libargs=array(             'orderby'           => 'name',               'order'             => 'ASC',             'hide_empty'        => 0,               'exclude'           => array(16, 20, 22,25, 27, 28, 30, 4, 42, 7, 43 ), //* Enter ID's of parent categories to exclude from list             'taxonomy'      => '100list',             'parent'                   => '',             );                    $libcats=get_categories($libargs);                    $i = 0;                  foreach($libcats as $lc){                      $i++;                      if( $i % 4 == 0 ) {                  echo '

';                 }                      echo '
';                      $termlink = get_term_link( $lc->slug, '100list' );             ?>

<?php echo  $lc->count  ?>

 Symbols

 <a class="label label-default" href="<?php echo $termlink; ?>"> View Group

    <?php the_field('basictext', '100list_'.$lc->term_id); ?>

                                       <?php                           $attachment_id = get_field('taximage', '100list_'.$lc->term_id);                          if ($attachment_id) {                         $image = wp_get_attachment_image_src($attachment_id, 'industrygroup-img');                              if ($image) {                             ?>                             <img class="img-responsive" src="<?php echo $image[0]; ?>" />                             <?php                          }                      }                       ?>

 <a href="<?php echo $termlink; ?>"> <?php echo $lc->name; ?>
                <?php   echo '
'; }?>


Wordpress - show all posts + ones with specific tag

I have 3 types of posts as below   1. Normal posts without any tag   2. With "featured" tag   3. With "sold" tag On a page, I just want to show normal posts + ones with featured tag and don't want to show posts with "sold" tag. How can I do the query for this? Thanks


How can I retrieve a Featured Image thumbnail using only the Post_title?

Is it possible to get the Wordpress featured image of a post using only the post_title name? I know it can be done with post->ID but I only have the post_title name to work with and this is outside of the loop.


Excerpt displays the current page excerpt not one being pulled

Just as the title says this code is not pulling the excerpt from $recent like it should be, instead it is pulling it from the current page.                  <?php     $args = array( 'post_status' => 'pending');     $recent_posts = new WP_Query( $args );          foreach( $recent_posts as $recent ){     $recent->the_post(); // Add this here to cause the other functions to work without the post ID         echo '

';         echo get_the_post_thumbnail($recent["ID"], 'thumbnail');         echo '
';         echo '
' .   $recent["post_title"].'
';         echo '
' . get_the_excerpt() . '
';         echo '

';     }          ?>      `get_the_excerpt($recent["ID"])` is the part pulling the excerpts, tried using the_excerpts and swapping it around to `($recent[get_the_excerpt])` too, nothing I try seems to work. Example: streakingpirates.com


How to call custom posts

I have this custom post:               add_action('init', 'eveniment_register');          function eveniment_register() {         $args = array(             'label' => __('Evenimente'),             'singular_label' => __('Eveniment'),             'public' => true,             'show_ui' => true,             'capability_type' => 'post',             'hierarchical' => false,             'rewrite' => true,             'supports' => array( 'title', 'editor', 'thumbnail', 'excerpt', 'comments' ),             'taxonomies'    => array('category','post_tag','post_thumbnail')              );              register_post_type( 'eveniment' , $args );     }      And all those custom-posts have a category with `ID=5.` In `category-5.php` I want to show all custom posts from that category. How I did it with normal posts with:               while (have_posts()) : the_post();       doesn't work with custom posts. Any ideas? Thanks!


How to use scripts when header/footer are stripped out

I'm working with a client who is wrapping the body of our WordPress site with their own external header and footer, stripping out our header and footer. Our enqueued plugin scripts then, aren't working because our header and footer aren't used at all. Also, it seems to me that NO plugins would work if they're not using our header/footer (not just the ones we've enqueued in functions.php). Is that true? * * * THIS DOESN'T WORK - YOU CAN SKIP IT UNLESS YOU JUST WANT TO READ IT. I talked with some smart folks at our Meetup about it, and they said I could print the scripts using the snippet below in my functions and they would then work again (mostly, but that this is a wonky work around). I've tried this, and so far it doesn't seem to be working. I would like to know why this should work - what does it do? If I understood it better, maybe I could figure out what is wrong.               function enqueue_scripts_the_wrong_way() {         printf( '<script src="%s/js/jquery.stellar.init.js" data-load-script="1"></script>', get_stylesheet_directory_uri() );     }     add_action( 'wp_footer_print_scripts', 'enqueue_scripts_the_wrong_way' );      * * * WHY DO THIS ANYWAY? @norcross asked on Twitter if I would explain why the client needs this in the first place. It might be helpful to know I was only contracted to design/develop the WP theme I'll talk about. The client has an existing website, parts of which used a WP site (for their blog), and parts of which use a custom CMS. They are essentially a small business social network, and that site has a lot of dynamic content based on the user's logged in/logged out status, and that passes around user's info. They wanted to move the more static parts of that website, and the blog, entirely to one WordPress installation so the marketing dept could better manage it (apparently the custom CMS is a pain). BUT, the header and footer on the website contains some of that logged in/logged out context. I told them that WP could get their external user database and work with it, but that's more than I personally know how to do - however I know lots of devs who DO, and that when the time came, I would make the right introductions. They said it wouldn't be necessary because they could wrap the WP content with their header and footer, since essentially all they wanted from the WP install was the content. They have some folks who are familiar with WP working on the project, so I assumed that however they were doing this, they would know that they had to somehow maintain the integrity of the WP header and footer, but I was wrong. What we've ended up with is well, exactly what they said, their header and footer with our body content. The WP install does have the header and footer with the wp_head and wp_footer calls in it (that's all, though), but however their wrapper works, it's not using them.


How do I successfully create a hook for an email override?

I'm creating an online apartment rental application using Visual Form Builder Pro. I need to have completed forms go to certain managers based on the property selection. Once a user selects a property location and submits the form, it must be routed via email to the appropriate apartment manager. For example, I choose Arlington Arms Apartments in my application, complete the form and submit it. The Arlington Arms manager should be the only individual who receives my completed application via email. I started out with creating a vfb_override_email_114.php file but I'm not sure where to save it so that my code will be picked up once a submission occurs. I'm inexperienced with code so any help would be greatly appreciated! Application: http://simco-apts.com/testsite/?page_id=140 Code so far:               <?php     /*     Email Override for Applications      */     ?>     <?php      add_action( 'vfb_override_email_114', 'vfb_action_override_email', 10, 5 );          function vfb_action_override_email( $emails_to, $form_subject, $message, $headers, $attachments ){         // Checks radio button. Use Merge Tag to get $_POST id         if ( 'Arlington Arms' == $_POST['vfb-5'] )             $emails_to = array( 'arlingtonarms@simco-apts.com' );         elseif ( 'Crestview' == $_POST['vfb-5'] )             $emails_to = array( 'crestview@simco-apts.com' );              // Send the mail         foreach ( $emails_to as $email ) {             wp_mail( $email, $form_subject, $message, $headers, $attachments );         }     }


date_i18n() issue

I'm trying to use date_i18n() to display a localised date in my theme.               <?php echo date_i18n( 'F j, Y',  strtotime( get_the_time( "Y-m-d" ) ) ); ?>      However, this always returns the English version of the month, rather than the French version. I'm using wordpress as a network. My primary site has the default WPLANG (so english), and I'm setting the second site to french by setting the WPLANG to fr_FR in site-settings. Other translations on the page are working fine, so wordpress is aware that the language is different. I downloaded the necessary .mo and .po files for French, but it doesn't have months in there, so I assume there's somewhere else these are set/used. Any help would be appreciated as I've been stumped by this for hours.


Remove image height/width attributes from Image Widget

The Image Widget includes `width` and `height` on the images which I've unsuccessfully have been trying to filter out so I can have fluid width. I've tried the following, which seems to be the most common solutions for similar problems, in `functions.php`, but without success:               function responsive_image_widget( $attr = array() ) {         unset($attr['width']);         unset($attr['height']);         return $attr;     }     add_filter( 'image_widget_image_attributes', 'responsive_image_widget' );      and               function responsive_image_widget($html) {       $html = preg_replace('/(width|height)=["\']\d*["\']\s?/', "", $html);         return $html;     }     add_filter('image_widget_image_attributes','responsive_image_widget', 10);      Here is a link for the Image Widget's filter documentation. Any help is much appreciated!


How to create resized versions of images added with wp_insert_attachment

I'm uploading images to my media gallery and setting them as my post's featured image, which is working quite well. I'd like to generate thumbnails of these featured images, in the same way that Wordpress handles creating resized thumbnails when an image is added through the Insert Media pane, where it creates multiple files, each with the new dimensions specified in the file name. Unfortunately, I'm having a lot of trouble locating anything that explains how this would be done properly. Below is the relevant code. It successfully creates the post and sets the featured image to the media file, but doesn't generate thumbnails to go with it. Any help would be greatly appreciated!               // If the post was created     if($post_id) {              // Add meta/custom field data         add_post_meta($post_id, 'gif_random_id', $randomId);              // Add uploaded file to the actual Wordpress image library         global $uploadURL;         $filename = $uploadURL . $randomId . '.' . $fileExtension;         $wp_filetype = wp_check_filetype(basename($filename), null);         $wp_upload_dir = wp_upload_dir();              $attachment = array(             'guid' => $wp_upload_dir['url'] . '/' . basename($filename),              'post_mime_type' => $wp_filetype['type'],             'post_title' => preg_replace('/\.[^.]+$/', '', basename($filename)),             'post_content' => '',             'post_status' => 'publish'         );              $attach_id = wp_insert_attachment($attachment, $filename, $post_id);              $attach_data = wp_generate_attachment_metadata($attach_id, $filename);         wp_update_attachment_metadata($attach_id, $attach_data);              // Now set the attachement as the featured image         update_post_meta($post_id, '_thumbnail_id', $attach_id);          }


How to get Author ID outside the loop

I can't get the post author ID outside the loop to make the get_the_author_meta work. So far I've tried different approaches: 1.               $author_id=$post->post_author;      2.               global $post;     $author_id=$post->post_author;      3.               $post_tmp = get_post($post_id);     $author_id = $post_tmp->post_author;      4.               $author_id = $posts[0]->post_author;      I need the author ID to pass it on to:               $address = get_the_author_meta('user_email', $author_id);      Any suggestions?


How can I directly upload smartphone videos to blog and comments?

I am using MAMP and WordPress to locally host and test my video website on my Macbook Air (using the templatic "video" theme). I am trying to find the simplest way to easily upload and embed videos (with the player visible and not just a link) taken from my smartphone to my blog. I am also trying to find a way that commenters can easily upload videos (and embed them so not just a link to the video is present) from their smartphones (preferably directly) to the comments of my blog. Is there an easy way to do this (without first uploading the video to youtube or another source)? The whole concept of the blog and comments is to have video discussions (between me, the blogger, and commenters, or also between various commenters) on a topic that are recorded on a smartphone and uploaded easily onto the website. I have been researching ideas and plugins for over a week. Any suggestions would be greatly appreciated.


Whats the best way to share user data across multiple Wordpress websites?

First of all, Multisite isn't what I'm looking for. I have 5 websites using Wordpress all on separate domains that I would like to enable user accounts for. I need user data to be shared across the entire network and when a user creates an account, they would have instant access to all other websites as well. What I'm trying to do isn't recommended by Wordpress when using Multisite: > If you plan on creating sites that are strongly interconnected, that share > data, or share users, then a multisite network might not be the best > solution. -http://codex.wordpress.org/Before_You_Create_A_Network (1st > paragraph, 3rd sentence) I've tried using the "shared user table trick" as mentioned here http://wordpress.org/support/topic/multiple-sites-same-users-how and here http://xentek.net/articles/528/implementing-the-wordpress-shared-users-table- trick/ and a number of other places...the problem is that this information is 2-7 years old and I'm using Wordpress 3.5.1 and this "trick" doesn't seem to work. I've attempted to insert this code into wp-config around the `$table_prefix` line.               define('CUSTOM_USER_TABLE', 'wp_users');     define('CUSTOM_USER_META_TABLE', 'wp_usermeta');      Long story short, I don't think this trick works any more as I am unable to log in to the second site on the admin side at all. Any suggestions on what the best way to link this data would be?


Ajax call does not work for this custom code

I have this ajax call which gets the value for catname:               jQuery('.bio a').click( function(){         var catname = $(this).closest(".bio").data('category');             alert(catname);         jQuery.ajax({           cache: false,             type: 'POST',              url: 'http://www.mysite.com/wp-admin/admin-ajax.php',               data: {                   action: 'performers',                 catname: catname                 /*nonce: nonce,*/             }         });       });      I have this function which updates a custom field:               function performers(){           $test = $_POST['catname'];           return $test;         }       add_action('wp_ajax_nopriv_ performers', 'performers');       add_action('wp_ajax_performers', 'performers');        I use the $test variable in single.php Questions:   1. Any idea why is this code not working? **jquery var catname is being set** (tested this with the alert). Maybe it has to do with caching? I did try to update a custom field with $test variable and retrieve the value of that custom field in single.php, still no luck.   2. I saw a tutorial using nonce? Do you advise me to use it? How? I have tried this, still no luck (called performers(); in single.php in order for it to work.               function performers(){               $test = $_POST['catname'];             update_post_meta(758, 'perfx', $test);         }           add_action('wp_ajax_nopriv_performers', 'performers');           add_action('wp_ajax_performers', 'performers');


Custom reset password template after forgot password request

I've made a custom login template where you can login or request a link that sends you to the reset password form. What I need to do is make that unique link redirect to a custom reset password template (not wordpress's default). So this is kind of a two part question on how first to send a link to a custom template and how to show a custom reset password template (not the "forgot password form). Any ideas?


Change which sidebar get_sidebar() gets from functions.php

I have this code in a template file, which loads `sidebar-sidebar_a.php`:               get_sidebar('sidebar_a');      I would like to add a function to sidebar.php which has the effect of changing that to this if some condition is met:               get_sidebar('other');      so that it instead loads `sidebar-other.php`. I thought that this would work, but it seems to have no effect:               add_action('get_sidebar', 'my_sidebar_logic');          function my_sidebar_logic($sidebar) {         // Load a different sidebar if the user is logged in         if (is_user_logged_in()) {             return 'other';         }              return $sidebar;     }      What can I do to get the effect I want?


get_pages sort alphabetically by meta value

I operate a real estate website, and I have a list of homes we are selling. I am using a bunch of custom fields to store information about the homes. When you click on a home in the home listing page (page, not post), it takes you to a dedicated page (again, not post) for that home. I'm very new to PHP and Wordpress. Right now the code I am using (get_pages) is working to display all the pages I want it to, but it is sorting by the post_date. Instead, what I want it to do is sort alphabetically by one of my Custom Field meta values; specifically, to sort A-Z by the street address. Is there any way I can use the "sort_column" parameter to do this? Everything I've found from searching has been related to getting _posts_ instead of _pages_. Here is my current code that gets the pages:               <?php $listingPages = get_pages(              array(                 'sort_order' => 'ASC',                 'sort_column' => 'post_date',                 'meta_key' => 'houseNo',                 'post_type' => 'page',                 'post_status' => 'publish'             )         );              foreach( $listingPages as $page ) {                  $content = $page->post_content;             if ( ! $content ) // Check for empty page                 continue;                  $content = apply_filters( 'the_content', $content );         ?>

<a href="<?php echo get_page_link( $page->ID ); ?>"><?php echo get_post_meta($page->ID, 'houseNo', true); ?> <?php echo get_post_meta($page->ID, 'streetAdd', true); ?>

         <?php         }     ?>      Please excuse my dirty code, I'm a complete noob and am totally on my own with this and have no professional training. So basically I'm wondering if I could do something like this with the sort_column parameter (this obviously doesn't work):               <?php $listingPages = get_pages(              array(                 'sort_order' => 'ASC',                 'sort_column' => get_post_meta('streetAdd'),                 'meta_key' => 'houseNo',                 'post_type' => 'page',                 'post_status' => 'publish'             )         );      I don't even know if I'm asking the right question, or if I need to use some sort of custom query called from functions.php or something. I'm open to whatever I need to do to achieve this. Thank you for your help!


Custom post type slideshow background images to insert in a plugin

I have a slideshow which is populated with background images from a custom post type. Here's my code:               <?php     // start the loop     foreach($slider_posts as $post) : setup_postdata($post);     // get image     $thumbnail = wp_get_attachment_image_src(get_post_thumbnail_id(), 'home-slide');     ?>          <script type="text/javascript">             $(function(){                      $.mbBgndGallery.buildGallery({     //              containment:"#wrapper",                     containment:"body",                     timer:5000,                     effTimer:5000,                     controls:"#controls",                     grayScale:false,                     autoStart:true,                                   images:[                         "<?php echo $thumbnail[0]; ?> "                     ],                      });             });         </script>     <?php endforeach; ?>     <?php wp_reset_postdata(); ?>          <?php } ?>      This code displays just one slide image and not all the slide's images! How can I fix it?


Show only, when taxonomy has posts?

I'd like to query posts by taxonomy like this:               <?php     global $post;     $terms = get_the_terms( $post->ID , 'movies', 'string');     $do_not_duplicate[] = $post->ID;          if(!empty($terms)){         foreach ($terms as $term) {             query_posts( array(             'movies' => $term->slug,             'showposts' => 4,             'caller_get_posts' => 1,             'post__not_in' => $do_not_duplicate ) );             if(have_posts()){                 while ( have_posts() ) : the_post(); $do_not_duplicate[] = $post->ID; ?>     do stuff                       <?php endwhile; wp_reset_query();             }         }     }     ?>      But I only want to show this, while there are posts with the same taxonomy to show up. How could I do this? Something like: if has taxonomy AND has post? Thanks! AD


How can you showcase various premium themes to clients without having to pre-purchase the theme?

If you use a premium theme service (my skills lie more in coding than artwork), what is a good way to show clients examples of what themes are available to them, without sending them to the theme service site in the first place (ie - without letting them see the original purchase price), but without having to purchase the theme upfront? I know I can make a dummy WP site and use a theme switcher, but I don't want to purchase a bunch of themes that may never be used.


Comment form validation

How can I set the validation rules for the comment field? I change the value of commenter name/e-mail/homepage onmouseover and onblur (I use this instead of labels - so if the field is empty it displays "Your e-mail", "Your homepage", etc.). The problem is, on submit, it submits this text in the homepage field (since it has no validation unlike the e-mail field where you get an error if you entered anything except something@something.something). How could I validate the homepage field?


Removed slug from CPT, now How/where do I hook the filter to the taxonomy term archive pages link?

I added the code below and successfully changed my CPT slug for the taxonomy terms. My blog permalinks are /article/%postname% in case you wonder, and I'd like to keep it that way, so no clashes with CPTs. It works fine and I got rid of the CPT slug in the single CPT's permalink ("listings").               function listing_type_link_filter_function( $post_link, $id = 0, $leavename = FALSE ) {         if ( strpos('%listing_type%', $post_link) === 'FALSE' ) {           return $post_link;         }         $post = get_post($id);         if ( !is_object($post) || $post->post_type != 'listing' ) {           return $post_link;         }         $terms = wp_get_object_terms($post->ID, 'listing_type');         if ( !$terms ) {           return str_replace('/listing_type', '/', $post_link);         }         return str_replace('%listing_type%', $terms[0]->slug, $post_link);       }          add_filter('post_type_link', 'listing_type_link_filter_function', 1, 3);      It works fine, and instead of: `mysite.com/listing_types/tours/tour-name (CPT "listing" post)` those posts show as:               mysite.com/tours/tour-name      and they are found correctly for any of the following               mysite.com/listing_type/tours/tour-name     mysite.com/listings/tours/tour-name     mysite.com/listing_types/tours/tour-name     mysite.com/listing/tours/tour-name      Now I need to hook the same or similar filter to the term archive links filter, which I can't find, if there's any. so instead of `mysite.com/cpt_slug/taxonomy_term` (archive page) I'd get `mysite.com/taxonomy_term` (archive page) …because the most important things in my site are those terms: listing_types, (tours, attractions, events) but I can't let the "listings" or "listing_types" slugs to show, even when they ARE listings for me. Do you know what hook and how should I filter it to replace the listing_type slug from the TERM ARCHIVE pages link? Or is it easier to set the general permalinks settings page as %term%/%postname% and make the CPTs to use it, and customizing the regular posts instead? –since most of defaults could benefit to the CPTs and the posts have no terms. Thanks.


Difference between Option_Group and Option_Name in Register_Settings

I think the title pretty much says it all! I'm working my way through various tutorials on how to add an options page to my test plugin and am struggling to understand the `Register_Settings` function. Every tutorial I have found quotes the codex for the arguments then uses the same text in the `Option_Group` and `Option_Name` argument. Can someone explain it to me please?


Can a custom post type have a Parent Page?

I've seen a lot of posts out there in the Webiverse about assigning a page as a parent of a custom post type. After four hours I can't find a solution and need some help. I've create an "About" page that is the parent of an "Our People" page. I've also create a custom post type called "People". And I've created a custom page template for the "Our People" page. The Permalink structure looks fine until you get to the single "people" page. For Example: John Smith's Page, the permalink isn't correct. **Custom post type:** _Desired Permalink Structure:_ /about-us/our-people/john-smith _Actually Permalink Structure:_ /our-people/john-smith **Our People Page Strucure:** /about-us/our-people The "about-us" is a page, "our-people" is a page and also the slug rewrite for the custom post type, "people". I've tried to change the hierarchical settings and I've tried adding "about-us/our-people" directly into the rewrite with no success. **Functions.php:**               function codex_custom_init() {         // Our People         $people_label = array(             'name' => 'People',             'singular_name' => 'People',             'add_new' => 'Add People',             'add_new_item' => 'Add New People',             'edit_item' => 'Edit People',             'new_item' => 'New People',             'all_items' => 'All People',             'view_item' => 'View People',             'search_items' => 'Search People',             'not_found' => 'No People found',             'not_found_in_trash' => 'No People found in Trash',             'parent_item_colon' => '',             'menu_name' => 'People',         );         $people_args = array (             'labels' => $people_label,             'public' => true,             'publicly_queryable' => true,             'show_ui' => true,             'show_in_menu' => true,             'query_var' => true,             'rewrite' => array( 'slug' => 'our-people'),             'capability_type' => 'page',             'has_archive' => true,             'hierarchical' => true,             'menu_position' => null,             'menu_icon' => get_template_directory_uri() . '/images/icons/people.png',             'supports' => array('title', 'editor', 'author', 'thumbnail', 'excerpt','page-attributes'),         );              register_post_type('people', $people_args);     }      **My Custom Templates:** people.php people-single.php


menu doesn't show in different languages

I have a custom menu on a site with multiple languages (WPML plugin) The menu is not being displayed in any languages other than native.   1. Can the menu be translated?   2. Can the menu be shown in all languages without any change to the text? (when it's mostly names that shouldn't be translated)


Backend menu that shows pages with specific page template and their child pages

I've set up a menu in the backend that shows a list of pages that have a specific page template assigned to them. I've managed to do this using the code below, but I also want to display the child pages for each of these pages. The child pages do not use the same page template. Any idea how I can do this?               add_action('admin_menu','add_hub_page_menu');     add_action('load-edit.php', 'filter_hub_pages_mysql_action');           function add_hub_page_menu(){         add_pages_page('Hub Pages', 'Hub Pages', 'manage_options', 'edit.php?post_type=page&page_template=hub_template');     }          function filter_hub_pages_mysql_action() {         if ($_GET['post_type'] !== 'page') return;         switch($_GET['page_template']){             case 'hub_template':                 add_filter('posts_where', 'hub_pages_where_filter' );                 add_filter('posts_join', 'join_filter' );                 break;             default:                 break;         }     }          function hub_pages_where_filter($sql) {         global $wpdb;         $sql = " AND $wpdb->postmeta.meta_key = '_wp_page_template' AND $wpdb->postmeta.meta_value LIKE 'hub-template.php' " . $sql;         return $sql;     }          function join_filter($sql) {         global $wpdb;         $sql = " JOIN $wpdb->postmeta ON $wpdb->posts.ID = $wpdb->postmeta.post_id " . $sql;         return $sql;     }


Querying posts from multiple sites in a network?

I realize there have been a few questions which dance around the solution I am after but I believe I am looking for something specific. This is actually a two part question: 1) My goal is to have wordpress operate in network (multi-site) mode and I am trying to figure out a way to essentially "group" specific sites together. I am aware of the "Multi-Network" plugin but I question if this is the best approach for this? The key here is to allow specific users to add/edit the sites within their own sub-network. 2) This is the key question of this post... I would like to know the best approach which would allow me to essentially query posts from within this "sub-network" of sites. So, for example if there are 10 sites within this sub- network and each of them created posts within a custom post type called "news" then I would like the ability to display for example the 10 most recently published posts from this collection of 10 sites. NOTE: I need the ability of being of being able to create multiply sub- networks which in turn means that a query of the latest published "news" can only display posts from those belonging to the correct group. Finally - I do realize solutions exist for doing stuff like this but I am looking for the best approach on both cases which require the LEAST amount of database load/queries. I would also very much like to do this through code in my functions.php file rather than installing plugins which create extra bloat. I am very open to any suggestions and appreciate any response.


How do I remove this menu bar?

I just use the pages for navigation. I don't need the menu bar that has the single item - uncategorized. Here is the link to the theme being used. http://themeforest.net/item/deadline-premium-wordpress-news-magazine- theme/faq/117203 Is this a theme issue or part of the word press core?


One Wordpress Install, Two Categories. Each Category Gets a Domain

Ok here is a setup I am aiming for, hopefully someone knows how to get me there:   * One Wordpress Install on www.mainsite.com   * www.mainsite.com will be a landing page that points to two Category links: Work, Play   * Work Category defaults to domain www.worklife.com   * Play Category defaults to www.play.mainsite.com   * Any other Wordpress Pages will maintain www.mainsite.com as domain (ex. www.mainsite.com/contact) Right now the old blog resides on worklife.com, so I am hoping to prevent the URLs of individual postings from changing (ex. www.worklife.com/2010/01/01/post) as I migrate the install to mainsite.com For now, I have built the site, and all of the loops and pages are functioning correctly. The only thing left to do is get the domains to play nice so I can make the move. All of my research keeps pointing me towards creating a network, but I'm hoping there is a way to keep it all running on a single install. Can it be done?