Custom navigation bar via wp_list_pages is broken for blog roll

Pretty simple question. I have the 'blog' on my site set via 'reading' to be the page 'blog' located at mysite.com/blog. `/blog` is hierarchical, in that it has children. I have a custom side bar that I include via a function in `functions.php` that does a simple include (ie: `function get_right_sidebar() { include('sidebar_right.php) };` ). I list all pages and children via a simple function:               function get_post_top_ancestor_id(){         global $post;               if($post->post_parent){             $ancestors = array_reverse(get_post_ancestors($post->ID));             return $ancestors[0];         }               return $post->ID;     }      Followed by:                   <ul class="clearfix">             <?php wp_list_pages( array('title_li'=>'','include'=>get_post_top_ancestor_id()) ); ?>             <?php wp_list_pages( array('title_li'=>'','depth'=>1,'child_of'=>get_post_top_ancestor_id()) ); ?>         </ul>      In the actual page template `sidebar_right.php` Now, this navigation bar works completely fine, accept when I navigate to the base-level `/blog`. Nothing shows up in the sidebar. After doing a `global $post; print_r($post)`in the `sidebar_right.php` I see that it is listing a post as the query, instead of page (and therefore is not getting the child pages to list in the sidebar). I tried tossing in a `wp_reset_query`, but it did nothing. Can anyone recommend what I should do in order to restore my navigation bar on my `/blog` section? Thanks! Tre


Saving custom form fields

I am creating a plugin. So far I have created a menu and a page containing the form. I want to save these form fields for any user with 'Doctors' role. I think it should be saved under wp_usermeta table. How I can save these fields for a user? Here is my code..               add_menu_page('Loyalty','Loyalty Programs', 'doctors', 'loyalty-programs', 'create_loyalty');     function create_loyalty(){

Loyalty Program Settings
          <form method="post" enctype="multipart/form-data" action="">          Enable Loyalty Program : <input type="checkbox" name="enable" class="checkbox">          Set PayBack :<input type="text" name="cashback" id="cash_back" class="payback" />          CashBack Validity :<input type="text" name="validity" id="payback_validity"       class="validity" />
                   <input type="submit" class="button-primary" value="<?php _e('Save Changes') ?>
           </form>
          }


wp_nav_menu custom walker - child items

I have written a custom walker to integrate a jquery dropdown nav script into my wp template. I need to add .dropdown-link to each of my parent menu items and .dropdown-wrapper to the unordered list of my child items. That much is working fine. My issue is, because of my dropdown script, I need to group my child menu items into groups of 3, each with their own unordered list ... and this seems very difficult with the way Walker_Nav_Menu class renders the list items What I'm seeing is that the opening unordered list for the child items is generated in start_lvl() and $output.= in start_el() defines the rendering of list items. But where is the opening unordered list (class=menu) for parent items generated? Why don't I see that anywhere? I think part of the answer might be in how the apply_filters('walker_nav_menu_start_el'...) works ... and this is where my wp knowledge is lacking ... I don't undersand the way filters are invoked in WP. And I don't understand what 'walker_nav_menu_start_el' refers to in this scenario ... I want to know how can I differentiate between a parent unordered list and the children's unordered list. My ideal output is:

ABOUT

sunnav1

sunnav2

sunnav3

 etc ...      The custom walker is here:               class dropdown_menu_walker extends Walker_Nav_Menu {         function start_lvl( &$output, $depth = 0, $args = array() ) {                 $indent = str_repeat("\t", $depth);                 $output .= "\n$indent
\n";          }              function end_lvl( &$output, $depth = 0, $args = array() ) {                 $indent = str_repeat("\t", $depth);                 $output .= "$indent
\n";         }            function start_el(&$output, $item, $depth, $args)       {            global $wp_query;            $indent = ( $depth ) ? str_repeat( "\t", $depth ) : '';            $class_names = $value = '';            $classes = empty( $item->classes ) ? array() : (array) $item->classes;            $class_names = join( ' ', apply_filters( 'nav_menu_css_class', array_filter( $classes ), $item ) );            $class_names = ' class="'. esc_attr( $class_names ) . '"';              $output .= $indent . '
ID . '"' . $value . $class_names .' count="' . $counter.'">';             $attributes  = ! empty( $item->attr_title ) ? ' title="'  . esc_attr( $item->attr_title ) .'"' : '';             $attributes .= ! empty( $item->target )     ? ' target="' . esc_attr( $item->target     ) .'"' : '';             $attributes .= ! empty( $item->xfn )        ? ' rel="'    . esc_attr( $item->xfn        ) .'"' : '';             $attributes .= ! empty( $item->url )        ? ' href="'   . esc_attr( $item->url        ) .'"' : '';             $attributes .= ! empty( $item->classes )    ? ' class="dropdown-link"' : '';                  $item_output .= '';             $item_output .= apply_filters( 'the_title', $item->title, $item->ID );             $item_output .= '';             $output .= apply_filters( 'walker_nav_menu_start_el', $item_output, $item, $depth, $args );              }}


How i add new link after Edit | Quick Edit | Trash | View in quick edit section

I want to add new link in custom post type . I have create a custom post type and i want to add new link after `Edit | Quick Edit | Trash | View` links like `Edit | Quick Edit | Trash | View | PDF` . How i add in custom post . i wondered many places but not getting any proper result for add new custom link after `Edit | Quick Edit | Trash | View`. Please let me know how i add.


How to un-attach rich text editor from named textarea elements

The script below is taken from a plugin that converts all textareas in the category and tags editors to rich text editors. I'm using it to convert the category "Description" textarea input box to rich text. However, I have another text area on this same edit screen (one that I've added as a custom field) that I don't want rich text enabled. However, the plugin applies rich text to all edit fields. Can someone tell from the code below how to do one of the following: > Disable rich text on a textarea with ID "myTextarea"? OR > Only apply the rich text to the Category "description" text area and no > others? (preferred)               add_action('init', 'catde_init');     function catde_init() {         if ( is_admin() || defined('DOING_AJAX') ) {             if ( current_user_can('manage_categories') )                 remove_filter('pre_term_description', 'wp_filter_kses');         }     }          add_action('load-categories.php', 'catde_admin_init');     add_action('load-edit-tags.php', 'catde_admin_init');     function catde_admin_init() {         if ( user_can_richedit() && isset($_GET['action']) && 'edit' === $_GET['action'] && ( !empty($_GET['cat_ID']) || ( !empty($_GET['taxonomy']) && !empty($_GET['tag_ID']) ) ) ) {             add_filter( 'tiny_mce_before_init', 'catde_mceinit');             add_action('admin_footer', 'wp_tiny_mce');             add_action('admin_head', 'catde_head');         }     }          function catde_mceinit($init) {              $init['mode'] = 'textareas';         $init['editor_selector'] = '';         $init['elements'] = 'category_description,description';         $init['plugins'] = 'safari,inlinepopups,autosave,spellchecker,paste,wordpress,media,fullscreen';         $init['theme_advanced_buttons1'] .= ',image';         $init['theme_advanced_buttons2'] .= ',code';         $init['onpageload'] = '';         $init['save_callback'] = '';              return $init;     }          function catde_head() { ?>         <style type="text/css">#category_description_tbl,#description_tbl{border:1px solid #dfdfdf;}.wp_themeSkin .mceStatusbar{border-color:#dfdfdf;}</style>     <?php     }


Is there a way to tell menu items to force non-SSL URLs?

I've got a client site which uses SSL for only a small chunk of pages where users purchase subscriptions. So, for those pages, we just make sure that any links into them have hrefs with https://etc and everything's fine. The problem is that once they're finished with the purchase and _exit_ those pages using any links managed by the site theme menus, the SSL connection is retained. These URL references are not under our direct control, as they're just created by dragging the requisite page/category block around in the menu manager, so we can't adjust the http(s) portion. This results in spurious security warnings about unsecured content on pages that shouldn't be secured anyway, and some issues with certain bits of scripting, etc. How can we fix this? Is there something I'm missing?


Is there a way for a limited user to just view the page of a post without being able to edit it?

I have multiple types of users using WordPress. One type is contributor. Right now they can't publish a post, it as to be the Admin or Editor. The problem I have is after the article is publish the contributors cannot re- access the page of the Post inside there WordPress account. It just says they don't have the rights. So is there a way that they can view the Post page without being allowed to edit anything or if they do and save it, it will not save it?


How can I forward just my homepage but not internal pages?

I'm using a page builder to create and test different versions of my homepage as if it were a landing page so I can A/B test it. That page builder is hosted on a different server than all the rest of my site. So how do I forward my root domain like mysite.com without forwarding also all of my internal pages such as mysite.com/internal_1 or mysite.com/internal_2 ? In the DNS Zone Settings if I point the @ to the page builder, then all my pages get forwarded, which I don't want. I'm just trying to forward the homepage but no internal pages. Any suggestions?


Grossly inefficient wordpress loops!

I'm working on a site at the moment for an orchestra. The various members need to be listed, according to their instrument. The members have a custom post type of biography and I'm capturing the instrument value via a custom field. The only way I can figure out how to display the relevant people in their relevant sections is to loop again and again through the custom post type, displaying the people that play a particular instrument by comparing the meta value. Code looks like this:               <?php $args = array( 'post_type' => 'biographies', 'posts_per_page' => -1 ); ?>
             <?php $biog = new WP_Query($args);                 if( $biog->have_posts() ) : while( $biog->have_posts() ) : $biog->the_post();                     $player = get_post_meta($post->ID, 'player', true);                     if ($player == 'yes') :                         $instrument = get_post_meta($post->ID, 'instrument', true);                         if ($instrument == 'violin') :                         ?>
<a id="artist_id_<?php the_ID(); ?>" class="nb" href="<?php the_permalink(); ?>"><?php the_title(); ?> : <?php echo($instrument); ?>
                         <?php                         endif;                     endif;                 endwhile; endif;             wp_reset_query();             $biog = new WP_Query($args);                 if( $biog->have_posts() ) : while( $biog->have_posts() ) : $biog->the_post();                     $player = get_post_meta($post->ID, 'player', true);                     if ($player == 'yes') :                         $instrument = get_post_meta($post->ID, 'instrument', true);                         if ($instrument == 'viola') :                         ?>
<a id="artist_id_<?php the_ID(); ?>" class="nb" href="<?php the_permalink(); ?>"><?php the_title(); ?> : <?php echo($instrument); ?>
                         <?php                         endif;                     endif;                 endwhile; endif;             wp_reset_query();              $biog = new WP_Query($args);                 if( $biog->have_posts() ) : while( $biog->have_posts() ) : $biog->the_post();                     $player = get_post_meta($post->ID, 'player', true);                     if ($player == 'yes') :                         $instrument = get_post_meta($post->ID, 'instrument', true);                         if ($instrument == 'cello') :                         ?>
<a id="artist_id_<?php the_ID(); ?>" class="nb" href="<?php the_permalink(); ?>"><?php the_title(); ?> : <?php echo($instrument); ?>
                         <?php                         endif;                     endif;                 endwhile; endif;             wp_reset_query();      etc. etc. ad nauseum. (there are currently 12 loops on the page!!) This is clearly totally inefficient, but quite simply, I don't know how to write better code that this and need some help!


WMP Plugin not showing up in the plugin panel?

I just downloaded the WMD Editor plugin.   For some reason is not showing up in the **Plugins** menu. the folder is called `wmd-editor/` **wmd-editor.php:**               <?php     /*     Plugin Name: WMD Editor     Plugin URI: http://c.hadcoleman.com/wordpress/wmd-editor     Description: Adds the WMD Editor to the comment field, to make life easier for your commenters.     Version: 1.0     Author: Chad Coleman     Author URI: http://c.hadcoleman.com      */          /*     This is a simple plugin that just adds the javascript call to the header of your template. You can gather more info on this project at http://code.google.com/p/wmd/     */               // function for head output sytles         function wmd_header() {             global $cb_path;             $cb_path = get_bloginfo('wpurl')."/wp-content/plugins/wmd-editor";  //URL to the plugin directory             $hHead = "\n".""."\n";             $hHead .= " \n";             $hHead .= ""."\n";             print($hHead);         }              add_action('wp_head', 'wmd_header'); ?>


Wordpress and MySQL: trying to print data using PHP from user_meta custom field data

I have some custom user_meta fields in my MySQL database. The data is stored in my DB as follows: the meta_key is called "paypal_user" and the info is stored in the meta_value column as: O:11:"Paypal_User":9:{s:8:"duration";s:1:"1";s:13:"duration_type";s:1:"y";s:6:"amount";s:2:"30";s:8:"currency";s:3:"GBP";s:13:"last_pay_date";s:10:"2011-02-12";s:11:"expire_date";s:10:"2012-02-12";s:12:"account_type";s:7:"premium";s:10:"status_str";s:27:"Last payment was successful";s:12:"payment_type";s:12:"subscription";} I need to print the "expire date" information on a webpage, as well as user_id and some form data s the user can print out a membership badge from the webpage. How do I access that one particular part of the meta_data column? Also, what do the numbers between each of the values in the meta_data column? I'm a newbie when it comes to using MySQL... Thanks in advance. Edit to add: I'm posting my code as I can't seem to get it to work at all. Any pointers would be appreciated:               <?php     include_once('wp-config.php');     include_once('wp-load.php');     include_once('wp-includes/wp-db.php');     ?>          <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">               <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />     <title>Untitled Document</title>

              <?php               if ( is_user_logged_in() ) {              global $user_ID;           // Get the 'paypal_user' info for the user. Just fetch a single     // value, not an array.     $paypal_user = get_user_meta($user_ID, 'paypal_user', true);     $exp_date = $paypal_user->expire_date;     ?>
<?php echo '$user_ID' ?>

PR34 2PL

<?php echo '$exp_date' ?>

     <?php } ?>
                     Thanks again.


Possible to make a subdirectory that loops through a single category?

I'm trying to separate the main part of my blog (the informational portion) from more commercial parts. WHen you load my homepage, I purposely exclude a category because I don't want my normal readers to be bothered with affiliate links and such. I'd like to add a subdirectory /reviews/ for example, that loops through the reviews category and displays them all on one page, just like how the category template works. There are 2 reasons I don't want to use the category template: 1) I have my SEO settings to block indexing on my category template 2) The /category/ in the permalinks is ugly to me. Is it possible to accomplish domain.com/reviews/ where it functions just like the category template? Am I stuck with manually building a page? Or am I stuck with domain.com/category/reviews ? I have looked into building a "network" with Wordpress MU, but it says I can't do that anymore since my blog is >1 month old. Plus it's kinda technical. I basically want to add more blogs to my site (to keep everything nicely separated), so I am trying to figure out a workaround by just excluding/including certain categories where I want them. Am I making sense? Haha thanks to all who take the time out of their day to reply :)


Registering / Enqueing Scripts Not Working

Does this look correct and would there be any reason why this isn't working? In functions.php...               /**     * Enqueue scripts and styles     */     function dcp_custom_scripts() {         wp_register_script('expand', get_template_directory_uri() . '/scripts/expand.js', array('jquery') );         wp_enqueue_script('expand');     }          add_action( 'wp_enqueue_scripts', 'dcp_custom_scripts' );      I've tried numerous variations from hundreds of articles online and nothing seems to work. This is a modified off-the-shelf theme built by someone else. They have manually inserted all scripts and styles directly in the `<head>` so it's a bit of a mess. Whatever I try, no scripts that I enqueue appear in the `<head>` at all, so it's not even attempting to work.


getting a 404 page for all pages except home. possibly permalinks

I can switch to default and everything works, but once permalinks is set i get the 404. The thing is I've been using permalinks for years without problems. I can't find what went wrong as I had not made any changes in weeks. It happened all of a sudden. I tried finding the .htaccess (showing hidden files) but to no avail. Does wordpress update itself perhaps? I notice there's an admin bar at the top of my page when logged in... Thanks


Add Class to a div using a filter?

is it possible to add a dynamic class to a div using a filter in the functions.php? I know it's possible for the body-tag - also for a custom defined div with an id?               if ( !is_search() ) {        $customclass = 'myclass';     }


I need to modify drafts using custom data from database and then publish it

First of all I'm still relatively new to programming and wordpress development. I'm building a plugin that takes custom data from database and a list of saved drafts and then modifies draft chosen by user, using that data. Right now it works like this:   * I added admin menu under Posts category using add_submenu_page(),   * On that page I created a dropdown menu using html select form that fetches list of drafts from database and displays it to user,   * I have a button next to dropdown menu that when you click it supposedly publishes post and modifies it using custom data from database.  My problem is that to accomplish this I would have to use POST and send all this stuff to another php page. I'd like to avoid this if possible because I want to keep this plugin simple and I'm not that comfortable with wordpress development. What I want to know is if there's any other way to do this? Some sort of built-in wordpress action or hook that I can use to achieve this? Or is there any other simpler approach in general. I've been considering also moving all of this to options and using Settings API and POSTing to options.php. I appreciate any input. Edit: Here's relevant code:

Select post:
             <form name="autogenerator">                  <select id='drafts' name="drafts">                      <?php foreach($keywords as $keyword) {                     $post = get_post($keyword);                     $title = $post->post_title;                     echo "<option value=$keyword>$title</option>";                 }?>                      <input type="button" onClick="" value="Generate!">                 </select>             </form>
      $keywords is a list of posts id. I'd like to be able to pass this id to my button so that when it's clicked it runs another function that publishes selected post and modifies it using data from database.


Delaying One RSS Feed in WordPress but Not the Others?

Is there anyway to create a special feed in WordPress that is on a delay that I can distribute to some of our content partners? I found some tutorials on how to delay your feed but it uses the conditional statement `is_feed` and I don't want to apply this to all feeds, just one particular feed. Any advice? **Edit:** To clarify, I want to provide one full feed that publishes in real time (the native WP feed) and another full feed that displays the same content but is on a delay so it doesn't update until after the time period that I specify.


Renaming Menu Item within Admin Menu Section for a Custom Post Type?

I have a feeling this is a bug. When you create a new custom post type it does not seem possible to modify the first submenu item text. I am referring to the link which allows you to view the post list. For what I can tell it just seems to be duplicating the name name of the main post type menu which was created. Does anyone know how to modify this text so that I can have the main menu element says "Articles" and the post list submenu name to say _"Manage Articles"_? I was under the impression that `"edit_item"` would control the text to be displayed in te submenu but for some reason this is not registering. Here is the code I am currently using:               //////////////////////////////////////////////////////////////////////////////     // CUSTOM POSTTYPE FOR -- ARTICLES       //////////////////////////////////////////////////////////////////////////////          add_action('init', 'articles');     function articles() {      register_post_type('articles', array(       'labels' => array(        'name'   => __('Articles'),        'singular_label'  => __('Article'),        'new_item'   => __('Add Article'),        'add_new'   => __('Add Article'),        'add_new_item'  => __('Add Article'),        'edit'   => __('Edit Article'),        'edit_item'   => __('Edit Article'),        'view'   => __('View Article'),        'view_item'   => __('View Article'),        'search_items'  => __('Search Articles'),        'not_found'   => __('No Articles Found'),        'not_found_in_trash' => __('No Articles Found in Trash'),        ),       'supports' => array(        'thumbnail',        'title',        'editor',        'author',        'revisions',        ),       'rewrite' => array(         'slug'   => 'articles',         'with_front'   => false,        ),       'rewrite'    => true,       'can_export'    => true,       'show_ui'    => true,       'menu_position'   => 3,       'public'    => true,       'query_var'    => true,       'publicly_queryable'  => true,       'exclude_from_search'  => false,       'capability_type'   => 'post',       'hierarchical'   => false,      ));      }               add_filter('manage_edit-articles_columns', 'add_new_articles_columns');     function add_new_articles_columns($articles_columns) {      $new_columns['cb']     = '<input type="checkbox" />';      $new_columns['article_thumbnail']   = _x('Image', 'column name');      $new_columns['title']    = _x('Article Title', 'column name');      $new_columns['article_excerpt']   = _x('Article Excerpt', 'column name');      $new_columns['article_source']   = _x('Article Source', 'column name');      $new_columns['author']    = __('Created by');      $new_columns['date']    = _x('Last Action', 'column name');      return $new_columns;      }     add_action('manage_posts_custom_column', 'manage_articles_columns', 10, 2);     function manage_articles_columns($column_name, $id) {      global $wpdb;      switch ($column_name) {        case 'article_thumbnail':          the_post_thumbnail( array(50,50) );        break;        case 'article_excerpt': echo substr(get_the_excerpt(),0,500);         break;       case 'article_source':              echo get_the_term_list($post->ID, 'content_sources', '', ', ','');        break;       default: break;       }      }


Taxonomy Extra Meta

> **Possible Duplicate:**   >  Adding Custom Field to Taxonomy Input :Panel I created a custom post type with a taxonomy associated. When I add new item for my taxonomy, I get name, slug and description. I want a new field in there, because I also need to add a image in my taxonomy.php file This is what I use to get the name and description:               <?php     if(isset($wp_taxonomies)) {         $term = get_term_by( 'slug', get_query_var( 'term' ), get_query_var( 'taxonomy' ) );         if($term) {             echo '
'.$term->name.'
';             ?> <img class="alignright" alt="<? echo $tax_term->name; ?>" src="<? echo $term->description; ?>" /> <?php         }     }     ?>      Can you tell my how can I hook a new textarea in my custom taxonomy and get-it in my taxonomy page? Thank you!


Wordpress overrides the GET variables, (page_id) set in HTACCESS

I have a wordpress site that is extremely large and pushing Wordpress to its limits. It uses a number of pages/categories and a lot of .htaccess rules to organise the various sections of the site, (it's for a large magazine). One particular issue is really stumping me. I have the following rules in .htaccess ...               RewriteRule ^(cat|tag)/([^\/]+)(/?)$ index.php?page_id=3&s1=$2 [L,QSA]     RewriteRule ^xyz/([^\/]+)(/?)$ index.php?page_id=6&s1=$1 [L,QSA]      Now, if the argument supplied to the cat/tag page has no trailing slash, it always works. If the argument has a trailing slash, **and** the tag in question matches the entries in a non-Wordpress table that work with the 'xyz' page, Wordpress loads that page instead, even if the tag is present. I have tested that the rules always work, and they do. Wordpress is always getting the correct $_GET['page'] of 3 and the tag slug as $_GET['s1'], and yet decides to show a different page altogether if the above is true. Everything is done within .htaccess, permalinks in wordpress are turned off completely. How can I stop WP form deciding against the page_id it has been told to use.


How do I white label my self-hosted site created by wordpress?

I have seen code in an answer to this question, how to remove the promotional back link to WordPress.org in my theme. I have added this to my theme's CSS but there is no change. Am I missing see some thing? Apologies for my Ignorance . Code I have used:               #site-generator {     display: none; }      How can you remove the widgets from dashboard and add new customized widgets ? Is there possibility to hide the date and time from posts ? **Update** :Could anybody tell me ,If I can remove the term 'wordpress' from displaying on title bar?


Set Default Admin Screen options & Metabox Order

I am desperately looking for some way (any way) to set default "screen options" and metabox order through the functions.php file. does anyone have any help they can provide here?


Don't change Custom Post Type slug to unique value

I have a situation where it is needed that if I create two CPT pages wich both have the same name and the same slug. For example, if I add two CPT pages, wich both called _"Post Name"_ :   The first slug will be _"post-name"_ ,   The second slug will be _"post-name-2"_. Because I added a custom part to the permalink structure wich will make the URL unique:               function extra_post_link( $permalink, $post, $leavename ) {         global $wp_rewrite;              if ( stripos( $permalink, '%selected_meta%' ) == false )             return $permalink;              if ( is_object( $post ) && ($post->post_type == 'ervaring' || $post->post_type == 'lening') ) {             $_selected_post_slug = '';             $_selected_post_id = get_post_meta( $post->ID, 'rating-post', true );                  if ( $_selected_post_id )                 $_selected_post_slug = get_page_uri( $_selected_post_id );                  return str_replace( '%selected_meta%', $_selected_post_slug, $permalink );         }              return $permalink;     }          add_filter( 'post_type_link', 'extra_post_link', 10, 3 );      How do I prevent WordPress from doing this?


Where do I get "Bug Information" to add to a question?

I have exactly the same issue as this closed question and want to resolve it. In the comment section it asks the OP to add "Bug Information". Where do I get bug information from so I can add it to my question on this stack. I am new to WordPress (if thats not obvious) I am using WordPress 3.5.1 and the Weaver 2 theme


Generate Advanced Custom Fields box in custom admin menu page

I have created an custom admin menu page called FCC Youtube with `add_menu_page` function which has some custom fields I manually generated via HTML and PHP: code ( just the part how I created this custom admin menu page )               // creat admin menu page      add_action("admin_menu","youtube_menu");     function youtube_menu() {             add_menu_page('Youtube Channel Settings', 'FCC Youtube', 'edit_pages', 'youtube_channel_settings', 'youtube_channel_render_page','http://fcc.sportingpulse.com/wp-content/uploads/2013/04/youtube_icon16x16.png');             add_action('admin_init','youtube_regsettings');         }      ![see image](http://i.stack.imgur.com/lgmkr.png) I want to create many admin menu pages like the FCC Youtube page I've created. ( FCC Vimeo, FCC Buttons etc.) I wish these pages have ACF field groups. , means I can create ACF field groups and assign the group to my custom admin menu pages It will work exactly like ACF Option-addon page. ACF Option-addon doesn't allow me to create multiple top level Options page. I understand I can create multiple second-level option page but I wish to have many TOP Level ones, but I still can't figure out how to do this! I have purchased the Option add-on but it doesn't allow me to create multiple "top level" Option page, I only have a parent page called "Options" then lots of sub pages under it, I wish to have other "Top Level" pages have other names than "Options" , but it seems very difficult to do : s, see this ![enter image description here](http://i.stack.imgur.com/6BRQ0.png) I have all these bunch of options page under the Parent 'Options', I can't move them outside of the parent ![enter image description here](http://i.stack.imgur.com/a0d9W.png)


Making my first wordpress template

I making my first Wordpress template. I used this code to add only the h1 to the page.               <?php $title = get_the_title($post->ID); echo $title; ?>      But is there a code. That only add the post to the page?


Limit search to custom field

I have a custom post type bananas with a custom field _bananas_size (size is a number). Now I'd like a search field that only searches the custom field size. For example: the visitors selects value 6 and hits search. Then I want only the bananas with a size of 6 or bigger to show up as results. I've found multiple topics on how to handle a search with custom post types. However I haven't found how to limit the search to a custom post field. What I currently have is this: **searchform.php**               <form role="search" action="<?php echo site_url('/'); ?>" method="get" id="searchform">     <input type="hidden" name="post_type" value="bananas" />      <select name="size">         <option value="4">4</option>         <option value="6">6</option>         <option value="8">8</option>         <option value="10">10</option>     </select>          <input type="submit" alt="Search" value="Search" />     </form>      **search.php**               $type = 'bananas';     $args=array(         'post_type' => $type,         'post_status' => 'publish',         'posts_per_page' => -1,         'orderby' => 'meta_value',         'order' => 'ASC',         'meta_key' => '_bananas_size',         'meta_query' => array(             array(                 'key' => '_bananas_size',                 'value' => $_GET['size'],                 'compare' => '>=',                 'type' => 'NUMERIC'             )         )     );          $my_query = null;     $my_query = new WP_Query($args);      This returns a list of all bananas, no matter the size. How can I limit the search to the _bananas_size field? * * * **Update:** I tried to do a var_dump like Tomás Cot suggested below but I got no output at all (even not from an `echo "<h1>Size: </h1>";`). I changed the searchform.php to:               <form role="search" action="<?php echo site_url('/'); ?>" method="get" id="searchform">          <input type="search" name="s" placeholder="Search…">     <input type="hidden" name="post_type" value="bananas">               <input type="submit" alt="Search" value="Search" />     </form>      This resulted in the following output: `var_dump($_GET['size']);`: NULL `var_dump($my_query->request);`: http://pastebin.com/XYwqW2F9 **Update 2:** It turned out that I had a typo in my code (fieldname was _bananassize, not _bananas_size). A very big thanks to @Tomás Cot for finding this! The code he posted below in the answer works great after I fixed my mistake.


Move post from one blog to another on same server with different prefixed tables

I have one blog at example.com and another at example.com/other (use same database - different prefix) What I am trying to accomplish is moving post(conditionally by custom field value) to either blog <-> depending on the value of the custom field. I was hoping there was a straight forward way of doing this in php - What I got so far is Get all the post that need to be moved (array of ids etc...) Then find all the images/ meta / tags / taxonomies / custom taxonomies etc.. involved with the post export this data somehow - I would probably use a serialized array/object or json then on the other blog import everything wp_insert_post wp_insert_attachment wp_insert_post_meta Now before I go through all this - I would like like to know if there is a way to do this that I am not thinking about? I see time and time again (use the built in export) but one I need to do this behind the scenes(automate) and two it does not allow to get only the custom post_type with attachments and I have played with many plugins and none seem to just get it right. I am not afraid to code this but feel there must be an easier way. Any suggestions?


Custom RSS feed - blank page

I've read all the articles about creating a custom RSS feed, but haven't had any luck - always results in a blank page. To make things simple, here is the code I'm using - with the link being `www.mysite.com?feed=fb2` Note, this has worked on some servers (meaning there is no blank page, and the RSS works), but not on others with no apparent logic to explain why. Can anybody see what might be going on?               function rssmi_feed() {       get_my_feed();     }     add_action('init', 'rssmi_rss');          function rssmi_rss(){       add_feed('fb2', 'rssmi_feed');     }     function get_my_feed(){       header("Content-Type: application/rss+xml; charset=UTF-8");       echo '<?xml version="1.0"?>';       $output = '<rss version="2.0">';       $output .= '<channel>';       $output .= '<title>Your RSS Feed Name or Website Name</title>';       $output .= '<description>A description of your feed or site.</description>';       $output .= '<link>http://www.yoursite.com/</link>';       $output .= '<copyright>Your copyright details</copyright>';       $output .= '<item>';             $output .= '<title>Some Title</title>';          $output .= '<link>Some Link</link>';       $output .= '<description>A description</description>';       $output .= '<pubdate>The date</pubdate>';       $output .= '<guid>The Link</guid>';       $output .= '</item>';       $output .= '</channel></rss>';       echo($output);     }


Add filter to wp_dropdown_pages() or wp_dropdown_categories() - no select container?

I'm working with `wp_dropdown_pages()` and `wp_dropdown_categories()` and both are always outputting a `<select>`-box with its `<option>`s as items. Is it possible to add a filter/hook to this funtions so I get just the `<option>`s without being wrapped inside of a `<select>` The reason I'm asking is that I want to combine pages and categories into one dropdown. I couldn't find a param to set this! Any ideas on that?


multi custom fields and taxonomy search

we have a couple of custom meta boxes for product (custom post type). one custom meta box key is area_required_width, and we have numbers input for it when publishing products, now we want to have a dropdown including <5, 5-10, 10-20, 20-50, >50 to search this key value of area_required_width at frontend for users. I know that we can use custom WP_query to search if at backend we store ranges instead of input numbers as frontend. the thing is that our data stores is numbers we input while search criteria is different ranges like <5, 5-10 ...


Permalink issues with custom taxonomies

I have a (hopefully simple) question here. Built in post type: Category I have a custom post type: Rights, with a custom Category taxonomy for it (Rights Category). My issue is using the rewrite slug of `rights/category` is being caught first by the generic `category` rewrite rule. So I am currently stuck using `rights- category`, or `rights/categories` (at least a little more elegant). Is there any way (besides changing the Category base) to essentially say "Prioritize my custom rewrite rule over the built-in ones"? Last time I looked at Category's registration, I didn't think it was possible to register your own taxonomies before the built-in ones (priority 0), therefore placing your own rewrite rules ahead of WP Core's. **Note:** I am defining the custom taxonomy and post type within mu-plugins. I also just tried using a priority of 0, and 1, and they seem to work with no repercussions. I'd still like some validation on this, however.


How do i use postMash to order posts in a custom loop?

I'm using the postMash plugin to allow a client to be able to easily reorder posts without having to change the timestamp on each one, and it works fine. However, I'm using a custom loop to call the latest posts in a category onto the home page like so:               $i=0;     $events = get_posts( array ( 'category' => 6, 'orderby' => 'menu_order', 'order' => 'ASC' ) );     if ( $events ) {         echo '
';         foreach ( $events as $event )  {             $eventDate = get_post_meta($event->ID, 'event-date', true );             $eventTime = get_post_meta($event->ID, 'event-time', true);             echo "
".$eventDate;             if ($eventDate && $eventTime) {                 echo " - ";             }             echo $eventTime."
";             echo "ID)."'>".get_the_title($event->ID)."

";         if (++$i == 3) break;     }     echo '
';      } The plugin successfully reorders the posts on the category page, but not within this custom loop.. Here's the plugin url: http://wordpress.org/extend/plugins/postmash/


Permissions with Custom Post Types

Afternoon everyone. I made a theme for a friend's site using a custom post type called "fixtures" but I can't get it to allow users listed as "Writers" to be attributed as the authors of these posts, which is very annoying. I've followed numerous tutorials but no luck! Here's what I've got so far. When registering my post type I include this:               'capability_type' => array("fixture", "fixtures"),     'map_meta_cap'    => true,      Then I have a function further down the file which is this:               function add_fixture_caps_to_admin() {       $caps = array(       'read',       'read_fixture',       'read_private_fixtures',       'edit_fixtures',       'edit_private_fixtures',       'edit_published_fixtures',       'edit_others_fixtures',       'publish_fixtures',       'delete_fixtures',       'delete_private_fixtures',       'delete_published_fixtures',       'delete_others_fixtures',     );     $roles = array(       get_role( 'administrator' ),       get_role( 'writer' ),       get_role( 'author' ),     );     foreach ($roles as $role) {       foreach ($caps as $cap) {         $role->add_cap( $cap );       }     }     }     add_action( 'after_setup_theme', 'add_fixture_caps_to_admin' );      The guy uses a plugin called "User Role Editor" and despite ticking all these boxes for the "fixtures" post type, the "Writers" are still not on the last to change the author to. Any ideas? Thanks, Mike


connecting two post types or functions

Alright, so I have started asking related questions to this bout 4 times now trying to figure out what exactly I need to ask without making it too complicated. So I've got two examples of this that I am attempting to figure out.   1. If I have two post types that are connected and need data from both to perform a final calculation I need a way to connect them. If I have a CPT called product-groups with a field for a Group_ID (exp: Product group: glossy prints, Grp_Id= GP) and then a CPT called product with a field for the product-sku that was formed in excel with the Group_ID+ a sequential number. (exp: A 10x10 print in the glossy print group may have a sku GP_1234) So I need a way to connect the Product with the product group so the calculations will be performed correctly. There may be an easier way to accomplish this with wordpress, but for now the only solution I can think of is to split the GP_1234 string so I can run a comparison function to find products that are in the product group. Does that make sense? Or maybe instead of splitting the sku to isolate the letters, maybe there is a function that simply checks the sku for the letters GP in this case?   1. This may be similar, but maybe not. In addition to combining the two custom post types. I also need to run a comparison with a user meta field.  In my product_groups post type, I have three fields that act as multipliers when calculating the final price to display to the user ($p_high, $p_med, $p_low. This is so I can have different prices per client, or easily create a promotional price without manually having to change hundreds of entries. Anyway. in my user meta I have a field called $client_lvl This can either be high, medium(med), or low. So I created a function that determines the current client level based on if the user is logged in, and the data assigned to that field. But now, I need to create a function that determines which of the three multiplier fields to use based on that client level. my calculations will use one of these three fields. But with a bit of an extra complication. So lets say the current calculation I am using is based on area. So I get the area meta value and store it as $area Then I determine the client level (high, medium, or low) If High $multiplier = p_high If medium $multiplier = p_med If Low $multiplier = p_low I was trying to create a function that would prevent me from needing to have so much code on each switch case for the different multiplier types. I thought of something like this:               function display_right_price($client_lvl)     {If ($client_lvl == "high")     {echo "\${$price1}";}          else {       echo "WAS:\${$price1}
";     echo "Now: \${$price2}";     }}      $price1 would be the calculated high price, while $price2 would be either the medium or low price depending on client_lvl. SO I guess my question is, what is the best way to assign the appropriate multiplier level to be calculated based on the current client level. While also performing the high calculation to display the "was" price. So you can get an idea as to what I am working with so far, here is the sample switch statement and dummy variables. The function I want to include would replace the echo statement.               $p_high= 2; //get_post_meta($post_id,$key     $p_med= 1.5;     $p_low =1.1;     $cogs= 10;     $img_count =3;     $img_cost= 10;     $area= 40;     $m_type=  'Area';               $prices= array('High' => $p_high,'Medium' => $p_med,'Low' => $p_low);         Foreach($prices as $lvl => $multiplier)         {     switch ($m_type) {               case 'Area':              $price= $multiplier * $area;                 echo "The {$lvl} price is \${$price}
";              break;               case 'Image':                   $price= $multiplier * $img_count *$cogs;              echo "The {$lvl} price is \${$price}
";              break;               case 'Commission':                   $price= $multiplier + $cogs;              echo "The {$lvl} price is \${$price}
";              break;               case 'Flat':                   $price= $multiplier;              echo "The {$lvl} price is \${$price}
";              break;               case 'Commission+Image':                   $price= $multiplier + ($img_cost*$img_count);              echo "The {$lvl} price is \${$price}
";              break;               case 'Price':                   $price= $multiplier * $cogs;              echo "The {$lvl} price is \${$price}
";              break;     }}


is wpdb->replace() already sanitized?

i am working on a plugin that includes table in database that holds information from the different posts. right now i use `$wpdb->replace()`, so whenever a post is being created or updated it is also create a new row in my table or update one that is already exist. my questions are:   1. is `replace()` already sanitizing the values before insert them into my table or do i have to use `prepare()` before i use replace?   2. is it ok to use replace so i can cover both cases of "insert" for new post and "upadte" if updating post or should i use `update()` if exist else "insert" if not. i know that replace is slower when it comes to performance but maybe it is ok when not being used very often (well, only when creating and updating posts)?


positioning disqus comment box in a specific location using function.php file

I need to display disqus comment box just after the post end (there are some other related post plugins which also load after post content so i want to post the disqus above them. Earlier when i was using fb comment it was easy to do the function is used was               add_filter ('the_content', 'myfbcomments',9);           function myfbcomments($content) {          if(is_single()) {              $content.="
What did you think of the article? Leave a comment.
";              $content.= do_shortcode('[fbcomment]');          }          return $content;      }      and it worked perfectly -but now i want to replace it with disqus comment and disqus gives me               <?php disqus_embed('dl'); ?>      how can i replace this in above `do_shortcode[tag]` when i try to add `$content.=disqus_embed('dl');` it loads the disqus on top of the page Let me know if i am not fully clear


Why does order ASC break offset in WP_Query?

I have a function being used in an AJAX call for adding the next 5 posts. The call checks the amount of posts being displayed already and send that as an `$offset` parameter. The `$args` for `query_posts` look like this:               add_action('wp_ajax_loadMore', 'loadMore');     add_action('wp_ajax_nopriv_loadMore', 'loadMore');          function loadMore() {              $posts_per_page = $_GET['posts_per_page'];         $offset = $_GET['offset'];              query_posts(              array(                 'posts_per_page' => $posts_per_page,                 'post_type' => 'exhibitor',                 'order' => 'ASC',                 'orderby' => 'title',                 'offset' => $offset             )         );              ob_start();                  get_template_part('exhibitors-post-type/content', 'exhibitor');              $output = ob_get_contents();         ob_end_clean();              wp_reset_query();              echo $output;              die();          }      If I change `'order' => 'ASC'` to `'order' => 'DESC'` then everything works perfectly. It seems that something about `'order' => 'ASC'` breaks the `'offset'`. I have tried this with `'orderby' => 'date'` and no `'orderby'` at all. Both produced the same issue. UPDATE 09/07/2014 10:32AM ET This is only happening during an AJAX call. It also only happens on the first request for 5 posts. The AJAX call and JS that determines the offset is:               $posts_per_page = 5;     query_posts(          array(             'posts_per_page' => $posts_per_page,             'post_type' => 'exhibitor',             'order' => 'ASC',             'orderby' => 'title'         )     );     global $wp_query; $found_posts = $wp_query->found_posts;     ?>          <?php      get_template_part('exhibitors-post-type/content', 'exhibitor');     ?>     <script>              jQuery(document).ready(function($) {             var found_posts = <?php echo $found_posts; ?>;             var posts_per_page = <?php echo $posts_per_page; ?>;             var posts_on_page = $(".fullarticle").length;                    $("#load-more").click(function() {                 posts_on_page = $(".fullarticle").length;                 if (posts_on_page === found_posts) {                     $("#load-more").text('No more posts!');                 }                 else {                     $.ajax({                         type: "GET",                         url: "<?php echo admin_url('admin-ajax.php'); ?>",                         dataType: 'html',                         data: ({ action: 'loadMore', posts_per_page: posts_per_page, offset: posts_on_page}),                         success: function(results){                             $('#fullcolumn').append(results);                             if (posts_on_page === found_posts) {                                 $("#load-more").text('No more!');                             }                         }                     });                 }             });         });          </script>               <button id="load-more" name="button">Load More</button>          </div><!-- End articlecontainer -->          <script>         jQuery(document).ready(function($) {                     $('.discop-nav-menu-widget-form :checkbox').change(function() {                 var checkValues = $('.discop-nav-menu-widget-form input[type=checkbox]:checked').map(function() {                     return $(this).attr('name');                 }).get();                 $.ajax({                     type: "GET",                     url: "<?php echo admin_url('admin-ajax.php'); ?>",                     dataType: 'html',                     data: { action: 'exhibitor_ajax', ids: checkValues },                     success:function(result){                         $('#the-results').empty();                         $('#the-results').html(result);                     }                 });             });         });     </script>


wysiwyg editor don´t export paragraph <p>

I use cmb for my custom metaboxes. What I´ve done:               'type'    => 'wysiwyg'      My WP-Backend: (HTML-Editor):
Headline
     Paragraph      Browser-Source just looks like:
Headline
     Paragraph      Without `<p>` tag. => When I do the same code into the standard WP-Editor it works fine with `<p>`. How can I export the `<p>`, too? Thanks   Ogni


Wordpress Image uploads plugin needed

I am looking for a wordpress plugin where I can upload images and store them into a category. For example I would have say..10 images to upload, I would give the album a name or date and then upload them. Is there any plugins around that can do this?


How to show an entire post content and not also the excerpt?

I am pretty new in WordPress theme development and I have the following problem showing posts. You can easily understand what I mean opening this link: http://lnx.asper- eritrea.com/25-ottobre-2013-roma-manifestazione-per-le-vittime-di-lampedusa- piazza-montecitorio-ore-10/ As you can see this is a post but this is not shown the entire post content but only approximately 3 rows of the entire post content (thene is printed the [...] that I think means that there are other text). So into my **single.php** file (the one that show a single post content) I found:                                     <?php                 // Start the Loop.                 while ( have_posts() ) : the_post();                          /*                      * Include the post format-specific template for the content. If you want to                      * use this in a child theme, then include a file called called content-___.php                      * (where ___ is the post format) and that will be used instead.                      */                     get_template_part( 'content', get_post_format() );                          // Previous/next post navigation.                     //twentyfourteen_post_nav();                          // If comments are open or we have at least one comment, load up the comment template.                     if ( comments_open() || get_comments_number() ) {                         comments_template();                     }                 endwhile;             ?>               and this is the code of the **content.php** file (the one that show the post content):               <?php     /**      * The default template for displaying content      *      * Used for both single and index/archive/search.      *      * @package WordPress      * @subpackage AsperTheme      * @since AsperTheme 1.0      */     ?>                    <article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
                     <a href="<?php the_permalink(); ?>"                         title="<?php printf(__('Permalink to %s', 'your-theme'), the_title_attribute('echo=0')); ?>"                        rel="bookmark"><?php the_title(); ?>

                 <?php _e('By ', 'your-theme'); ?>                                      <a class="url fn n" href="<?php echo get_author_link(false, $authordata -> ID, $authordata -> user_nicename); ?>"                                          title="<?php printf(__('View all posts by %s', 'your-theme'), $authordata -> display_name); ?>"><?php the_author(); ?>                                                        |                  <?php _e('Published ', 'your-theme'); ?>                                      <abbr class="published" title="<?php the_time('Y-m-d\TH:i:sO') ?>"><?php the_time(get_option('date_format')); ?>                                  <?php edit_post_link( __( 'Edit', 'your-theme' ), "|\n\t\t\t\t\t\t", "\n\t\t\t\t\t" ) ?>

                              <?php the_excerpt(); ?>             <?php wp_link_pages('before=
' . __( 'Pages:', 'your-theme' ) . '&after=
') ?>

                              <?php _e('Posted in ', 'your-theme'); ?>                 <?php echo get_the_category_list(', '); ?>                           |              <?php the_tags( '' . __('Tagged ', 'your-theme' ) . '', ", ", "\n\t\t\t\t\t\t|\n" ) ?>                 <?php comments_popup_link( __( 'Leave a comment', 'your-theme' ), __( '1 Comment', 'your-theme' ), __( '% Comments', 'your-theme' ) ) ?>                 <?php edit_post_link( __( 'Edit', 'your-theme' ), "|\n\t\t\t\t\t\t", "\n\t\t\t\t\t\n" ) ?>

        So I think that when I open a post I see only its beginning part could depend by the fact that into **content.php** I have:               <?php the_excerpt(); ?>      Is it right? How can I show the entire post and not only its beginning part?


Theme customizer - settings order

If I add more than 5 Settings to a single section, the order of the settings gets weird. For example:               // Link color     $wp_customize->add_setting( 'tonal_'.$themeslug.'_settings[link_color1]', array(         'default'           => $themeOptions['link_color1'],         'type'              => 'option',         'sanitize_callback' => 'sanitize_hex_color',         'capability'        => 'edit_theme_options',         'transport'         => 'postMessage'     ) );     $wp_customize->add_control( new WP_Customize_Color_Control( $wp_customize, 'tonal_'.$themeslug.'_settings[link_color1]', array(         'label'    => __( 'Link color1', 'tonal' ),         'section'  => 'colors',         'settings' => 'tonal_'.$themeslug.'_settings[link_color1]',         'choices'  => '#ffffff'     ) ) );      Further examples in a pastebin - no expiration time The colors are numbered from 1 to 7, but in the settings they appear in that order: 2,1,3,4,6,5,7 Has anybody experienced the same? Or does anybody even know how to solve this?


Wrong links in Wordpress?

I have a project on Wordpress. I would like add an article. In admin panel I click on **Post** , then **Categories** and add a new category called **article**. Next I add a new post and edit title, body and finally check the category called **article**. Now i have: > Permalink: http://mypage.org/article/test On site also is this link, but if I open this url I have: > This entry was posted in **article**. Bookmark the permalink. Follow any > comments here with the RSS feed for this post. Post a comment or leave a > trackback: Trackback URL. Edit But in this url I don't have my article. Why? In index page I have it, but if I open an article I have this error. What can I do?


get latest added term from taxonomy and insert into php variable

I have a taxonomy called `mailers` And I am adding new terms to this taxonomy on a monthly basis. For example these are my 4 recent terms (slugs) I have added...               'august-2012-newsletter'     'july-2012-newsletter'     'june-2012-newsletter'     'may-2012-newsletter'         Is there anyway way to get the latest added term and added it to my `$mailer` variable? Instead of having manually type the latest term in every month?                  $mailer = 'august-2012-newsletter';          $articles = new WP_Query(array(              'mailers'       => $mailer,          'order'         => 'ASC',         'orderby'       => 'meta_value',         'meta_key'      => 'mailer_order',         'post_type'     => 'post'          ));         Thank you so much for any ideas :-)


Datepicker Not Showing On Front End in Firefox Using Shortcode

So I'm using the code below which shows the 2 datepickers fine in Chrome, but not in Firefox (and IE in some versions as my clients tell me). Any ideas? Inside a shortcode function I have this referenced:                 function enqueue_date_picker_events_cal(){                     wp_enqueue_script(                     'field-date-js',                     '/js/field_date.js',                     array('jquery', 'jquery-ui-core', 'jquery-ui-datepicker'),                     current_time( 'timestamp' )                 );                     wp_enqueue_style( 'jquery-ui-datepicker' );                      }                  add_action( 'wp_enqueue_scripts', 'enqueue_date_picker_events_cal' );      Since I have 2 datepickers in the same form, I use classes that I reference in the js file as per below for each;               jQuery(document).ready(function(){     $('.sidatepicker').datepicker({      dateFormat: 'dd-mm-yy'      }).val();            $('.sidatepicker2').datepicker({      dateFormat: 'dd-mm-yy'      }).val();        });      And then in my form I have this.... now I know there maybe some issues with type="date" vs type="text", but I can only get the former to work.               <input class='sidatepicker' type="date" name='_EventStartDate[datepicker]' value='' />     <input class="sidatepicker2" type="date" name="_EventEndDate[datepicker]"  value="" />


get posts where a custom field contains a text

I have a custom field where the value contains a comma separated list of items (like: `test1,test2,test3`), now I want to retrieve posts where the field contains one of the values, I have:               $query = get_posts(          array(              'post_type'      => 'custom_post',              'posts_per_page' => 11,              'meta_query'     => array(                 array(                     'key'     => '_my_custom_field_key',                     'value'   => array('test1'),                     'compare' => 'IN'                 )             )          )      );      And it fails. It works if I clear other values from the custom field so it only contains `test1` but not when it's in the comma-separated group. In SQL I can use `FIND_IN_SET` function to search for the value, but I'm trying to reply on core WP as much as possible and avoid custom SQL codes, it would be cool if it were possible.


404 error when reactivatin my plugin

I recently installed Jetpack plugin, but after activating it & trying to connect to wordpress, i alwats got 500 error "internal server error". I decided to deactivate the plugin and delete it to solve the issue but unfortunately when i try to activate it again i receive a 404 error page which tells the following: "Not Acceptable An appropriate representation of the requested resource /wp-admin/plugins.php could not be found on this server. Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request." Actually i don't know what is wrong? how can i solve this problem? does anyone has any suggestion? thanks in advance,


WooCommerce - Show shipping cost on product page

I am developing an eCommerce site using WooCommerce for a client, and they want to be able to show the shipping cost of a product on the product page (because that's what they have on their old store site). Is there a way to do this? I've looked around and can't find anything definitive, and although there is a similar question here on StackExchange, no one has answered the question. I'm aware that there's a $79 plugin to do this, but is there a way to set the shipping cost per item as well? Would rather avoid purchasing a plugin.


How to get a nofication when post submitted

I was wondering is there a way to send the admin a notification (email or otherwise) whenever a user submits a post. Currently, I have to log into the admin section to see if there was anything submitted. I need to review their post before actually publishing it, so I need to be notified via email whenever a post is submitted. Does anyone know of a solution for this? Thanks a lot


Wordpress Admin Login Custom Logo

I know this may not be possible.But just trying to know wordpress deeply. Is it possible to replace default admin login page with custom one?


Yoast SEO breaks site (css?) in IE

For the life of me I can't figure out why Yoast SEO devastates the rendering of my site (artisteer generated theme) in IE(8). Deactivated, the site renders as expected. Best I can think is to offer the page source each way (both with, and without Yoast activated) hoping some kind soul might spot something that might be causing this in the comparison. Unfortunately, that would far exceed the WP Answers character limit, so again I'm at a loss for a course of action. FWIW here's a link to my broken site ( _Yoast Activated_ ). Beyond Compare finds 3 difference sections with Yoast vs without First difference section (with Yoast)                        <link rel="canonical" href="http://wallabykids.com/teaching-kids-to" />           Second difference (with Yoast) returns an oddly placed opening
 tag the closing match for which is returned with or without (so without it's mate is dangling, but I can't figure out where /why either is being generated at all)
      The third difference section (with Yoast) is just the Yoast admin bar
 set
SEO

Keyword Research

AdWords External
     // etc.      Might be worth mentioning that rendering on an identical site on my dev server (wamp stack) is **almost** _OK_ , where only the admin bar styles are foobared, but with debug true on both live and dev sites, no errors are returned (php or js) for either. Suggestions?


'category__and' for custom taxonomy?

I've a custom post type 'post-type-x' and three custom taxonomies attached with it 'taxonomy-1', 'taxonomy-2' and 'taxonomy-3'. I want to retrieve all the posts that have custom taxonomies 'taxonomy-1' and 'taxonomy-2'. What will be the arguments array that I'll be passing in query_posts function?               $args = array ( ..?.. )


Meta_query not filtering posts

I'm trying to filter out 'properties' on a page based on whether they are vacation or long-term rentals. Right now, the results of the following query displays all properties, not just either vacation or just long-term rentals. Am I missing something super obvious?               $args = array(             'post_type' => 'property',             'meta_query' => array(                 array(                     'key' => 'rental_type',                     'value' => 'Vacation'                 )             ),             'posts_per_page' => $properties_per_page,             'paged' => $paged         );


How can I send edits to my blog programmaticly?

I have started a very simple wordpress blog for a hockey pool I run. The site is located at: http://thekeeperpool.wordpress.com/ I manage the actual stats counting and player movement using a local application I made in c#. I have written some logic to output the HTML needed for the body of each persons team page. (e.g. http://thekeeperpool.wordpress.com/andrews-team/) Right now, I need to open up each of the 6 team pages, press the edit button to bring up the page's html, and then paste then new version of the body HTML in. I am looking for a way to automate this. I have looked at the wordpress REST API, and it seems like it has the features I would need (http://developer.wordpress.com/docs/api/1/post/sites/%24site/posts/%24post_ID/) but I have no idea how to use this API. Am I headed in the right direction? How do I use this API in a script running on my local machine to access my blog, hosted by wordpress?


How can I add a filter to a particular post format?

I have several post formats and I want to use `add_filter` selectively, applying the filter to some of the post formats but not all. When I do this in my `functions.php` file it affect all the post formats. It also affects all my custom post types which I want to avoid.               function test_filter($content) {         $content = "test" . $content;         return $content;     }     add_filter('the_content','test_filter');


Conditional Redirect

I'm looking to do a redirect based on browser, but only for a specific page (or 2). I'd like to send the user to an alternative page if the browser is IE7 or less. The alt page will have completely different setup and everything to work for their old crap. I can't find a plugin. I'm looking at doing a php inject plugin to make this page specific. Any advice?


All of my Scripts and Enques are getting file not found

I have the following script and enque function, and the site properly renders it in the html head, however when I click the link to the css and javascript files the i get a url not found, however the url is correct. I changed the permissions to 777 for all the folders so I am not sure why it cant see it. You can view the error site here and the error here.               // loading modernizr and jquery, and reply script     function bones_scripts_and_styles() {       if (!is_admin()) {              // modernizr (without media query polyfill)         wp_register_script( 'bones-modernizr', get_stylesheet_directory_uri() . '/library/js/libs/modernizr.custom.min.js', array(), '2.5.3', false );              // register main stylesheet         wp_register_style( 'bones-stylesheet', get_stylesheet_directory_uri() . '/library/css/style.css', array(), '', 'all' );              // ie-only style sheet         wp_register_style( 'bones-ie-only', get_stylesheet_directory_uri() . '/library/css/ie.css', array(), '' );              // comment reply script for threaded comments         if ( is_singular() AND comments_open() AND (get_option('thread_comments') == 1)) {           wp_enqueue_script( 'comment-reply' );         }              //adding scripts file in the footer         wp_register_script( 'bones-js', get_stylesheet_directory_uri() . '/library/js/scripts.js', array( 'jquery' ), '', true );              // enqueue styles and scripts         wp_enqueue_script( 'bones-modernizr' );         wp_enqueue_style( 'bones-stylesheet' );         wp_enqueue_style('bones-ie-only');         /*         I recommend using a plugin to call jQuery         using the google cdn. That way it stays cached         and your site will load faster.         */         wp_enqueue_script( 'jquery' );         wp_enqueue_script( 'bones-js' );            }     }


I'm running into a problem with my plugin which is essentially an admin page that includes simple_html_dom parser to edit some information scraped from some websites. Let's assume I want to parse this page: http://wordpress.stackexchange.com/ And store all question Titles as $item[0] and question's URLs as $item[1]. My plugin folder is called test and has a structure as follows:               admin.php     index.php     scrape.php     simple_html_dom.php      index.php looks like this:               function test_admin() {           include( plugin_dir_path(__FILE__) . '/admin.php' );       }      Which imports admin.php which looks like this:               <?php include(plugin_dir_path(__FILE__).'scrape.php'); ?>      Which imports scrape.php which looks like this:               <?php     # don't forget the library     include(plugin_dir_path(__FILE__).'simple_html_dom.php');          # this is the global array we fill with article information     $articles = array();          # passing in the first page to parse, it will crawl to the end     # on its own     getArticles('http://wordpress.stackexchange.com/');          function getArticles($page) {     global $urls, $articles, $descriptions;          $html = new simple_html_dom();     $html->load_file($page);          $items = $html->find('div[class=summary]');          foreach($items as $post) {         # remember comments count as nodes              $articles[] = array($post->children(0)->plaintext, // Title                             $post->find('a',0)->href); // URL     }          // print_r($articles);   <--- WORKS, contains full contents of parsed page!          # lets see if there's a next page     if($next = $html->find('a[class=nextpostslink]', 0)) {         $URL = $next->href;         echo "going on to $URL <<<\n";         # memory leak clean up         $html->clear();         unset($html);              getArticles($URL);     }          $html->clear();     print_r($articles) <--- WORKS, array is full of parsed info!     }     print_r($articles) <--- DOESN'T WORK, array is magically empty!     ?>          <?php      foreach($articles as $item) {     echo '$item[0]';     echo '
';     }     ?>      My problem is that while the plugin does appear to include the parser's php file (evidenced by print_r($articles) containing the parsed page!), it doesn't seem to be able to loop through the array. So, here is the output of my array:               Array ( [0] => Array ( [0] => +100 [1] => /questions/81544/using-plural-only-translation-of-register-post-status-in-plugin ) [1] => Array ( [0] => Check if page/post has any anchors that link to an image jpg/gif/png [1] => /questions/53585/check-if-page-post-has-any-anchors-that-link-to-an-image-jpg-gif-png ) [2] => Array ( [0] => Can this be done? Create 50x50 thumbnails of all existing featured images? [1] => /questions/82246/can-this-be-done-create-50x50-thumbnails-of-all-existing-featured-images ) [3] => Array ( [0] => Creating plugin using simple_html_dom parser? [1] => /questions/82096/creating-plugin-using-simple-html-dom-parser ) [4] => Array ( [0] => Warning/Error in Admin Panel while developing theme [1] => /questions/82245/warning-error-in-admin-panel-while-developing-theme ) [5] => Array ( [0] => Chose gallery display type [1] => /questions/82244/chose-gallery-display-type ) [6] => Array ( [0] => Why the JavaScript code is ignored from wp editor? [1] => /questions/33539/why-the-javascript-code-is-ignored-from-wp-editor ) [7] => Array ( [0] => How to list only child categories? [1] => /questions/82178/how-to-list-only-child-categories ) [8] => Array ( [0] => How to get the post_status in javascript on post admin page? [1] => /questions/82226/how-to-get-the-post-status-in-javascript-on-post-admin-page ) [9] => Array ( [0] => WP_Query orderby breaks when using AJAX? [1] => /questions/82092/wp-query-orderby-breaks-when-using-ajax ) [10] => Array ( [0] => Wordpress on Ubuntu 12.10: permalinks problem [1] => /questions/82225/wordpress-on-ubuntu-12-10-permalinks-problem ) [11] => Array ( [0] => Filtering taxonomies to a single post [1] => /questions/82240/filtering-taxonomies-to-a-single-post ) [12] => Array ( [0] => Display Parent Category of a Post belonging only to Subcategory [1] => /questions/58496/display-parent-category-of-a-post-belonging-only-to-subcategory ) [13] => Array ( [0] => Make display name unique [1] => /questions/82239/make-display-name-unique ) [14] => Array ( [0] => Send AJAX response from a non jQuery function [1] => /questions/82238/send-ajax-response-from-a-non-jquery-function ) [15] => Array ( [0] => Sorting by 2 Custom Fields + Post Title [1] => /questions/32175/sorting-by-2-custom-fields-post-title ) [16] => Array ( [0] => How to show one page with two different templates [1] => /questions/82223/how-to-show-one-page-with-two-different-templates ) [17] => Array ( [0] => flat category urls but retain heirchy? [1] => /questions/82236/flat-category-urls-but-retain-heirchy ) [18] => Array ( [0] => How do I get rid of “category” from my URL structure? [1] => /questions/30128/how-do-i-get-rid-of-category-from-my-url-structure ) [19] => Array ( [0] => Are the wordpress Core css styles really all nessasary? [1] => /questions/82228/are-the-wordpress-core-css-styles-really-all-nessasary ) [20] => Array ( [0] => Cannot access dashboard after upgrading to 3.5 [1] => /questions/76447/cannot-access-dashboard-after-upgrading-to-3-5 ) [21] => Array ( [0] => $wpdb error (Call to a member function insert() on a non-object) [1] => /questions/82229/wpdb-error-call-to-a-member-function-insert-on-a-non-object ) [22] => Array ( [0] => Registering tags taxonomy for a custom post type [1] => /questions/82217/registering-tags-taxonomy-for-a-custom-post-type ) [23] => Array ( [0] => register_post_type name character limit [1] => /questions/82227/register-post-type-name-character-limit ) [24] => Array ( [0] => IP location based country language of wordpress site [1] => /questions/78023/ip-location-based-country-language-of-wordpress-site ) [25] => Array ( [0] => Include Post Format in permalink [1] => /questions/70627/include-post-format-in-permalink ) [26] => Array ( [0] => How to detect first visit of a user? [1] => /questions/82211/how-to-detect-first-visit-of-a-user ) [27] => Array ( [0] => Repositioning 'Reply' Link in Comments [1] => /questions/82218/repositioning-reply-link-in-comments ) [28] => Array ( [0] => How do I approach removing menu items on the fly based on settings in my plugin? [1] => /questions/82180/how-do-i-approach-removing-menu-items-on-the-fly-based-on-settings-in-my-plugin ) [29] => Array ( [0] => Custom meta boxes text field unique id [1] => /questions/82222/custom-meta-boxes-text-field-unique-id ) [30] => Array ( [0] => Using Disqus, how to stop storing comments in wp database? [1] => /questions/58417/using-disqus-how-to-stop-storing-comments-in-wp-database ) [31] => Array ( [0] => How can I Add a variable PHP in the Menu Nav [1] => /questions/82194/how-can-i-add-a-variable-php-in-the-menu-nav ) [32] => Array ( [0] => Having a lot of difficulty getting add_editor_style() to load into source code [1] => /questions/60092/having-a-lot-of-difficulty-getting-add-editor-style-to-load-into-source-code ) [33] => Array ( [0] => How to custom change author base without $this->front? [1] => /questions/82004/how-to-custom-change-author-base-without-this-front ) [34] => Array ( [0] => Rename image uploads with width in filename [1] => /questions/82193/rename-image-uploads-with-width-in-filename ) [35] => Array ( [0] => Get a post's ID [1] => /questions/82208/get-a-posts-id ) [36] => Array ( [0] => Apply custom names for generic custom taxonomy name? [1] => /questions/82184/apply-custom-names-for-generic-custom-taxonomy-name ) [37] => Array ( [0] => Get post meta in enqueued js file [1] => /questions/82209/get-post-meta-in-enqueued-js-file ) [38] => Array ( [0] => How do I only load a plugin js on it's settings pages? [1] => /questions/82032/how-do-i-only-load-a-plugin-js-on-its-settings-pages ) [39] => Array ( [0] => remove post and categories/tags count from right now dashboard widget [1] => /questions/82132/remove-post-and-categories-tags-count-from-right-now-dashboard-widget ) [40] => Array ( [0] => Styling Contact Form 7 fields [1] => /questions/82207/styling-contact-form-7-fields ) [41] => Array ( [0] => Woocommerce: Changing catalog image sizes [1] => /questions/82197/woocommerce-changing-catalog-image-sizes ) [42] => Array ( [0] => Tracing the life of a query [1] => /questions/82183/tracing-the-life-of-a-query ) [43] => Array ( [0] => Custom WP_Query with complex 'post_status' argument [1] => /questions/82200/custom-wp-query-with-complex-post-status-argument ) [44] => Array ( [0] => Get a single post by a unique meta value [1] => /questions/82203/get-a-single-post-by-a-unique-meta-value ) [45] => Array ( [0] => 2 item in a same menu pointing to 1 page [1] => /questions/46962/2-item-in-a-same-menu-pointing-to-1-page ) [46] => Array ( [0] => Modify Notification Message When Profile Updated [1] => /questions/37358/modify-notification-message-when-profile-updated ) [47] => Array ( [0] => Change wordpress meta tag description using WP functions [1] => /questions/82196/change-wordpress-meta-tag-description-using-wp-functions ) )      In short: - simple_html_dom is in fact being included (tested with breakpoints) - $articles array does contain the parsed page (evidence above) BUT - $articles seems to empty itself when called from outside the getArticles() function. Is anyone willing to help find out why I am having this problem?


How do I get the content of a custom instance of WP_Query?

I've taken a very minimalistic loop, and tried to modify it, so that I can use more then one loop on one page. The minimalistic loop works fine and gets the content. But my modification to allow it to be re-used fails. This is the working loop:               <?php          if (have_posts()) :       ?>               <?php while (have_posts()) : the_post(); ?>         <?php the_content(); ?>      <?php endwhile; ?>      All good so far. That actually works. But if I want to have more then one loop on a page, I'm forced to work with WP_Query. So, I modify my loop thus:               <?php          $my_query = new WP_Query() ;          if ($my_query->have_posts()) :       ?>               <?php while ($my_query->have_posts()) : $my_query->the_post(); ?>         <?php $my_query->the_content(); ?>      <?php endwhile; ?>      But now I get nothing back at all. I don't get any errors, and php after that loop continues to execute. But I'm not getting any content. Where am I going wrong? How do I actually get the content?


Is it possible to create an empty page template and build it choosing between custom components?

I'm quite new to WordPress development and i didn't find much online about this topic (maybe i'm not searching with the right WordPress terminology). I'd like to know if it's possible to have an empty page template (no main content, only header and footer) and fill it choosing between some components For example, i have a block with a video, a block with an image and text, a block with links etc.. with an html like this:

      in the back end i would like to be able to create the page, choose which components to add and drag and drop to change the order. every components content will be different from page to page. can you tell me how to achieve this, maybe with plugins or widgets, or give some suggestions on where to find some clear documentation? thanks


WP_Query orderby breaks when using AJAX?

I'm running in to a bit of a problem. I have a function called `get_press()`, it retrieves newest press items. It is inside of a plugin:               class EWPress {         function __construct()         {             load_plugin_textdomain( 'ew', flase, dirname( plugin_basename( __FILE__ ) ) . '/lang' );                  add_action( 'wp_enqueue_scripts', array( &$this, 'register_plugin_scripts' ) );                  // Add JS var ajaxurl to global namespace             add_action( 'wp_head', array( &$this, 'add_ajax_library' ) );                  add_action( 'wp_ajax_get_press', array( &$this, 'get_press' ) );             add_action( 'wp_ajax_nopriv_get_press', array( &$this, 'get_press' ) );              }              public function get_press()         {             $args = array(                 'status' => 'publish',                 'post_type' => 'press',                 'orderby' => 'meta_value',                 'meta_key' => 'press_date',                 'order' => 'DESC',                 'posts_per_page' => 2             );                  $query = new WP_Query($args);                 return($query->posts);                 //echo json_encode($query->posts);                 //die();         }     }      If I call this function directly in a template file via: `echo EWPress::get_press()` the output is completely fine:               Array     (         [0] => WP_Post Object             (                 [ID] => 229                 [post_author] => 1                 [post_date] => 2013-01-18 00:29:58                 [post_date_gmt] => 2013-01-18 00:29:58                 [post_content] =>                  [post_title] => Rundown                 [post_excerpt] =>                  [post_status] => publish                 [comment_status] => closed                 [ping_status] => closed                 [post_password] =>                  [post_name] => rundown                 [to_ping] =>                  [pinged] =>                  [post_modified] => 2013-01-18 00:29:58                 [post_modified_gmt] => 2013-01-18 00:29:58                 [post_content_filtered] =>                  [post_parent] => 0                 [guid] => http://site.com/?post_type=press&p=229                 [menu_order] => 0                 [post_type] => press                 [post_mime_type] =>                  [comment_count] => 0                 [filter] => raw             )              [1] => WP_Post Object             (                 [ID] => 231                 [post_author] => 1                 [post_date] => 2013-01-18 00:44:35                 [post_date_gmt] => 2013-01-18 00:44:35                 [post_content] =>                  [post_title] => Clean Plates                 [post_excerpt] =>                  [post_status] => publish                 [comment_status] => closed                 [ping_status] => closed                 [post_password] =>                  [post_name] => clean-plates                 [to_ping] =>                  [pinged] =>                  [post_modified] => 2013-01-18 00:44:35                 [post_modified_gmt] => 2013-01-18 00:44:35                 [post_content_filtered] =>                  [post_parent] => 0                 [guid] => http://site.com/?post_type=press&p=231                 [menu_order] => 0                 [post_type] => press                 [post_mime_type] =>                  [comment_count] => 0                 [filter] => raw             )          )      In order to make an AJAX request, I:   * comment out the `echo EWPress::get_press()` on the template level   * comment out the `return $query->posts` in the `get_press()` function   * un-comment the `echo json_encode($query->posts)`   * un-comment the `die();` However, when I make the AJAX request to the SAME function the returned data is different (namely it is ignoring `order = 'ASC'` or `'DESC`). AJAX Function:               (function($) {         $(document).ready(function(){             $.ajax({                 url: ajaxurl,                 type: 'POST',                 dataType: 'json',                 data: {action: 'get_press'},                 complete: function(xhr, textStatus) {                     //                 },                 success: function(data, textStatus, xhr) {                     console.log(data);                 },                 error: function(xhr, textStatus, errorThrown) {                 //called when there is an error                 }             });         });     })(jQuery);      The console.log:               [Object, Object]     0: Object         ID: 234         comment_count: "0"         comment_status: "closed"         filter: "raw"         guid: "http://site.com/?post_type=press&p=234"         menu_order: 0         ping_status: "closed"         pinged: ""         post_author: "1"         post_content: ""         post_content_filtered: ""         post_date: "2013-01-18 02:33:41"         post_date_gmt: "2013-01-18 02:33:41"         post_excerpt: ""         post_mime_type: ""         post_modified: "2013-01-18 02:33:41"         post_modified_gmt: "2013-01-18 02:33:41"         post_name: "eater"         post_parent: 0         post_password: ""         post_status: "publish"         post_title: "Eater"         post_type: "press"         to_ping: ""         __proto__: Object     1: Object         ID: 231         comment_count: "0"         comment_status: "closed"         filter: "raw"         guid: "http://site.com/?post_type=press&p=231"         menu_order: 0         ping_status: "closed"         pinged: ""         post_author: "1"         post_content: ""         post_content_filtered: ""         post_date: "2013-01-18 00:44:35"         post_date_gmt: "2013-01-18 00:44:35"         post_excerpt: ""         post_mime_type: ""         post_modified: "2013-01-18 00:44:35"         post_modified_gmt: "2013-01-18 00:44:35"         post_name: "clean-plates"         post_parent: 0         post_password: ""         post_status: "publish"         post_title: "Clean Plates"         post_type: "press"         to_ping: ""         __proto__: Object     length: 2     __proto__: Array[0]      Does anyone know why this would be happening?


JSON Feed on my wordpress Blog

I have just installed 2 plugins for JSON feed for my blog as I need to develop an Android Application for the same. Plugins used : 1.) http://wordpress.org/plugins/feed-json/ 2.) /plugins/json-rest-api/ The first one is at url : http://droidacid.com/feed/json - But it is not generating proper JSON for me... I'm not getting any JSONObject or anything so not able to parse it. In second one **/wp-json/posts** I'm getting some date time issues. Can anyone help me with the same as I need anyone of them to work for parsing. Thanks Note : As I dont have 10 rep so was not able to post full links.


Problems with custom taxonomies

Let's cut right to the chase: I have two custom post types: **interviews** and **people**. They both have custom taxonomy **names**. In interviews there is a video interview with one particular person along with the transcript of the video. In people, there is a short biography and a photo of that person. On my home page I want to display randomly picked interview: title, short excerpt of the video interview transcript - and I need a photo of that person. Which I need to pull from the custom post type for that person which is **people** custom post type. The way I figure it out is that I need a query within a query. First is to pick a random interview and then to somehow find the **people** post with the same **names** term as that particular random interview. Can someone help me with this? @toscho ok, so this is my code with post 2 post plugin:               <?php query_posts(             array (                 'post_type' => 'interviews',                 'posts_per_page' => 1,                 'orderby' => 'rand',                 )             );         while ( have_posts() ) : the_post();?>
<?php the_title(); ?>

<?php the_content(); ?>
              <?php         // Find connected pages         $connected = new WP_Query( array(             'post_type' => 'people',             'connected_from' => get_queried_object_id(),             )         );         // Display connected pages         while ( $connected->have_posts() ) : $connected->the_post();?>
Person in this interview: <?php the_title();?>
         <?php endwhile;         // Prevent weirdness         wp_reset_postdata();?>              <?php endwhile; wp_reset_query();?>      It still doesn't work. It displays all the peoples' names, no matter which one is connected to that interview


category link not working for a specific slug, works for others

I have setup several categories and set the permalinks to `/%category%/%postname%.html` with a category base of `.` to remove "category" from the url. All categories are working except for one with the slug music. It returns a 404 (I turned of guessing a target for automatic forwarding). The strange thing is that if I rename the slug (to anything, "tmusic" works for example, so does "musict"), the link works. If I rename it back to "music" it gives 404 again. Unfortunately renaming is not an option. Default permalinkstructure also works, but is also not an option. I also tried renaming name and slug of that category and creating a new category with the slug "music" this one now also gives a 404. So the problem seems to be specific to /music.               get_category_by_slug("music")      gives               object(stdClass)#224 (16) { ["term_id"]=> &int(4) ["name"]=> &string(5) "Music"      ["slug"]=> &string(5) "music" ["term_group"]=> int(0) ["term_taxonomy_id"]=> int(4)      ["taxonomy"]=> string(8) "category" ["description"]=> &string(0) ""      ["parent"]=> &int(0) ["count"]=> &int(552) ["filter"]=> string(3) "raw" ["cat_ID"]=> &int(4)      ["category_count"]=> &int(552) ["category_description"]=> &string(0) "" ["cat_name"]=> &string(5) "Music"      ["category_nicename"]=> &string(5) "music" ["category_parent"]=> &int(0) }      All of this should rule out any id or database mess. The contents of my .htaccess are:               # BEGIN WordPress     <IfModule mod_rewrite.c>     RewriteEngine On     RewriteBase /wordpress/     RewriteRule ^index\.php$ - [L]     RewriteCond %{REQUEST_FILENAME} !-f     RewriteCond %{REQUEST_FILENAME} !-d     RewriteRule . /wordpress/index.php [L]     </IfModule>          # END WordPress      There is another .htaccess in a parent folder of wordpress, but I renamed it to make sure that one doesn't cause problems. Still 404. Any ideas on where/what I could look at? Anything I could do to find the source of that error or narrow down possible sources? Whats the best chance to track down what the url is actually resolved to? Are the permalinks cached somewhere? I imported some posts with a database script and changed id's of categories. The only installed plugin is Contact Form 7.


Unwanted media library URLs in posts?

When doing a bit of Google searching for content on our blog, I noticed to my shock and horror that individual images from the Media Library are somehow generating their own URLs that Google is somehow finding and indexing! For example this page:   http://blog.stackoverflow.com/2008/08/special-development-team-podcast/ Contains this image:   http://blog.stackoverflow.com/wp-content/uploads/bio-jarrod-dixon.jpg Which is fine, but somehow this image is also exposed as its own URL and "post":   http://blog.stackoverflow.com/2008/08/special-development-team-podcast/bio- jarrod-dixon/ This is _extremely_ unwanted! I checked the Media settings in WordPress and browsed around the Media Library but I can't figure out a way to disable this behavior. Any ideas?


A better way to include localized labels in Wordpress plugins

is there a better way to include labels to be localized in Wordpress plugins and themes? My current setup involves calling the method below to get the labels:                  public function plug_get_labels(){                $labels = array(               'details' => __( 'Details', 'plug' ),               'specs' => __( 'Specifications', 'plug' ),           );                return $labels;         }      But for widgets for example I feel like it would be pointless to call the `plug_get_labels` method just to supply labels which are really part of the widget:               public function __construct() {              parent::__construct(             'plug_widget', __('Plug Widget', 'plug'),             array( 'description' => __( 'A widget for displaying something', 'plug' ) )         );          }      So what I'm doing is just using the `plug_get_labels` method to supply labels for AJAX related stuff so when I only use it when I need a label to load dynamically. But my problem is that someone senior in my team said that the code and labels should be separate from each other. That I have to load the label from somewhere else so as to separate it from the code. So the solution that I had in mind was to put all the labels in a JSON file then inside the `plug_get_labels` method I read from that file, convert it to an array, then loop through it to supply the text domain for each label:               public function plug_get_labels(){       $file = file_get_contents(WP_CONTENT_DIR . '/plug-labels.json');       $labels = json_decode($file, true);            $new_labels = array();       foreach($labels as $key => $label){         $new_labels[$key] = __($label, 'plug');       }            return $new_labels;     }      I can only imagine that the senior developer in this case would also want to read from the file for the labels on every widget and theme that the plugin integrates with just so the labels will be separated from the code. Is this a good idea? It seems like other Wordpress plugins also directly embed their labels on their widgets and code. If I implement this would it affect the performance? Can you suggest any other options that I have so I can separate the code from the labels? Thanks in advance!


how to print the content of pages inside the front end area

i'm new to wordpress and i'm trying to create a website. i need display the content of the pages when corresponding menu items are clicked. my page.php contain               <?php while ( have_posts() ) : the_post();                            $page_data= $post->ID;                           if($page_data=='116')                           {                           ?>
WELCOME TO THE CLINIC!!
                          <?php                                 }                          else{                               ?>
<?php the_title(); ?>
                           <?php                         the_content();                               }                           endwhile; ?>      but my content is not displaying. title is showing properly. what is the mistake in the code? please help me.


WooCommerce Coupon has wrong calculation

I want to add a 30% cart discount coupon to my WooCommerce site. However, the calculation doesn't include the shipping rate Here is my situation: Subtotal: $25 Shipping: $10 Taxes: $3.25 Total: $38.25 Based on this, 30% of $38.25 would be $11.475, which should bring my total to $26.77 but WooCommerce calculates the discount amount without the shipping charges so it comes out to to $8.48. My questions is, how do I get it to calculate the discount amount on the shipping charges as well? ![Cart Totals](http://i.stack.imgur.com/GX4jZ.png) ![Coupon Set-up](http://i.stack.imgur.com/QCuxt.png)


Comments does not work?

I have a big problem: The comments on my theme does not work. I see only the following PHP errors:               Notice: Trying to get property of non-object in /var/www/hosts/dev.example.com/www/wp-includes/comment-template.php on line 209 Notice: Trying to get property of non-object in /var/www/hosts/dev.example.com/www/wp-includes/comment-template.php on line 209 Anonymous schreibt:     Notice: Trying to get property of non-object in /var/www/hosts/dev.example.com/www/wp-includes/comment-template.php on line 600     Notice: Trying to get property of non-object in /var/www/hosts/dev.example.com/www/wp-includes/comment-template.php on line 375 Notice: Trying to get property of non-object in /var/www/hosts/dev.example.com/www/wp-includes/comment-template.php on line 631 Uhr      what can i do?


How to manipulate attributes of url-less dropdown item in a the custom wordpress menu?

I need to change the color of some custom link elements in dropdown of my wordpress custom menu here. There 3 items in my dropdown that dont have any url associated with them:   * Air Duct   * Chimney   * Dryer Vent They will be just the headers for other dropdown items below them. I need to be able to change their attributes such color, font-family and size, etc. I was trying to create menu-item-type-custom and menu-item-object-custom and even menu-item-#### classes, but it didn't do it... :( Please help!


Using Different nav_menu_css_class for different nav_walkers

On my theme I have to different nav_walkers, I'd like to be able to call two different nav_menu_css_class-es for each menu alas, they appear to apply globally. Here's what I have               function onpage_nav_menu_css_class($classes, $item) {         $slug = sanitize_title($item->title);         $classes = preg_replace('/(current(-menu-|[-_]page[-_])(item))/', 'active', $classes);         $classes = preg_replace('/(current(-menu-|[-_]page[-_])(ancestor|parent))/', '', $classes);         $classes = preg_replace('/^((menu|page)[-_\w+]+)+/', '', $classes);              $classes[] = 'menu-' . $slug;              $classes = array_unique($classes);              return array_filter($classes, 'is_element_empty');     }     add_filter('nav_menu_css_class', 'onpage_nav_menu_css_class', 1, 2);     add_filter('nav_menu_item_id', '__return_null');