Post Status Frontend Announcement

I want to announce the logged-in user in front end (theme, not the backend), how many posts he has with htis statuses:   1. awaiting moderation   2. approved (published)   3. not approved(rejected) since last announcement. Are there any plugins for this? Are there any good keywords to search for such a thing?   thanks.


Pulling Content from Existing Database

I am moving an existing site to wordpress. The existing site already has thousands of rows of data (items for a shop) stored in a different database. I dont want to import this data directly into wordpress as addtional data will be added to this pre-existing database. What I would like to do is somehow be able to pull in the data from this external database via wordpress. For example, if I accessed `www.site.com/shopping/345` this would pull in row 345 from my existing database. Is this possible with a custom post type to map the existing content from my current database without having to create it all in wordpress too - or is there another way to do it? Thanks


Overriding TinyMCE buttons - Justify button shortcodes not working

**Problem** I'm trying to customise the TinyMCE text editor. Several of the common options for overruling Tiny MCE didn't seem to work for me. So instead I overwrote the functions in my functions file:               function tinymce_editor_buttons($buttons) {             return array(                     "justifyleft",                     "justifycenter",                     "justifyright",                     "bold",                     "italic",                      "underline",                     "bullist",                     "numlist",                     "link",                     "hr",                     "undo",                      "redo",                      "separator",                     "pastetext",                     "removeformat",                     "formatselect",                     "styleselect",                     );             }     add_filter("mce_buttons", "tinymce_editor_buttons", 99);          function tinymce_editor_buttons_second_row($buttons) {        //return an empty array to remove this line         return array();     }     add_filter("mce_buttons_2", "tinymce_editor_buttons_second_row", 99);      This works great except for the justify functions and separator, which don't appear. This post lists all the shortcodes, so I think I have the correct codes, and removing and adding other options works, however these two don't. Why would these options not appear when all the others do?


Add the current menu item CSS class to a custom page type archive in Wordpress menu

I've been reading a lot about this but couldn't find a solution. Basically I'm trying to show a current menu item on a dynamic page that is created by a custom page type archive. The default menu control doesn't add the current-menu-item CSS class names. I've found a solution here - http://bloggingsquared.com/blogging-tips/how-to-add-the-current-menu-item-css- class-to-a-custom-link-in-a-wordpress-menu/ Which is like this:               add_filter('nav_menu_css_class', 'AddCurrentMenuItemClass',1,2);          function AddCurrentMenuItemClass($classes,$item)     {         $link = site_url().$_SERVER['REQUEST_URI'];         if(strpos($link, $item->url) !== false)         {             $classes[] = 'current-menu-item';         }         return $classes;     }      The problem I'm having is that the Home page (which is a custom menu item) is highlighted as well as the page I'm on. If I change the if statement to:                    if ( $link == $item->url )      Then in works on that page as but not on sub pages. Can you please help me sort this out? I'm working on a client project with a right deadline... I'm on WP 3.4.2 with a premium WooThemes template: Whitelight


Wordpress capabilities and restricted categories access

I've a Wordpress blog to share content with some people only. Users has to login to access this website. I created new roles and new capabilities on this blog. I've got some articles which belongs to a certain category that I would like to share only with people with a certain role. Is there a hook I could use when somebody request an article, and where I could test if the curent user has the good capabilities, and so modify the request if needed?


How to get the month argument from permalink in wordpress?

I am working on a custom Wordpress template for the archive. I have the archive set up by category but now I want to organize by category and month but I can't figure out how to access the month argument from the permalink. How would I get access to that argument.


Converting the_content string to an array?

I have created a custom taxonomy, this taxonomy is dedicated to image attachments, when I upload my images `$post->post_content` returns a string like:               '[caption id="attachment_98" align="alignnone" width="300"]                             caption[/caption]'      By calling `the_content()` this string becomes an HTML markup, at codex I couldn't find a function that allows me to get the source of the image and caption/description/title of it in a dynamic way, is there a way to output the content without using `the_content()` function? Should I _split_ the result?


How can I modify my meta_query to work with prices that are stored in the database that contain dollar signs and commas?

My goal is to return posts based on a specific price range using `meta_query`. The price in the admin that the user enters is a custom field, created using WPAlchemy. In the example below, the query would return any posts with a price value between 1000 and 1500:                       'meta_query' => array(                 array(                     'key' => '_my_price',                     'value' => array( 1000, 1500 ),                     'type' => 'numerical',                     'compare' => 'BETWEEN',                 )),      It works fine if a price value was entered as `1200` (and stored as 1200 in the DB), but how could I get this working for prices that are stored in the database that have dollar signs and commas such as `$1,200`? Ideally I would like all price values on the website to be consistent, so I'm using a Javascript currency formatter that converts the prices, which is why I'm asking. If a user enters 1200, it converts it to `$1,200`, which is then stored in the database. The meta_query doesn't think this is a number and therefore returns no results. Or maybe there's a better method. Would it be better to ditch the JS formatter on the input fields in the admin and instead add the dollar sign and comma separation on the front end? This seems more logical, but then it raises another question of how to prevent a user entering a dollar sign or comma formatting in the admin.


Unwanted blank lines before <html> tag

I've a strange problem with an Autofocus theme. In my templates file, header.php, I've a code like this (and is correct)               <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">     <html xmlns="http://www.w3.org/1999/xhtml">      When I look at the source code of the generated HTML, I found something like this               [blank]     [blank]     <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">     <html xmlns="http://www.w3.org/1999/xhtml">      The extra blank lines are breaking my RSS feeds... Other info:   * No filters on the content except wpautop   * functions.php doesn't do anything on the content   * Plugins All In One Seo, WP Stats, Smiley Remover, SEO Friendly images Any clues?


Easy lightbox effect inside of dashboard widget

I've got a dashboard widget that pulls from an RSS feed on my central server and allows anyone using my theme to see newly available skins. Using the dashboard widget, I'm currently presenting a thumbnail image of the skin along with a description and a link to download. I'd like to enable the thumbnail so that when clicked, it will open the full size image in a lightbox over the wordpress dashboard. I want to install as little extras as possible to make this possible. My theme is already including jquery-1.4.2.min.js and I'd like to build off that if possible. Any ideas much appreciated.


Email confirmation on registration

**I have set up the registration form using this chunk of code:** `wp_create_user($username, $password, $email);` Note that i have did all kinds of validation before use this code. The registration is working fine now. But it register and activate the user account immediately after the form get submitted. What i want is confirming the email of a user before they can use the account. User have to check there email account and click the confirmation link and user account get registered/active.


wp_set_object_terms not working inside loop

I have the following code               $genres= array('action', 'comedy', 'horror');     foreach($genres as $genre){           $ret = wp_set_object_terms( $postId, $genre, 'genres');     }      But this code associates only horror as the genre. When I checked the DB too, I don't have a record for action and comedy. How do I associate all the three with my genre? Thanks in advance.


overwrite a plugin function in functions.php

need to customise a plugin function but would rather not edit the plugin itself so updates wont remove the custom changes. function iss in a class called _UserAccessManager_ and the function is;               public function showGroupMembership($link, $postId)     {         $uamAccessHandler = &$this->getAccessHandler();         $groups = $uamAccessHandler->getUserGroupsForObject('post', $postId);              if (count($groups) > 0) {             $link .= ' | '.TXT_UAM_ASSIGNED_GROUPS.': ';                  foreach ($groups as $group) {                 $link .= $group->getGroupName().', ';             }                  $link = rtrim($link, ', ');         }              return $link;     }      is this possible? OR can i affect it with a filter? Any help appreciated! Dc.


PHP if Condition not working

I'm trying to create a condition in Wordpress that only calls the `wp_head()` on all pages except for the "About Us" page and "News Articles" pages. Here's the code:               <?php if (!is_page('about-us') || !is_page('news-articles')) {wp_head();}?>      It seems to work great when I only use the command for one of the pages, but using an operator seems to mess things up. In some cases the pages load correctly, but the desired results are not happening. I've also double-checked to make sure that I'm referencing the pages correctly, and I'm confident that I am.


How to increase the file size limit for media uploads?

How can I change the Maximum upload file size? I would like to be able to upload 10Mb at a time. ![alt text](http://i.stack.imgur.com/9PZ7Q.png)


create custom page for statistical data capture and reporting

I am not too comfortable coding in PHP yet, but am currently working on a project where I need to create a custom page for the website, in a member area, where the members of the site can capture certain data, like total income for the day, number of calls made during the day, etc. Once this has been done I need to be able to display certain reports on this data, such as your statistics for the day, month, year-to-date etc. Can anyone please point me in the right direction on what will be the best and easiest way to do this. I am not averse to coding, as I come from n Microsoft coding background, back in the day, I am just unsure where to start in PHP and Wordpress.


How can I un-reserve a pending username registration?

I am setting up a new WordPress Multisite instance, and am still working out some kinks in the stack. Most significantly at the moment, user registration emails are not being delivered for some reason. As a result, several usernames are stuck in limbo as the confirmation emails necessary to activate them are lost. For now I would like to just manually register these usernames without confirmation emails, but when I try to do so I get an error saying the name is reserved and may be available in a couple of days. How can I un-reserve them?


Using Disqus, how to stop storing comments in wp database?

I'm using disqus comments system, but it keeps storing the comments in the wordpress database as well. Is there way to disable option to store comments in wordpress database because I don't see any use of it.


Is there a way to set the value and text for Select/Radio/Checkbox using More Fields?

I'm using more fields to add a "Voltage" field to one of my More Types using their More Fields plugin. I want to be able to order the posts by Voltage, but if I use the text values is doesn't order properly...my values are 4.0KV, 13.6KV, 27.6KV and 44KV. I'd like to be able to set the value of the radio and the text so I can use 4000, 13600, 27600 and 44000 as the actual field values, but show the user 4.0KV, 13.6KV, etc. Is this possible with More Fields?


Redirect away from login page

I'm trying to find a way to prevent the login screen from showing up when user makes a mistake filling out the login form. So, right now, I have the login form printed on a custom template. But if the users makes a mistake filling it out, it redirects them to the wordpress form to try again. I want to redirect away from that. This is the code I had but it's not working.               add_action('login_form', 'redirect_invalid_login');          function redirect_invalid_login(){         global $error;              if($error)             header('Location: '.get_bloginfo('url').'/client-login/?message=6');     }      Now login_form is too late I believe because stuff already gets printed to the page. I haven't been able to find a hook that works. Is there a hook for this? Or perhaps a different way to do it?


How to make Full width picture with form on top?

it's my first time and i'm new to wordpress. I'm looking at making a slider on the main page on top with a form on it that looks like in the attached picture. is there a plugin that can do this for me or what is the best way to do?


Wordpress Table didn't look right

I want to build a table based layout. In the editor all look right: ![enter image description here](http://i.stack.imgur.com/8AxFs.png) But after saving, the page look like this: ![enter image description here](http://i.stack.imgur.com/MCb3w.png) Can someone help? UPDATE: The Theme is **Pagelines framework** And here the code =


$wp_query issue when trying to create a virtual page

I am trying to create a virtual page for my plugin and I am having a $wp_query reset issue when doing so. I am using the class https://gist.github.com/brianoz/9105004 to create the virtual page. I can get everything to work ok but the issue is whenever there is another loop on the page whether from a widget plugin in the sidebar it will return the $wp_query set from the virtual page. The virtual page class has taken over the page and I can't find a way to make it so any other queries on the page will work. Thanks.


Check for Facebook comments in a post?

How can I check if a post has Facebook comments on it and create a conditional statement? I'd like to show a small comments icon if any comments have been made. Even better, anyone know how to get the comments count from it as well? Thanks


Display users uploaded files as posts

So I have implemented the functionality where anyone can upload certain types of files with a title and description. I am having trouble with the idea displaying them as posts or list in the a certain page. I am not sure how should I approach to make this possible. Before posting here, I have searched other communities and off course tried google but still no hope. I know this is not a stackoverflow type question but I had to post this hoping the experts here can help me get on a track. Basically it is a form where three fields are shown one being the title and others are for uploading a file and a text area for description. What I want is to make it a single custom post every time someone fill the form. In the backend, they can be shown as posts where admin can edit or delete just like typical wordpress posts. I hope I have explained this well enough. Thanks and any link or resources are appreciated.


ID of last created category

How to get ID of last created category? I tried use this to for loop, which displays the posts in category boxes.


Attachment page custom title?

Look what I want to do... I want to edit < title > < /title > from < head > < /head > on attachment page. Right now I have like this: **POST PARENT TITLE (no - or | here ) IMAGE TITLE - MY BLOG TITLE** I want to show like this **IMAGE TITLE | MY BLOG TITLE** How can I do this? I really want to do it. in ALl in one seo pack is not this option.. Regards!


How to Trigger comment_form_after action if comment_form() not used

A plugin I want to use has a filter like so: > add_action('comment_form_after','yoast_track_comment_form'); The theme I'm using doesn't use the comment_form() call and I believe that this means the filter isn't being called. The yoast_track_comment_form just adds some jquery tracking, so what is the best way to trigger it. Should I just call it directly from within the plugin code?


Widget internal hooks and functions

I am working on my 1st plugin, of some ideas to re-do the interface to how widget's are manage d and organized. Anyhow. I am struggling to get this information, either that or understand it.   1. Create a list in array, preferrably of all widgetized areas and their id.   2. Are there functions or methods to allow add/remove such widgetized areas, without editing the theme functions page? I've looked at the widget api, but I think that my scope is beyound what is available there, is there any additional information? Thank you.


Organizing Code in your WordPress Theme's functions.php File?

The more customization I make to WordPress the more I start thinking about if I should be organizing this file or splitting it up. More specifically, if I have a bunch of custom functions which only apply to the admin area and others which just apply to my public website is there any reason to possibly include all admin functions within their own file or group them together? Would splitting them up into separate files or grouping them together possibly speed up a WordPress website or does WordPress/PHP automatically skip over functions which have an is_admin code prefix? What's the best way to deal with a large functions file (mine is 1370 lines long).


Error Message from W3 Total Cache when .htaccess Rules Cannot Be Modified?

I have just installed the Plugin " W3 Total Cache " .I have enabled permalinks too. Then it is showing a message > Browser Cache feature is not operational. Your .htaccess rules could not be > modified. Please verify /home/..../public_html/..../.htaccess has the > following rules: SO I have pasted the code it has shown on with that message to my .htaccess file .But still it is showing the same error .Am I missing something? It is the code shown and I have added to .htaccess file                # BEGIN W3TC Browser Cache     <IfModule mod_deflate.c>         <IfModule mod_setenvif.c>             BrowserMatch ^Mozilla/4 gzip-only-text/html             BrowserMatch ^Mozilla/4\.0[678] no-gzip             BrowserMatch \bMSIE !no-gzip !gzip-only-text/html             BrowserMatch \bMSI[E] !no-gzip !gzip-only-text/html         </IfModule>         <IfModule mod_headers.c>             Header append Vary User-Agent env=!dont-vary         </IfModule>         AddOutputFilterByType DEFLATE text/css application/x-javascript text/html text/richtext image/svg+xml text/plain text/xsd text/xsl text/xml image/x-icon     </IfModule>     <FilesMatch "\.(css|js)$">         FileETag None         <IfModule mod_headers.c>              Header set X-Powered-By "W3 Total Cache/0.9.1.1"         </IfModule>     </FilesMatch>     <FilesMatch "\.(html|htm|rtf|rtx|svg|svgz|txt|xsd|xsl|xml)$">         FileETag None         <IfModule mod_headers.c>              Header set X-Powered-By "W3 Total Cache/0.9.1.1"         </IfModule>     </FilesMatch>     <FilesMatch "\.(asf|asx|wax|wmv|wmx|avi|bmp|class|divx|doc|docx|exe|gif|gz|gzip|ico|jpg|jpeg|jpe|mdb|mid|midi|mov|qt|mp3|m4a|mp4|m4v|mpeg|mpg|mpe|mpp|odb|odc|odf|odg|odp|ods|odt|ogg|pdf|png|pot|pps|ppt|pptx|ra|ram|swf|tar|tif|tiff|wav|wma|wri|xla|xls|xlsx|xlt|xlw|zip)$">         FileETag None         <IfModule mod_headers.c>              Header set X-Powered-By "W3 Total Cache/0.9.1.1"         </IfModule>     </FilesMatch>     # END W3TC Browser Cache      (I have added the same code here.Please let me know If adding such a long code is inappropriate here .I will remove it from this question)


Contact Form 7 Plugin send emails to my Gmail as spam

I just added Contact Form 7 to my site. I'm using the default configuration (didn't change any setting). The mails are classified as spam in my Gmail inbox. Is there any way of making them go directly to the inbox?


Remove the Inactive Widgets

I'm looking for a function, NOT A PLUGIN, that allow me to remove the Inactive Widgets... there was a topic before Script to remove all inactive widgets? with an answer, however it's not working for me. Any other solutions? Regards.! ![enter image description here](http://i.stack.imgur.com/utMps.png)


Add link option to featured image?

I've enabled my theme with featured image support. The one thing missing is the ability to add a user-defined hyperlink to the image. I'm pretty sure I can add a custom field, which I can then use to link to the image. However, I'd like this input field to be close to the featured image itself. Ideally, just below the "Remove Featured Image" link and inside the featured image div. I'd appreciate any help or insights you can provide to get my custom field attached to the featured image panel.


I can't access my site via wp-admin

I developed a site 6 months ago and now need to update it, but i can't access the login page to get in to it. I get a "this is somewhat embarassing" erro page. Tried wp-login.php at end of url as well but this also didn't work. Help please


Theres a way to use $query->set('tax_query' in pre_get_posts filter? for example next code is not altering the query. Note that im building $taxonomies from and custom search.               function custom_search_filter($query) {                  ...                  // array('taxonomy' => 'category', 'field' => 'id', 'terms' => array( 41,42 ), 'operator' => 'IN')             $taxonomies = implode(',', $taxonomy_arr);                  // https://wordpress.stackexchange.com/questions/25076/how-to-filter-wordpress-search-excluding-post-in-some-custom-taxonomies                  $taxonomy_query = array('relation' => 'AND', $taxonomies);                       $query->set('tax_query', $taxonomy_query);                   }              return $query;           }               add_filter('pre_get_posts', 'custom_search_filter', 999);      Thanks in advance.


Extending a CPT by Created by another plugin

I'm using WooCommerce for my store, and I need to be able to extend the Coupon post type... I need to add a selectable attribute of `membership_term` ... How do you extend a CPT created by another plugin? Is there an official hook that I'm not seeing to be able to modify an existing CPT?


Different permalink for posts and authors

I tried to avoid ask this question, because I think that must be simple, but after long hours trying to get an answer I cant achieve it. I am trying to get a permalink structure like this:               http://domain.com/u/USERNAME     http://domain.com/p/POSTID      To get that structure I set a "Custom structure" in the permalink settings of my Wordpress. This is the value of the custom structure:               /p/%post_id%      That is great for posts, but not for authors. Using that settings this is the result:               http://domain.com/p/u/USERNAME     http://domain.com/p/POSTID      And that can be changed via htaccess or functions.php. Any idea will help me a lot. Thanks!


How to include Google fonts

I'm converting an html/css template to a WordPress theme. The index.html contains the following Google font which I want to include in the header.php : http://fonts.googleapis.com/css?family=Bree+Serif' rel='stylesheet'> Kindly advise how I can do this. Regards Debashis


Nonces can be reused multiple times? Bug / Security issue?

I've read that nonces are meant to be for one time use only, and after an ajax request, you should issue a new nonce so with the next ajax request, a new nonce would be sent to the server. However, I just tested repeated ajax requests using the same nonce token, and for each request `wp_verify_nonce` returned true on the same token, meaning it could be reused dozens of times. Is this intentional, or a bug? Do I still need to issue new nonces with each ajax request, or can the same one continue to work for all future requests?


reason of splitting theme files to multiple files

I can create my theme without splitting it into separate files. Why do theme developers split WordPress theme into a few single files like header.php sidebar.php and etc?


Update exisiting site to 3.5 release candidate

I have an existing site that I want to update to 3.5 now, because I want to see if my plugins and themes work in it. I don't want to wait for the full release (when I'll be able to automatically update), and I don't mind that 3.5 is still in release candidate state. I could just copy in all the files from 3.5, but I'm afraid that there might be some database changes too. I don't want to set up a separate test site. This is a small site, and it won't be the end of the world if something goes wrong. How can I update an existing site to a non-final version of Wordpress?


Display custom taxonomy attached to the post on post single page

I need to display the first custom taxonomy attached to the post on post single page. The custom taxonomy is similar to category attached to the posts. I need to display the first custom taxonomy with link to be displayed. My initial thoughts is to use get_categories but theres now way to define a specific taxonomy? I get something similar for category by passing this kind of query:               <?php $category = get_the_category();     if ($category) {         echo 'term_id ) . '" title="' . sprintf( __( "View all posts in %s" ), $category[0]->name ) . '" ' . '>' . $category[0]->name.' ';     }     ?>      But something similar for custom taxonomy is not working. Any help is much appreicated, Thanks


How to change menu according to the language?

I want to change primary menu according to the language of the user. I have reviewed multi language plugins such as WPML and qTranslate. They have lots of features but what I want is much simpler than what they provide. There will be three links such as English, Arabic, and Turkish in the upper right corner. When the user clicks one of them, the menu bar should change accordingly.


Ajax autocomplete based on usercode

I am trying to build a webform with autocompletion. The user can fill in a personal code and the related fields will be shown in the form fields. How can I fetch the results into my form fields? What I tried so far:   1. Lookup the code in Javascript.   2. Use AJAX to send the code to PHP.   3. PHP looks up the code in the SQL query and fetches the result.   4. When I use the console and check the var_dump in the lookup_code() function I see the array from the user I want. Here is my code:               add_action( 'wp_head', 'ajax_lookup_userdata' );     /*      * Ajax_lookup_userdata      * Will check the string on the input field for the code.      */          function ajax_lookup_userdata() {     ?>          <script type="text/javascript">         jQuery(document).ready(function( $ ) {                  /*Lookup the field value.*/             var ajax_url = '<?php echo admin_url('admin-ajax.php'); ?>';             var codeValue = jQuery('li.code input');             var data;                  /* Limit the  keyup function... min characters and max characters. */             $(codeValue).keyup(function(e){                      data = {                     'action': 'lookup_code',                     'codevalue': jQuery(this).val()                 };                      // This gives me the output of the values you insert into the code-textfield.                 console.log(data.codevalue);                      jQuery.post(ajax_url, data, function(response) {                     //alert('Got this from the server: ' + response);                    console.log(data);                     console.log(response);                 });             });         });     </script>                    add_action('wp_ajax_nopriv_lookup_code', 'lookup_code'); // for not logged in users               function lookup_code() {          global $wpdb;          $searchQuery = $_POST['codevalue'];          $results = $wpdb->get_results('SELECT * FROM wp_contacts WHERE code LIKE "'.$searchQuery.'" ');          update_post_meta( $id, '_wp_page_template', 'new_template.php' );     // Here are my values that I want to receive.     // How to pass them to the field values?     //var_dump($results[0]);          die();     }      The var_dumps($results[0]); gives me the following output:               object(stdClass)#277 (8) {       ["id"]=>       string(1) "1"       ["code"]=>       string(2) "1a"       ["firstname"]=>       string(4) "Bert"       ["lastname"]=>       string(7) "Gibbers"       ["street"]=>       string(15) "Lazy Berry Edge"       ["no"]=>       string(2) "35"       ["email"]=>       string(18) "stone@meekness.com"       ["phone"]=>       string(12) "202-555-0102"     }      Thanks a lot for the support.


How do I check for a duplicate record before inserting using wpdb

I am inserting a row into a custom table in a wordpress database. this is the code:               $wpdb->insert( 'wp_pl_my_parts',                          array(                          'user_ID' => $user_ID,                          'PL_part_ID' => $PL_part_ID,                          'part_save_date' => $part_save_date ), array( '%d', '%d', '%s' ) );      How do I make sure I do not insert a duplicate entry. Ie. I don't want it to insert if the user_ID and the PL_part_ID are the same as an existing record? Date doesn't matter and shouldn't be checked.


Wordpress is suppressing page extensions!

I've built 2 sites on Wordpress. In both of them, I did two things:   1. Created a slug for each page.   2. In Settings > Permalink Settings, I chose "Custom Structure", and entered /%postname%.php In one site, Wordpress gives me exactly what I want: the url of each page is the slug plus the .php extension. In the other site, the url is just the slug and Wordpress suppresses the .php extension! If I explicitly type in the url with .php into my browser address line, it redirects to the page without the .php! Even when I'm editing the page in Wordpress, it shows near the top of the screen, just below the page title, the permalink _without_ the php extension. I can't understand why the first site works as desired and wordpress retains the .php extension, while in the second, wordpress discards the php extension!


Using a custom field value as current users name

I'd like to use conditional logic to show a part of the single post page to a specific user. However the problem is Im pulling that username in from a custom field. Below is what I have so far.                   <?php if ( $current_user->user_login =='the_field("my_field")') { ?>
Welcome <?php echo $current_user->user_firstname ?>
          <?php the_content(); ?>          <?php } else { ?>          <?php the_excerpt(); ?>
APPLY FOR THIS
          <?php } ?>      And this is not working. However if i use the username as normal for example:               <?php if ( $current_user->user_login =='jacksonsmith') { ?>      Then this works fine. So, I'm wondering how can I use the value of a custom field within an if statement as user login name value? I am a newbie forgive my ignorance!! Thanks


Highlighting Current Category in the Archive and Feeds page

I needed a category listing in my posts page and I want the current category to be highlighted. I enabled the 'All' category, so consequently, I want the 'All' also to be highlighted when I'm viewing the posts page. So I used the codex and got the following script running. My script is:               <cat>     <ul>     <?php wp_list_categories('show_option_all=All&hide_empty=0&title_li=&current_category=All'); ?>     </ul>     </cat>      Do I have to run an IF conditional on my archive.php file to get the category ID and highlight it using CSS class 'cat.current-cat'? How do I do it if the category is 'All' since the 'All' doesn't exactly have a category ID? Thanks!


Using Masonry - How to make every Xth post thumbnail image span multiple columns?

To be specific:   * I'm using Masonry to show all posts within a certain category   * Thumbnail images for each post are shown on the category page in a 3-column format using CSS fluid width columns   * I need to show the 7th thumbnail image spanning the width of all 3 columns In the past I've added a counter to posts to target the Xth post to apply a class and style accordingly. But is that possibly with Masonry, which is absolutely positioning elements? **EDIT** I'm using this code to query posts on the masonry page:                   if ( get_query_var( 'paged' ) ) {         $paged = get_query_var( 'paged' );     } elseif ( get_query_var( 'page' ) ) {         $paged = get_query_var( 'page' );     } else {         $paged = 1;     }     $args = array(         'posts_per_page' => 12,          'paged' => $paged     );          // Override the primary post loop     query_posts( $args );


Generating the ogp tags in theme

I use to generate the ogp tags in themes I code but this commercial one is beyond my knowledge. The client want to share a page but any image option shows up. Instead of a `taxonomy-name.php` template file, this theme rely on a page templates, where user choose the category/taxonomy to display the gallery from. Problem is: I can't get the attachments as the gallery renders after the query, I do will ask the theme autor to implement this but right now I need to fix this some way. **Info**   * Page template   * Theme in question


How to display only taxonomies of custom post type in a page?

I have created recipe as a custom post and types as a taxonomy. In that taxonomy I have created vegetables and fruits as fields and I have 5 posts in each fields, but I need to display only vegetables and fruits in the page? The below Query is what I currently use. It displays all posts.               <?php         $mypost = array( 'post_type' => 'recipe', );         $loop = new WP_Query( array( 'post_type' => 'recipe', 'posts_per_page' => 9 ) );     ?>      Can anyone help me?


Ajax url value to pass 'variable' to use in query

I am in the midst of modifying a plugin in which I wish to get a value from a select list and auto-populate a textarea with values based on the selected value. The php code come from a file named `wpf-addusers.php` but this file is not directly diplayed. The (absolute)url of the page that displays this information is `http://localhost:8888/dev_wordpress/wp- admin/admin.php?page=mfgroups&mingleforum_action=usergroups&do=add_user_togroup`. My javascript (ajax) looks like this:               jQuery(function(jQuery){      jQuery('#usergroup').change(function() {                 jQuery.ajax({           type: "GET",           url: "wpf-addusers.php",           data: { usergroup: jQuery(this).find(':selected').val() }           }).done(function( results ) {           console.log( results );           });             });                });      When I use "wpf-addusers.php" I get a 404 error like so: `GET http://localhost:8888/dev_wordpress/wp-admin/wpf- addusers.php?usergroup=The+Freedom 404 (Not Found)` `The+Freedom` is the value I want to use in my php code:               if(function_exists('home_url')){     $usergroups = $mingleforum->get_usergroups();     $team_title = $_GET[ 'usergroup'];     $team_id = $wpdb->get_var( "SELECT ID FROM $wpdb->posts WHERE post_title = '" . $team_title . "'" );     $players = get_users( array (     'meta_key' => 'team-meta',     'meta_value' => $team_id     ));          echo "

 Add users
";     echo "<form name='add_usertogroup_form' action='admin.php page=mfgroups&mingleforum_action=usergroups' method='post'>

           User group	           User names

              "; echo "<select name='usergroup' id='usergroup'>             <option selected='selected' value='add_user_null'>".__("Select User group", "mingleforum")."             </option>";                        foreach($usergroups as $usergroup){             echo "<option value='". $usergroup->id ."'>" . $usergroup->name . "</option>";                      }                 echo "</select>	               "; echo "<textarea name='togroupusers' rows='10' columns='60'>";                 if ( isset($_GET[ 'usergroup'])){                     foreach($players as $player) {                         echo $player->display_name . ", ";                     }                 }                 echo "</textarea>";              echo "
         The above players will be added to the group.

         <input class='button' name='add_user_togroup' type='submit' value='".__("Add users", "mingleforum")."' />

     </form>
";     }      Does anyone know how I can pass 'usergroup' to my php code? By the way, My javascript is enqueued properly on the admin side. So I presume I don't a specific handler function for ajax? (That isn't the question just a sidenote)


Display a list of users with avatar filterable with alphabets

I'm trying to create a page which should display a list of users with the role "Author" only and exclude all other default and custom roles. I also want them to be filterable by alphabets, so if I click on "A", or "B", and so on, the users starting with that alphabet should show on the page. I tried to use wp_list_authors but that's very limited to what I need here. (code below)               <ul>     <?php wp_list_authors('exclude_admin=1&optioncount=1&show_fullname=1&hide_empty=1'); ?>     </ul>      Any idea how this can be done or any plugin for this?


How to synchronize Outbrain Click tracking with my pageviews at wordpress backend?

Outbrain is a third party link referral service. They place links to our articles on other websites, and count the click through when the link is accessed. WordPress is not recording these at all. Scenario is , we have 15,000 mostly unique clicks coming from a third party referral source that are not being measured in WordPress. According to my view, as when any visitor click the post article which is shown on any other third site, i expect my pageview to increase for that specific article on my WP backend as well, which i can see it increases when I directly visit (click) this article from my own site. Please anybody explain me is there any way to have those views sync with each visitors visit those links. Thanks


Is it important to get the media files attached?

A silly question may be, but I's thinking about the SEO matter, and thinking that, is there anything related to the SEO regarding the Media file attachment? There are 567 images in my Media Library, and 134 are **unattached**. So what's the difference? With `/%postname%` permalink when an image file's attached to a post (and used too) the URL got like:               http://example.com/post-name/attachment-path      But the same image file, when it's unattached, _but_ used in a post, got URL like:               http://example.com/?attachment_id=25      Where the first one is used in a post, with descriptive title, alt tag and description, but when uploaded to the site, was not uploaded from the Post's Add Media, but uploaded via the Media Library Add Media (`/media-new.php`). Is that matter SEO, when there a file's used in a post, but not attached, and got a non-descriptive URL? ![attach media file - WordPress Media Library](http://i.stack.imgur.com/5CcH2.png)   Do I have to use the **Attach** button and spend my time to attach all the unattached images, those are used in some posts?


Updated plugin uses old source codes

I am a beginner with wordpress. I am developing one simple plugin for WordPress 3.9.1 now. My wordpress instance is deployed on openshift. I am facing one big problem. When I try to install plugin with newer source codes, it is installed correctly but sources codes from the first installation of this plugin are used. When I look at source codes in web GUI editor, I can see the right codes but it is not used! How is it possible? Very strange is the fact that plugin information are always correct when I change them. I deleted web browser cache of course... Could you help me please? EDIT: It seems this bug appears when wordpress is deployed on **OpenShift**. (StackOverflow issue)


Exclude certain block from caching using Fragment Caching - doesn't work

I have a one form, and I'm inserting it on page footer from a function file. I need to display a random form to each visitors and thus have a function developed to support this. However, with caching enabled the randomness doesn't work. I'm using W3 Total Cache Plugin for caching. So here, I need to exclude certain section of code from caching. I tried to put the function inside Fragment Caching which should do the trick, but it doesn't. We need to pass a random integer from a given array and based on that it loads random form in the footer. Here is a code snippet for you to review:               <!--MFUNC {E7C5F12EBCDA5F83A41BF33D778ED} -->        <?php             //echo rand();             $surveyforms=array("10","11");             $ra=$surveyforms[array_rand($surveyforms)];             echo($ra);         ?>     <!--/mfunc {E7C5F12EBCDA5F83A41BF33D778ED} -->      Just This should print a random number from an array collection given every time a page is refreshed, however due to cache the result. If we disable caching then it works fine, however as you know caching is very important for performance so we can not disable it. The same code also moved to the footer.php but doesn't work there as well. Any idea, how to use fragment caching on function file? I am fine with any other idea that works. Looking forward to your response. Thanks


Why can't a WordPress network (multisite) in it's own folder use subdomains?

If I'm setting up a brand new multisite installation with WordPress in it's own folder (say /wp/) why can't I configure the network to use subdomains instead of subfolders? Currently, if I try to setup the network with the WordPress core in it's own folder I'm not allowed to choose between a subdomain-based or sub-folder based network. I must use sub-folders. What are the technical reasons for this? I've scoured trac and Google for an answer to this question with no luck. A more detailed explanation than what is provided on http://codex.wordpress.org/Before_You_Create_A_Network or http://codex.wordpress.org/Create_A_Network would be greatly appreciated. Thanks!


multisite to root

I have this configuration :   1. http://domaine.com/ with an old wp (be removed soon)   2. http://domaine.com/bob with a new wordpress multisite (the main)   3. http://domaine.com/bob/site2 with a wordpress multisite  Is it possible to have   * http://domaine.com/bob/site3 to http://domaine.com/ with an url-rewriting ?


add_action on a specific page

I found this script Wordpress Media Manager 3.5 - default link to and it works fine for me. But my problem is, that I have a custom wp_editor on the front end where I want it to work, but I can't find a way to activate it on this site.. Here is the code:               add_action( 'load-post.php', 'wpse8170_media_popup_init' );     add_action( 'load-post-new.php', 'wpse8170_media_popup_init' );      which works fine in the wp backend media manager, but not in my custom wp_editor. The URL to the wp_editor is: `http://localhost/website.com/visitenkarten- setup/` And the page id is 360.. Do you have any idea how I could use the add_action on this page? Thank you!


Where can I propose a new plugin?

I have an idea for a new plugin. **Where can I propose the idea for the plugin so that someone might pick it up?** p.s: I won't be willing to pay for it (it is not that important to me), but I still think it is a cool idea. I am also not going to try to make it myself, since my PHP skills are not good enough.


Moving wp-config.php up 2 levels

Is it possible to change a setting so that wp-config.php could be moved up two directory levels (instead of the default 1 level)? This would allow the core WP files to be moved from public_html to a subdirectory, while simultaneously allowing wp-config.php to be moved above public_html and thus not publicly accessible.


disable admin-bar search field for specific roles

I would like to disable the admin bar search field when certain users, belonging to specific roles are logged in. I would like to keep the search field available for the role 'admin', but not others. This post tells me how to remove the admin bar completely, but doesn't give any info regarding how to selectively remove elements of it. Does anyone have experience with this? Thanks, jml


Link Comment Author to Author Page in WordPress

Normally, when someone comments one wordpress blog, author link shows their link if set it via profile. i want all the author of my blog, when they will comments anywhere, people can click their name, and can see their author page. I have used this code bellow on function.php but its not working for me.               add_filter( 'comment_author', 'my_site_comment_author' );          function my_site_comment_author( $author ) {         global $comment;              if ( $comment->user_id )             $author = 'user_id ) . '">' . $author . '';              return $author;     }


condition for only if is archive for default post type

In order to optimize my site for a bit more loading speed, I wanted to enqueue a couple of scripts only to the archives for default post type. A rough example is given below.               function my_theme_script_enqueues() {                  if (!is_admin()) {                      if ( is_archive()) {                     wp_register_script('isotope', get_template_directory_uri() . '/js/jquery.isotope.min.js', 'jquery');                     wp_enqueue_script('isotope');                 }             }         }          add_action (blah..blah..blah..blah)      I assumed something like (is_archive('post')) would work, but it still loads on cpt-archive and tag archives and such ( does not load on pages though). I cant use `(is_archive())` as it again loads it to every other archive types eg. cpt-archives, tags etc which is pointless to me. If I use if `(!is_post_type_archive('cpt')) {...}` then it obviously goes wild and loads it everywhere else, not scalable. I know how to use if`( is_post_type_archive('post')) {...}`, but it is not giving me any result, which it should i guess as 'post' is a post-type right? When I search for a solution here I get mostly threads talking about custom post type archive. Please let me know what my alternative is?


Register custom taxonomy from a Advenced custom field option page

I have a website with products (shoes), i have some shoes models registered as taxonomy on the function.php file like so:               function add_custom_taxonomies() {              register_taxonomy('mod-nike', 'pompitup_product', array(         // Hierarchical taxonomy (like categories)         'hierarchical' => false,         // This array of options controls the labels displayed in the WordPress Admin UI         'labels' => array(             'name' => _x( 'modeles Nike', 'taxonomy general name' ),             'menu_name' => __( 'Modeles Nike' ),         ),         ));     }          add_action( 'init', 'add_custom_taxonomies', 0 );      this is working as it should. my problem is that i have a few custom taxonomies created this way but the user should be able to add more on the backend, with the help of an option page. so i tried to hook on "acf/save_post" like so:               function my_acf_save_post( $post_id ){     //some logic that take have to do with custom post....              function register_brand_tax(){              $brand_to_add = get_field_object('field_52d6f9449e688', 'option');         //in the variable $brand_to_add I get the field object from the option pages              if( !empty($brand_to_add['value'])){                       //then I instert the term on the "brand category" (this works when outisde of a function)             wp_insert_term(                 $brand_to_add['value'], // the term                  'marque' //the tax             );                   register_taxonomy('mod-' . $brand_to_add['value'], 'pompitup_product',                 array(                 'hierarchical' => false,                 'labels' => array(                        'name' => _x( 'modeles ' . $brand_to_add['value'], 'taxonomy general name' ),                         'menu_name' => __( 'Modeles ' . $brand_to_add['value'] ),                               ),                  ));                         }         }     }                     add_action( 'init', 'register_brand_tax', 20 );     add_action('acf/save_post', 'my_acf_save_post', 1);       the wp_insert_term is working but apparently the register_taxonomy must be called by an 'init' action that's why i tried to call it inside of the 'acf/save_post' but diden't had any luck so far, is there any way even outside of ACF to let my user register a new taxonomy from the admin backend?


Get one custom taxonomy category

I am trying to do something which I thought would be simple but I am at a loss (ive googled played with different code etc.) I have the following Custom Taxonomy `Job Attributes` I have two check box category terms(?):   * paid    * union     1. I would like to display a taxonomy link for 'union' if union is selected.      2. I would like to display a taxonomy link for 'union' if union AND paid is selected. In other words, I would like to ignore that 'paid' is selected. Breakdown:   1. paid selected = display nothing.   2. union selected = display taxonomy link 'union'.   3. paid AND union are selected = display taxonomy link 'union'. I am also trying to make this into a short code, I am integrating into something else:               function wpv_check_for_union_func() {          // Ive tried a bunch of thing and would appreciate some leads.          }          add_shortcode( 'wpv_check_for_union', 'wpv_check_for_union_func' );


Does the textdomain have to be the theme's name?

Does a theme's text domain have to be the actual theme name? If you develop WP themes, couldn't you just use the same name (perhaps your business name) for all the theme's you develop, making it easier to copy and paste code as you develop? (even though a find and replace is rather simple).


Images on WP Network's subsite appear only if accessed via main site's url

I am having a very strange problem. I am migrating old single WP blogs into a newly created WP Network. After creating the new blog on Network and importing the posts,including attachments, images do not appear in posts, nor as thumbnails. I made sure the images were imported from the old blog, they are in the new blog's folder in the server. But browsing to the URL of the image gives a missing image placeholder. However, if the image is accessed through the main site's (Network's) URL, it appears just fine. **Example:** Viewing this message shows nothing: http://2armedia.al- rasid.com/files/2012/09/rabieiee-150x131.jpg Viewing this shows the image fine: http://al-rasid.com/wp- content/blogs.dir/8/files/2012/09/rabieiee-150x131.jpg Noting that "2armedia.al-rasid.com" is subsite 8, and that the 1st url is the default url of the image after being imported, and the url given to all images by the network. I tried everything, including changing the "Upload Path" and "Upload Url Path" settings of the sub blog to "al-rasid.com/wp-content/blogs.dir/8/files" (including the http) , but that didn't help. I deleted the network and re-created it because this issue drove me crazy, and that didn't resolve it (what are the default values for these two fields anyway?). Thanks


What is the difference between "create_users" and "add_users" capabilities?

The codex lists both **create_users** and **add_users** under roles and capabilities. Does anyone know what is the difference between these two?


rewrite_rules problem

I am using scheduled posts as a event program, by making a loop pick up future posts. Every now and again, the production site starts to show 404's for the single event pages, and to fix it I have to copy the contents of the `rewrite_rule` option from my local database, to production. Does anyone know what is going wrong, and if I can prevent it? * * * **Edit** It's worth noting that it was _only_ the future events that get the `404`


WPML - Change the language of large number of posts

I need to change the language of some 500 posts in a site that uses WPML. Currently all of them are set to English, but are in fact in Spanish. What is the fastest way to do so? It is possible to get the IDs of all of the posts.


Storage of array in settings

I'm creating a plugin that will store some simple layouts to be used in shortcodes. The shortcode usage will be similar to `[shortcode layout="name"]` With this mind I'll need to store each layout in the array as a key/value setup Key = layout name Value = layout markup I'd like to store these in settings however I'm not sure how to go about it. How can I create a settings page that allows addition and editing. Normally my settings pages use code as follows and automatically wires into the api.               <input type="text" id="company_name" name="wpv_settings[company_name]" value="<?php echo $wpv_settings['company_name']; ?>" class="regular-text" />      However, I can't find how to go about this when the setting is an array of key/values. Can anyone point me in the right direction of how this would be done?


How to delete all the options in an option group

I have created a few options with with the `register_setting` function:               <?php register_setting( $option_group, $option_name, $sanitize_callback ); ?>      Is there a way to clear the whole content of the `$option_group`, and even the group itself.


Using taxonomies to handle layout?

I need some tools to handle page/post layout in some specific cases -- for example, some post should render post thumbnail on the right side (not left), some "related post" item should not be linked in some posts etc. Now I guess that I could create `'layout_tax'` taxonomy with values `'right_thumb'`, `'hide_pieces_link'` etc-etc. And then I would use it to "trigger" needed behavior. Please, what are drawbacks of this approach? For example, each of these taxonomies do not need to have archive page, appear as keyword in <head> or like that. What would be better way instead? Thanks!


Admin top level menu, pointing to an external url

I want to create a entirely new top level menu in the admin menu section, and have that be an external link, is this even possible with the current system? The solution that t31os provides in this thread works if you put the link as a submenu under, for example, the dashboard. But this is not what I want to do. Adding an Arbitrary Link to the Admin Menu?


Disable (or limit) queries when certain content (or data) is not needed (or showed)

Currently I am making a custom design for a site. The problem I'm seeing in Wordpress is about almost all data pulled out from the database. While in certain pages - like front-page.php - it only needs, for example, title, category, two metas and the excerpt, WP gets everything. Hell, the post content is only visible in post-single.php, but instead WP pulls out all the content, tags, guid, tags, etc. where it can (print_r helps a lot). The question is about how to limit Wordpress data pulled out from his queries. I think that I should make a net "WP_Query" (or override it) based on $wpdb and use it for the site, instead of using the default one. Well, at least functions like query_posts, WP_Query and get_posts doesn't allow me to limit the data pulled out. I am also interested in caching the data, because is really small, but this is first. **Update 1:** Tried to "minimize data":                   add_action( 'pre_get_posts', 'disable_main_query' );     function disable_main_query( $query ) {         if( $query->is_main_query() && $query->is_front_page() ) {             add_filter('posts_fields', 'minimized_data');         }     }          function minimized_data($fields) {         global $wpdb;         $fields = "             $wpdb->posts.ID,             $wpdb->posts.post_title,             $wpdb->posts.post_excerpt,             $wpdb->posts.comment_count,             $wpdb->posts.guid,             $wpdb->posts.post_status,             $wpdb->posts.post_name,             $wpdb->posts.post_date,             $wpdb->posts.post_type         ";         return $fields;     }      Mow the default loop is plagued with "Undefined property: stdClass::$post_XXXX" and other things. I think the_post is to blame now, so I'm cheking. **Update 2:** Has expected, it was. Changed the `while` loop for `foreach ($posts as $post)` no more undefined properties, but as earlier I can't _get rid_ of `ob_end_flush() [ref.outcontrol]: failed to delete buffer zlib output compression`. **Update 3:** `define( 'SAVEQUERIES', FALSE );` and no more failed buffer (for WAMP).


Does releasing a plugin under the AGPL force people to open source their whole WordPress installation?

I'm thinking about releasing a plugin under the AGPL license. Would this force people to make public the source code of _other_ unrelated parts of their WordPress installations? (I've tried to read the AGPL license but I'm not sure.) For example, if they install my AGPL plugin, would they have to make available the source code for any other plugins and themes they've installed? (Which are probably licensed under the GPL.) Would it have any legal effects if I publicly stated that I, the copyright holder, don't consider other plugins and themes and WordPress being part of a combined work? (If other pugins etcetera were not part of a combined work, other people would not have to publish source code for their other plugins etcetera.) (PS. Since most people aren't lawyers, I'd take any advice with a grain of salt :-) )


How do you remove hard coded thumbnail image dimensions?

How can I remove the width and height attributes from the post_thumbnail when inserting with `<?php the_post_thumbnail(); ?>`?               <img width="800" height="533" src="http://domain.com/wp-content/uploads/2011/02/image.jpg" class="attachment-post-thumbnail wp-post-image" />


Wordpress "Page not found error" when I edit a page

On a Wordpress based website, when I add text using wordpress visual editor or HTML source to a particular page - it gives "page not found error". I tried by adding some other text and its working fine. Then I typed all the text again and in between kept checking if it is giving any errors. Finally I am able to point to the exact word that is causing problem - from. If I put frm , rom or from it works. Only when I use "from" - it gives page not found error. Another thing, the error is only this page not on any other page. I have used "from" on many other pages and there is no problem at all. Its a client website and I do not have access to the server. I only have wordpress login/password. Any help would be appreciated. Update: I even tried HTML entities and it does not work. Right now we are using "fróm" instead of "from" as a workaround.


using the loop with a custom table

I have a table in my WordPress db called wp_featuredposts. How can I make a query to output the posts in that table into the loop on a custom wordpress page template?


Ajax function returns -1

I have a question. I made a simply ajax function. When I'm logged in, it works perfectly. When I'm logged out, it returns me -1 (since Wordpress 3.1) Why ? I don't understand. Precisely, it returns -1 and my entire HTML code. (lol) I'm gonna be crazy again. **PHP (in functions.php)**               function say_coucou(){     check_ajax_referer( 'hello', 'nonce' );     echo "Hello";     die(); // this is required to return a proper result     exit;     }     add_action('wp_ajax_hello_hello', 'say_coucou');     add_action('wp_ajax_nopriv_hello_hello', 'say_coucou');      * _JAVASCRIPT / JQUERY / AJAX (in footer.php) *_               function blabla(){         var toSend = {           action:"hello_hello",           post_id: "<?php echo $wp_query->post->ID; ?>",           nonce: "<?php echo js_escape( wp_create_nonce('hello')); ?>"         };         url_action = 'http://www.***********/wp-admin/admin-ajax.php';         $.ajaxSetup({cache:true});         $.ajax({           url: url_action,           type:'POST',           data: toSend,           cache: false,           success:function(results)           {             alert(results)           }          });      }       Any help, please ? Thanks.


How to add taxonomy in menus?

* Book (Custom Post Type)      * Fiction (Tax)      * Science (Tax)      * History (Tax)  ----------OR-----------    * Book      * Genre (Tax)        * Fiction (Term)        * Science (Term)        * History (Term) Which of these is "good way" of doing it? With the former one( which is what i have currently in my admin menu, i've 'register_taxonomy' functions for each of them ) i can't choose the 'Tax' to show in menus. Whereas with the later one i can add them to menus and need only one 'register_taxonomy' function.


How to limit WordPress pages during updates?

I will be doing upgrades to the design and content of my Wordpress site. During this time I only want the homepage to be available. Is there a good way to lock this down (through a plug-in, etc.). I'm having trouble coming up with answers from Google. Thanks, Jason


How to create an user defined page?

I have created a file example.php in the default site directory. I want to have the facilities of an Dashboard-Created-Page like the theme,navigation bar,navigation bar, header,footer etc..


how do I determine which image is the featured image in the database

I've queried all children of the post, and two records are shown. This is ok because there are 2 images in the gallery, but I can see no field in the database which makes it clear which one is the featured image. I have joined the wp_postmeta table also, but there is no meta_key which indicates which of the 2 is the featured image. Note: I do not want to look in the admin panel, I need a programmatic way to determine from the current database setup. **Does anyone know how the system knows which is the featured image in the db?**


Order posts using a custom array

I have an array of post ids which I'm passing to query_posts using 'post__in'. My question is how can I use the order from my array rather than ordering by 'date' etc?


Override custom menu widget

I would like to override some mark-up and css (like `<div class="soma_container"><ul class=""></ul></div>`)styling on a chosen custom menu widget. How would I do that? Should be hooked as the main navigation in `functions.php` or if there is good tutorial on this would be really appreciated I think a some of the thing I can make on widget poition init                 register_sidebar(array(         'name'          => __('Sidebar Menu', 'roots'),         'id'            => 'sidebar-primary',         'before_widget' => '
',         'after_widget'  => '
',         'before_title'  => '
',         'after_title'   => '
',       ));      but how would override the list css for the custom menu


How to validate this deprecated function

I want to validate this deprecated function:               add_filter('user_has_cap', array(&$this, 'filter_user_has_cap'), 10, 3);      It needs to use roles or capatibilies, so I guess 10 is the admin level, so I could use "edit_pages":               add_filter('user_has_cap', array(&$this, 'filter_user_has_cap'), 'edit_pages', 3);      But what is argument "3"? Thank you Oliver


Adding nofollow to a PHP generated Nav

if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly          global $wp_query;          if ( $wp_query->max_num_pages <= 1 )         return;     ?>     <nav class="woocommerce-pagination">         <?php             echo paginate_links( apply_filters( 'woocommerce_pagination_args', array(                 'base'         => str_replace( 999999999, '%#%', get_pagenum_link( 999999999 ) ),                 'format'       => '',                 'current'      => max( 1, get_query_var( 'paged' ) ),                 'total'        => $wp_query->max_num_pages,                 'prev_text'    => '←' ,                 'next_text'    => '→',                 'type'         => 'list',                 'end_size'     => 3,                 'mid_size'     => 3             ) ) );         ?>      </nav>      I need to add _Nofollow_ to the list items generated in this PHP script. How would i go about doing that?


Allow anonymous user to access Themes Customizer

i create a themes and use themes customizer, is there any way i can give anonymous user access to themes customizer without ability to save it? it will be very convenience in term of user experience if user able to know what kind of themes customizer we offer and how they can change it. Thank you


Walker_Nav_Menu doesn't work in wp_page_menu_args filter

I need to hide certain nav items from the menu (based on the password protection functionality) and I'm having trouble getting my custom Walker to work. In fact, I can't even get the standard Walker_Nav_Menu to work when I add it via a filter. I've created a plugin as follows:               <?php     function myplugin_page_menu_args( $args ) {         $args['walker'] = new Walker_Nav_Menu;         return $args;     }          add_filter( 'wp_page_menu_args', 'myplugin_page_menu_args' );     ?>      There's no other code in the plugin file, just those 6 lines. I've added this plugin to a brand new install of WordPress (http://dev.matt- howe.co.uk/wordpress/) and the menu rendering is completely broken - all the items are on the same level, and none of them have any text. The right number of `<li>` elements are generated, and the ids are correct, but the rest is wrong. I've tried using a custom class with a .walk() method, as so:               class myplugin_walker {         function walk ( $elements, $to_depth ) {             return 'test';         }     }          function myplugin_page_menu_args( $args ) {         $args['walker'] = new myplugin_walker;         return $args;     }          add_filter( 'wp_page_menu_args', 'myplugin_page_menu_args' );      This works exactly as expected - the menu renders as 'test'. But trying to use either my own class which extends `Walker_Nav_Menu`, or the core `Walker_Nav_Menu` class itself, results in a flat list of empty `<li>` tags. I've tried a few other ways to achieve the same result - I've tried adding filters for `wp_nav_menu_objects` and `wp_get_nav_menu_items` but neither of my functions seem to get called at all. Am I barking up the wrong tree here - is this something that won't work as part of a plugin, and needs to be elsewhere in the code? Or am I just missing something obvious?


Is there a quick way to view the wp-cron schedule

I'm trying to work which plugin is triggering wp-cron. I know about the code: http://codex.wordpress.org/Function_Reference/wp_get_schedules , but I'd prefer to do something in the sql backend rather than write a plugin.


Add Input Field in Simple Model Contact Form (smcf) plugin

I am using nice SMCF (Contact Form) want to add a wordpress post list Drop Down menu in "Simple Model Contact form" here what i added on line '195' to try look.               $output .= "
*" . __("Message", "smcf") . ":              <select name="">       <option>Post1</option>       <option>Post2</option>       <option>Post1</option></select>

";      after saving / uploading file, it showing               Parse error: syntax error, unexpected T_CONSTANT_ENCAPSED_STRING in plugins/simplemodal-contact-form-smcf/smcf.php on line 201      please help me how to get post list in form. ?


I need a custom search page to lead to search.php but it goes to index.php

I built a custom search page with a form like:               <form role="search" method="get" id="searchform" action="<?php echo home_url( '/' ); ?>">      trouble is I want the results to appear in search.php whereas I m led to index.php How can I force to always go to search.php ?


How to use multiple database in wordpress?

I want to fetch some post from another wordpress site which is hosted in the same server. How can I fetch those post? Is multiple database connection is possible in wordpress?


Use safety filters even if after applied intval?

I have some values to save into postmeta and usermeta table. Before save, I already done this: `$value = intval($value)` . I think this is enough. But I see some plugins still use filters on those numbers. I want to make sure that I can do with `intval` and without safety filter.


Wrap the "show_post_count" between div

How can I wrap the "show_post_count" between a div? (from the wp_get_archives())   Do I need to edit the function for that? Or could I do something like this with pseudo css?
         March 2012 (1)
      Css:               .post_count a:after (all the content in the div and after the .post_count){      float: right;     }


How to add custom button to new media upload interface

I am developing a plugin and i want to add my own button to the wordpress media upload interface (WP version 3.5). Right next to the standard 'insert into page' button, i want my button to be there, let's call it 'insert special image'. Can anyone point me in the right direction, where should i look? which WP source files are defining the functionality of this button? Basically my 'insert special image' button should do pretty much the same thing like the standard 'insert into page' button - take an attachment and insert it into post, only with some added data.


Running a python script within wordpress

I have a WordPress install for a personal blog and I'm gradually porting all of the little web bits I have written over the years to pages on the blog. One such page is http://www.projecttoomanycooks.co.uk/cgi- bin/memory/majorAnalysis.py which is a simple python script that returns a list of words - I'd like to embedd that behavior within a wordpress page - could someone point me in the right direction for the easyist way of running a spot of python within wordpress? EDIT - following the wonderful answer below, I have got a lot futher... but unfortunately still not quite there... I have python that executes on server...               projecttoomanycooks server [~/public_html/joereddington/wp-content/plugins]#./hello.py      Hello World!      and it's in the same directory as the activated plugin... The python code... which has the following code...               #!/usr/bin/python     print("Hello World!")      The php:               <?php     /**      * Plugin Name: Joe's python thing.      * Plugin URI: http://URI_Of_Page_Describing_Plugin_and_Updates      * Description: A brief description of the Plugin.      * Version: The Plugin's Version Number, e.g.: 1.0      * Author: Name Of The Plugin Author      * Author URI: http://URI_Of_The_Plugin_Author      * License: A "Slug" license name e.g. GPL2      */     /*from http://wordpress.stackexchange.com/questions/120259/running-a-python-scri     pt-within-wordpress/120261?noredirect=1#120261  */     add_shortcode( 'python', 'embed_python' );          function embed_python( $attributes )     {         $data = shortcode_atts(             array(                 'file' => 'hello.py'             ),             $attributes         );         $handle = popen( __DIR__ . '/' . $data['file'], 'r');         $read   = fread($handle, 2096);         pclose($handle);              return $read;     }


Media (images, videos, etc.) not showing on Category page

I'm having a problem where media isn't showing up on the Category page. (It's actually the exact same problem that's described in this WordPress.org forum post, but it's so out of date that the solution doesn't appear to apply anymore.) I've checked `category.php` and I'm guessing it's something to do with `<?php get_template_part( 'entry' ); ?>` ? I'm using the Blankslate theme. Contents of `entry.php`:               <article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>          <?php if ( is_singular() ) { echo '
'; } else { echo '
'; } ?><a href="<?php the_permalink(); ?>" title="<?php the_title_attribute(); ?>" rel="bookmark"><?php the_title(); ?><?php if ( is_singular() ) { echo '
'; } else { echo '
'; } ?> <?php edit_post_link(); ?>     <?php if ( !is_search() ) get_template_part( 'entry', 'meta' ); ?>          <?php get_template_part( 'entry', ( is_archive() || is_search() ? 'summary' : 'content' ) ); ?>     <?php if ( !is_search() ) get_template_part( 'entry-footer' ); ?>
      Thanks for any help!


Remove metabox from specific page template in admin

I would like to programatically remove some meta boxes when a user is editing a specific page in the admin. The page itself is using a template (tpl- about.php). I know I can remove all meta boxes from all pages with this function:               function remove_post_meta_boxes() {      if(!current_user_can('administrator')) {       remove_meta_box('tagsdiv-post_tag', 'post', 'normal');       remove_meta_box('categorydiv', 'post', 'normal');       remove_meta_box('postimagediv', 'post', 'normal');       remove_meta_box('authordiv', 'post', 'normal');       remove_meta_box('postexcerpt', 'post', 'normal');       remove_meta_box('trackbacksdiv', 'post', 'normal');       remove_meta_box('commentstatusdiv', 'post', 'normal');       remove_meta_box('postcustom', 'post', 'normal');       remove_meta_box('commentstatusdiv', 'post', 'normal');       remove_meta_box('commentsdiv', 'post', 'normal');       remove_meta_box('revisionsdiv', 'post', 'normal');       remove_meta_box('authordiv', 'post', 'normal');       remove_meta_box('slugdiv', 'post', 'normal');      }     }     add_action( 'admin_menu', 'remove_post_meta_boxes' );      But I need to do this for a specific page only. So how can I test on what template is being displayed in the admin?


404 error using Meta for Permalink rewrite

I'm trying to rewrite my permalinks using meta data from my post. The permalink rewrite works fine but I'm getting the 404 error when I try to view the post. Could someone offer a clue as to why this wouldn't work?               add_action('init', 'new_rewrite');     function new_rewrite(){        add_rewrite_tag("%mls%", '([a-zA-Z0-9])');     }          add_filter('post_link', 'mls_permalink', 10, 3);     add_filter('post_type_link', 'mls_permalink', 10, 3);          function mls_permalink($permalink, $post_id, $leavename) {         if (strpos($permalink, '%mls%') === FALSE) return $permalink;              $post = get_post($post_id);         if (!$post) return $permalink;              $mls = get_post_meta($post->ID, 'mls_number', true );         if (!is_wp_error($mls) && !empty($mls)) $mls_slug = $mls;         else $mls_slug = '';              return str_replace('%mls%', $mls_slug, $permalink);     }


Appending code to the_content

I'm trying to append some php code to `the_content` in a custom loop. I do not want to add a function because I only want to append the code to one instance of `the_content`, not throughout the whole site. I'm using the Read More Right Here plugin to enable viewers to read a whole post (after clicking the more tag) that displays on the page (without going to single post). And I'm using the Advanced Custom Fields plugin to output some content (when a check box is ticked in the back end) that I want to display at the end of each post. If I place my code to output the check box data AFTER `the_content` in my template, the info is displayed underneath the more tag. My aim is to append this to the bottom of `the_content` so that it is hidden (along with the rest of the post after the more tag) until you click 'read more' (and the rest of the post is revealed). The code I am trying to append to the end of `the_content` is:               <?php     if( in_array( 'frazer-barton', get_field('who_specialises') ) )     {     echo '';     }     if( in_array( 'sarah-simmers', get_field('who_specialises') ) )     {     echo '';     }     else {     echo '';     }     ?>      I am not a PHP developer so any help on this is hugely appreciated.


How do I remove inline style in featured image markup?

When I create featured images, the markup that wordpress produces has inline css. The image tag for the image has width and height parameters. This is very frustrating: I'd like to control the image style with my own css. How can I remove the inline style?


Extra Text in URL

I'm redesigning my website. The blog posts and everything were fairly easy to move to the new wordpress install. The URL of the test site is this: http://www.NathanTornquist.com/wordpress When I go to that URL I have this URL show up in the address bar: http://www.NathanTornquist.com/NathanTornquist/wordpress but when I hit the home button at any time the site goes to NathanTornquist.com/wordpress as it should. What do I need to do to correct this behavior?


How do I prefix blog post urls as mysite.com/blog/%postname%/ but allow authors to still be located at mysite.com/authors/%nicename%?

I've tried a bunch of things but cannot find a solution that works. I want my site to have the structure:               mysite.com/ = homepage     mysite.com/blogs/ = blog archive     mysite.com/blogs/year/ = blog archive (in a specific year)     mysite.com/blogs/year/month/ = blog archive (in a specific month)     mysite.com/blogs/year/month/postname = blog post     mysite.com/authors/ = authors archive     mysite.com/authors/nicename = author profile     mysite.com/customposttype/ = custom post type archive     mysite.com/customposttype/postname = custom post type post      Currently, with `/blogs/%year%/%month%/%postname%/` set as the permalink structure, everything works correctly except the authors part. It forces it to `mysite.com/blogs/authors/` and `mysite.com/blogs/authors/nicename`, which is not desireable, since most authors will be making custom post types and not blogs. Some posts I checked here but without the right answer: How to properly prefix blog post URL's Permalinks Question: Adding a prefix ONLY in front of the posts Possible to change the URL for the regular post type without affecting the URL of other custom post types?


How can I safely increase the character limit for post passwords?

When I want to protect a post on one of my blogs, I like to use a passphrase instead of a password (albeit purely for the sake of creativity, not security — they're stored plainly anyway). However, these passphrases often get very long, and when I enter a passphrase that's too long, it gets silently truncated to 20 characters, much to my disdain. Looking in the `wp_posts` table, I see that the `post_password` column is a `VARCHAR(20)`. That explains the arbitrary truncation, but at the same time it raises a concern: if I want to increase the character limit so I can use longer post passwords, it would have to involve altering `wp_posts.post_password`, besides possibly overriding any validation or processing routines (which is trivial by using filter hooks). Altering the column directly using SQL doesn't seem like a smart idea. Is there a safe way to increase the maximum character limit for post passwords, that won't cause problems with my database when it comes to things like upgrades? (Better still if I can turn this functionality into a plugin, as I don't see such a plugin available yet...)


get_permalink() always returns empty

I suddenly have a bug in my plugin, and I don't know what on earth could be causing it. This code is failing because `get_permalink()` is returning empty at all times:               $select = "SELECT * FROM `".DB_NAME."`.`wp_posts` WHERE `post_status` = 'publish'";     $result = mysql_query($select);     while($meta_posts = mysql_fetch_array($result, MYSQL_ASSOC) ){         $menu .= "<option value=\"".get_permalink($meta_posts['ID'])."\">".$meta_posts['post_title']."</option>\n";     }      It used to work just fine, all it does is return a dropdown menu of all the published WP posts/pages. Now I get the dropdown full of titles, but there is no permalink in the option value. Anyone have any ideas why `get_permalink()` would be empty? I've even tried hardcoding a known postid into it, and it's still empty.


Are Nonces Useless?

This is probably a noob question BUT hear me out - isn't the point of using Nonce to protect from things like scrappers (phpcurl scrappers etc.)? But my Nonce prints out in the head of the document like so:               /* <![CDATA[ */     var nc_ajax_getpost = {         ...stuff...         getpostNonce: "8a3318a44c"     };     /* ]]> */      So if I was building a quick scrapper I would just get the nonce value from that page and then use it in my POST...making the whole exercise of using a Nonce useless... What am I missing here?


Custom meta boxes not saving

I am trying to create a custom meta box with 12 fields. there are 3 groups of 4 fields so i am using a for loop to create them to save on typing etc. for some reason i can't seem to get them to save. i am not sure if my coding is correct? i checked to see if they were being saved by doing a var dump of `var_dump($linktext[1]);` to see if it was being saved and that returned null. this is the call back for the add metabox to output the fields in the back end in the meta box:               function home_callout_meta_box_cb($post) {         global $post;         wp_nonce_field('home_callout_nonce', 'home_callout_meta_box_nonce');         $values = get_post_custom($post->ID);              for ($i = 1; $i <= 3; $i++) {                  $imagefield1[$i] = isset($values['imagefields'][$i]) ? esc_attr($values['imagefields'][$i]['image1'][0]): '';             $imagefield2[$i] = isset($values['imagefields'][$i]) ? esc_attr($values['imagefields'][$i]['image2'][0]): '';                  $linktext[$i] = isset($values['linktext'][$i]) ? esc_attr($values['linktext'][$i][0]): '';             $link[$i] = isset($values['link'][$i]) ? esc_attr($values['link'][$i][0]): '';                       echo '
Call out box ' . $i .' image 1
';             echo '
';             echo '<input type="text" id="imagefields'. [$i] . '[image1]" name="imagefields' . [$i] . '[image1]" class="upload-url image_url" readonly="readonly" value="' . $imagefield1[$i] .'" />';             echo '<input id="st_upload_button" class="st_upload_button button-secondary upload_image" type="button" name="upload_button" value="Upload" />';             echo '
';                  echo '
Call out box ' . $i .' image 2
';             echo '
';             echo '<input type="text" id="imagefields' . [$i] . '[image2]" name="imagefields' . [$i] . '][image2]" class="upload-url image_url" readonly="readonly" value="' . $imagefield2[$i] .'" />';             echo '<input id="st_upload_button" class="st_upload_button button-secondary upload_image" type="button" name="upload_button" value="Upload" />';             echo '
';                  echo '
Call out box ' . $i .' link text
';             echo '<input type="text" id="linktext' . [$i] . '" name="linktext' . [$i] . '" value="' . $linktext[$i] . '" />';                  echo '
Call out box ' . $i .' link
';             echo '<input type="text" id="link' . [$i] . '" name="link' . [$i] . '" value="' . $link[$i] . '" />';              }     }      and this is my save function:               function home_callout_save($post_id) {         if(defined('DOING_AUTOSAVE') && DOING_AUTOSAVE) return;         if(!isset($_POST['home_callout_meta_box_nonce']) || !wp_verify_nonce($_POST['home_callout_meta_box_nonce'], 'home_callout_nonce')) return;         if(!current_user_can('edit_pages')) return;              if(isset($_POST['imagefields'])) {             update_post_meta($post_id, 'imagefields', $_POST['imagefields']);            }              if(isset($_POST['linktext'])) {             update_post_meta($post_id, 'linktext', $_POST['linktext']);         }         if(isset($_POST['link'])) {             update_post_meta($post_id, 'link', $_POST['link']);         }     }     add_action('save_post', 'home_callout_save');      i think ive been staring at this same code for so long i think it might be a small mistake ive made and can't seem to see it. thanks for reading and any help is very much appreciated. **Edit:** here is what i get from a vardump of $values['linktext'] string(75) "a:3:{i:1;s:11:"link text 1";i:2;s:11:"Link 2 text";i:3;s:11:"Link 3 text";}" i cant see how to put that returned value into the fields


How to remove in the wordpress database all posts revisions except the last three?

here is the commonly recommended sql command for removing posts revisions and cleaning up the wp database:               DELETE a,b,c     FROM `wp_posts` a     LEFT JOIN `wp_term_relationships` b ON (a.ID = b.object_id)     LEFT JOIN `wp_postmeta` c ON (a.ID = c.post_id)     WHERE a.post_type = 'revision';      how can i modify it to keep let's say the last 3 revisions ?


Why aren't my posts/pages showing up in my WordPress Theme?

i built a custom wordpress theme, and for some reason don't know why the posts/pages are not showing up in the theme, but they show up in all other themes. Here is the index.php code:               <?php get_header( ); ?>

                  <?php if ( have_posts() ) : ?>                 <?php /* Start the Loop */ ?>                 <?php while ( have_posts() ) : the_post(); ?>                     <?php get_template_part( 'content', 'page' ); ?>                 <?php endwhile; ?>                 <?php twentyeleven_content_nav( 'nav-below' ); ?>             <?php endif; ?>

 Cafe Coyote

 (619)291-4695

 3:30PM to 6PM:      $2 tacos, $3 beers & $4 margaritas.

 Cafe Coyote

 (619)291-4695

 3:30PM to 6PM:      $2 tacos, $3 beers & $4 margaritas.

         <?php get_sidebar( ); ?>

      <?php get_footer( ); ?>                here is the page.php code:               <?php get_header( ); ?>

         <?php the_post(); ?>         <?php get_template_part( 'content', 'page' ); ?>         <?php get_sidebar( ); ?>

      <?php get_footer( ); ?>


WordPress is stripping escape backslashes from JSON strings in post_meta

I thought I was making my life easy and being future-conscious by saving some content as bits of JSON in custom post_meta fields. Unfortunately, WordPress doesn't agree and is making my life incredibly difficult. I have a JSON string that looks essentially like this. This is just one bit, and the comment string is just some dummy unicode entities. The whole thing is generated w/ json_encode.               {         "0": {             "name": "Chris",             "url": "testdomain.com",             "comment": "\u00a5 \u00b7 \u00a3 \u00b7 \u20ac \u00b7 \u00b7 \u00a2 \u00b7 \u20a1 \u00b7 \u20a2 \u00b7 \u20a3 \u00b7 \u20a4 \u00b7 \u20a5 \u00b7 \u20a6 \u00b7 \u20a7 \u00b7 \u20a8 \u00b7 \u20a9 \u00b7 \u20aa \u00b7 \u20ab \u00b7 \u20ad \u00b7 \u20ae \u00b7 \u20af \u00b7 \u20b9"         }     }      Unfortunately after I save it with `update_post_meta`, it comes out looking like this:               {         "0": {             "name": "Chris",             "url": "testdomain.com",             "comment": "u00a5 u00b7 u00a3 u00b7 u20ac u00b7 u00b7 u00a2 u00b7 u20a1 u00b7 u20a2 u00b7 u20a3 u00b7 u20a4 u00b7 u20a5 u00b7 u20a6 u00b7 u20a7 u00b7 u20a8 u00b7 u20a9 u00b7 u20aa u00b7 u20ab u00b7 u20ad u00b7 u20ae u00b7 u20af u00b7 u20b9"         }     }      And with the slashes stripped, it can't be `json_decode`d back into useful content. Any ideas why WordPress might be doing this, and if there is a way to avoid it? I can't use the JSON_UNESCAPED_UNICODE flag because this is a PHP 5.3.x install, and I've already tried encoding with `htmlentities` before the content is passed to `json_encode`, but that only captures a small subset of UTF-8 entities. Thanks in advance! (EDIT: FWIW, I know I could just save an array directly to post_meta and it'd be serialized and magic would happen but I just like the idea of having the data stored as JSON. If there isn't an easy, elegant solution I'll cave, but I'm very much hoping there _is_ an easy, elegant solution!)


Display selected category on post page

Lets assume that we have a post which belongs to 2 or more categories and we wish to display, on the post page, the selected category through which we reached to the post page. What is the best method? Keep the category id in a session or in a querystring temporarily? Or any other? THX


Pulling posts tagged with similar title name

I'm trying to pull in posts in a page that are tagged with the same page title. For example, if the page is called Banana Pants, then I can call all associated posts manually like this:                   <?php         query_posts( array(         'tag_slug__in' => array('Banana Pants')         ));          while (have_posts()) : the_post (); ?>      However, I'd like to do this automatically. When I try to place it as a variable, it doesn't work:                   <?php         var $project_title = the_title();         query_posts( array(         'tag_slug__in' => array($project_title)         ));          while (have_posts()) : the_post (); ?>      What am I doing incorrectly? Or, is there a better method?


Conditional tag is_page with a custom post type

Accordingly to the is_page documentation, supplying the slug as an argument WP can tell me whether the current page is the one represented by the slug. Perhaps I am using the wrong slug? However I did try both the path used in the rewrite argument as well as the bit I consider to be the "slug" or in other words the element used to register the CPT. Please find below a code snippet to let you understand:               'rewrite'               => array( 'slug' => 'faqs/archivio' )       );          register_post_type( 'faqs', $args );      I did this a go using the slug used for a custom post type, but I wasn't able to get this working. So two questions?   1. Is the is_page supposed to work in this case?   2. if not, what the best alternative? Thanks Andrea


Custom/separate categories for custom post type

How can I achieve a separate "data space" for the categories of my custom post type? I don't want the general post categories to appear in my custom post type and vice versa. The `register_taxonomy` function seems to add a "tagging system" (bottom panel in the screen) to the post type but not the same small window the "real" categories have (upper panel in the screen). ![custom categories vs custom tags](http://i.stack.imgur.com/YTd0x.png)


How to handle parent and child pages?

I want to list episodes of a series I am making of instructional videos with content. The patent page "series" will list episodes weekly. Ie: episodes 1, 2, etc. I'm thinking to setup a template to loop through the series parent page to display the episodes children content in a loop. Then on each series page there will be 3 panels. A long one with the video and other episodes thumbnails, one on the left and one on the iught with content. Just trying to work out how to display the children > children post content as above. Problem 1: displaying related thumbnails to other children? Problem 2: displaying the 3 panels. Do I set these up as individual children elements? If so, how can I style each one differently as it loops through? Any code examples would be amazing! Unless there's a plugin for this? Thanks!


Wrap all default widget into div tag

I want wrap all default widget into a div tag, so i can add a suffix class to define style for each widgets               <div class="suffix-class">      // widget     </div>      And in widget form, we have a input field to input this class. It like module of joomla. What can we do ? override all default widget ?


W3 Total Cache debug shows page caching not working, DB and Object caching works

I have nginx, apc running on my server and configure nginx according to this tutorial: http://codex.wordpress.org/Nginx I installed and activated w3 total cache and was done with all setting with no error displayed in the wp3 total cache admin page. I enabled the debug mode to check if caching worked on the front end. However, no matter how I tweaked the w3 total cache setting, only "W3 Total Cache: Db cache debug info" and 'W3 Total Cache: Object Cache debug info" are displayed in the source code of a page(whater page I tried). I just did not see the "Page cache info" being displayed. **But the /wp-content/cache/ folder, cache files were generated.** **Checks** :   * Server: ngxin 1.0.15, PHP 5.3.3 (Hosted in my unmanaged vps)   * nginx configuration file .conf file is in place with all the rules needed for W3 Total cache. (Pretty permalinks are working.)   * W3 Total Cache plugin itself not showing any warning or error.   * No other cache plugin enabled.   * Also made sure I'm checking the correct site.   * wp-config.php file has define('WP_CACHE', true);   * Theme has wp_footer() in footer.php **Compatibility Test:** > Server Modules & Resources: >   >   >     Plugin Version: 0.9.4 >     PHP Version: 5.3.3; >     Web Server: nginx >     FTP functions: Installed (required for Self-hosted (FTP) CDN support) >     Multibyte String support: Installed (required for Rackspace Cloud Files > support) >     cURL extension: Installed (required for Amazon S3, Amazon CloudFront, > Rackspace CloudFiles support) >     zlib extension: Installed (required for compression support) >     Opcode cache: Installed (APC) >     Memcache extension: Not installed >     HTML Tidy extension: Not installed (required for HTML Tidy minifier > suppport) >     Mime type detection: Installed (Fileinfo) (required for CDN support) >     Hash function: Installed (hash) (required for NetDNA / MaxCDN CDN purge > support) >     Safe mode: Off >     Open basedir: Off >     zlib output compression: Off >     set_time_limit: Available >   > > Additional Server Modules >   >   >     New Relic >     PHP version: Supported >     Operating System: Supported >     Web Server: Not Supported. (nginxcgi-fcgi See NewRelic Requirements > page.) >   > > WordPress Resources >   >   >     /home/micbus/public_html/micbus_w3-total-cache.conf: OK >     /home/micbus/public_html/wp-content: OK >     /home/micbus/public_html/wp-content/uploads/2014/04: OK >     Fancy permalinks: /%postname%/ >     WP_CACHE define: Defined (true) >     URL rewrite: Enabled >     Network mode: No >   Clicked "emtpy all caches" several times, switched page cache mode between basic and enhanced for a couple of times, but page cache debug info was still not shown. Could anyone please tell me whether page caching is working? If not, how to fix this?


How to restrict Front-End Editor on a page?

I am working on a site where the user can do everything from the front end. I am using the plugin from scribu called front-end editor. My problem, is that I have a dashboard page with all the options for the user and I do not want the user to be able to edit it. How do I restrict a page from being able to be edited by Front-End Editor. I have read the wiki on github for it here https://github.com/scribu/wp-front-end-editor/wiki/Actions-and-filters and can't find anything about restricting pages. Only categories.


How to make my feed tidy

I looked up 'how to get the rss feed for your wordpress blog' ...and discovered I just need to add /feed to the url of my blog. So that's this: http://richardclunan.com/blog/feed/ It looks really messy though. What do I need to do to make it tidy? Or is there another way to get a feed url for my blog that will already be tidy?


Wordpress plugin won't show on some themes

I have made a wordpress plugin following standard wordpress tutorials. This plugin add a file upload to the comment form by using simply this function:               add_action( 'comment_form_logged_in_after', array(&$this, 'add_to_comment_form') );      . But when I activate some themes it won't show on the comment form. Any Help how to make it show on comment form?


list posts of a person by a variable?

Basically I have some portfolio code that runs user bio pages in my site. here is the link Entechpc.com Meet Our Agents . When you click on an agents image, it takes you to his bio which is really just a post. All of that works fine. What I want to do, is list this persons listings as posts and assign the posts to a category of their name and then have them display below his bio in a separate div container. So all of the posts that are in his cat will display under his bio but if another agent is displayed it will only show their listings I have tried using multiple loops, wp_query and get posts by cat and a few other tactics to get this to work, but basically all i have been able to do is display all of the posts by everyone at once, meaning, it always just displays all of the posts in the db, lol. Now I am not a good php coder at all. I am really good with html and css and photoshop and illustrator. So is there anyway to achieve this? Basically my code right now is just a basic loop with the thumbnail, a couple of custom fields displayed and the_content for the main bio. I have erased all of the other code for the second part so I dont have any examples of what I was trying to do. Any help would be appreciated.


How to trigger function on preview a wordpress post?

I've created a plugin that fetch the featured image of post when a user Publish a post with featured image. The step by step process is,   1. A user create a new post with 'Add New' post   2. He choose featured image with 'Set Featured Image', give title and/or content   3. Then the user publish the post. I set a function on 'save_post' action, when post is published my function fetch the 'Featured Image' and make some different copy of them and show them in the same post. Now so far It is working without any problem. But now I found that when I preview the post the post is not showing the images in 'Preview Box' that my function makes. Actually my function triggers on "Publish Button" ('save_post' hook) pressing. But before publishing when one preview the post by clicking on 'Preview' it is yet to be triggered so the post doesn't show in the manner in the way that it is after publish. Can anyone tell how to trigger the function on 'Previewing Post'.