How to create a custom sort for WordPress categories

I have this problem that I am encountering. I am trying to sort my categories to display in the order that I want them to. I have read the WordPress documentation on all of the sort options. However, there is no inclination of how to choose the categories and make them flow the way I want. This is what the Codex presents:   > **orderby** (string) Sort categories alphabetically or by unique category > ID. The default is sort by Category ID. Valid values:   >  \- id   >  \- name - default   >  \- slug   >  \- count   >  \- term_group > > **order** (string) Sort order for categories (either ascending or > descending). The default is ascending. Valid values:   >  \- asc - default   >  \- desc However, like I said, this does not help me because I need them to display in the order I choose. Here is the code I am implementing at the moment. Which is in the order that I want them to display.               <?php     $args = array(     'orderby' => 'ID',     'order' => 'ASC',     'include' => '5,6,7,8,29,9,10,11,12,13,14,15,16'     );     $categories = get_categories($args);     foreach($categories as $category) {     echo '
term_id ) . '" title="' . sprintf(     __( "View all posts in %s" ), $category->name ) . '" ' . '>' . $category->name . '' . ' ' . '(' . $category->count . ')' . '
 ';     }     ?>


What Features would you Most Like to See Added to WordPress?

I'm creating a **community wiki** to ask the following question:   * _**What features would you most like to see added to WordPress?_** ### This Question Implies a Few Things:   * It should surface the **_features enthusiasts want most_** , not just drive bys from people who can't be bothered to know that the _"P"_ needs to be capitalized ( _inside joke. Of course..._ )   * **Favor features that benefit the more advanced users** and especially the **theme and/or plugin developers**.   * Also **favor APIs** and **other enablers** vs. just yet another new UI widget. Examples of this might be a Backup API that many developers could build on top of, or a Twitter API that themers could build on.   * Focus on **only the few things you really want most** , not everything you can think of. Don't let this be a dumping ground for everything you can think of or have ever thought of. When adding a wanted feature ask yourself if you'd prefer to have it or your _top 3_ features; if not maybe you shouldn't add it.    * **Give some great details** including, if appropriate: A. **Wireframes** (maybe using Balsamiq?), B. **API Interfaces** C. **Suggested Hooks** D. **URL Structures** E. And more. F. Even **Source code**   * **Significant Features Only** , please. Don't add something like _"I want the admin console to be purple"_ or _"I really want the admin menu to be on the right."_   * _**Avoid things that onlyAutomattic can control_** like things on WordPress.com!! (not that enthusiasts would care, but...) Better to stick with the things that contributors to an open-source project can affect like code and collaboration. ### Rules of This Wiki   * **Do not duplicate suggestions**. It's okay if you do but a moderator may down-vote it and/or delete if possible. In the case a significant duplicate exists but with some good additions we should edit the answer that's duplicating it to include the additions.   * **More rules will come as needed** , as we realize they are needed. If you have concerns about this related to _WordPress Ideas_, _Core Team buy- in_ or _relationship with WordPress/Automattic_ , please see the comments in one of my own " _answers_ " posted to this question, below. My hope is that this effort **will be entirely positive** and that everyone including Automattic and the WordPress core team will get huge value from its outcome.


The_excerpt() doesn't parse <!--more--> - how to change that?

I'm using `the_excerpt();` in blog.php file (post listing page) and it doesn't recognize `<!--more-->` if "Excerpt" field is empty and it grabs the beginning of the content as excerpt. This issue is described here: http://codex.wordpress.org/Template_Tags/the_excerpt but I don't know why did WordPress disable `<!--more-->` for the excerpt (if excerpt field is empty and content is used as excerpt)? Can i enable that back?


How to paginate posts correctly that belong to a particular category and are random ordered

I was interested to read the answer to this question on how to paginate posts correctly that are random ordered. Is it possible to paginate posts correctly that are random ordered? My goal is to randomly order posts that appear in a certain category on my site, in this case artists. Here is the code for the loop. In my case I use the wp_pagenavi plugin
         <?php         $paged = (get_query_var('paged')) ? get_query_var('paged') : 1;         query_posts('cat=6&orderby=rand&posts_per_page='.get_option('posts_per_page').'&paged=. $paged);?>         <?php wp_pagenavi(); ?>         <?php if (have_posts()) : while (have_posts()) : the_post(); ?>         <div <?php post_class() ?> id="post-<?php the_ID(); ?>">
<a href="<?php the_permalink() ?>"><?php the_title(); ?>
          <?php //include (TEMPLATEPATH . '/inc/meta.php' ); ?>
              <?php             global $more; $more = 0;             the_post_thumbnail('medium');             the_content("Continue Reading",FALSE);               ?>

         <?php endwhile; ?>         <?php //include (TEMPLATEPATH . '/inc/nav.php' ); ?>         <?php wp_pagenavi(); ?>         <?php else : ?>
Not Found
         <?php endif; ?>         <?php wp_reset_query(); ?>      I used the filter to modify the ORDER BY statement of WP_query from the link above               session_start();          add_filter('posts_orderby', 'edit_posts_orderby');          function edit_posts_orderby($orderby_statement) {          $seed = $_SESSION['seed'];     if (empty($seed)) {       $seed = rand();       $_SESSION['seed'] = $seed;     }          $orderby_statement = 'RAND('.$seed.')';     return $orderby_statement;     }      and this works fine when the artists page is viewed. As explained a random number is generated on the first page load then this is stored in a SESSION variable and used as the $seed for further paginated requests. This ensures that any potential for repeated artists posts is eliminated and a fresh set of artists posts is returned when the user clicks on page 2 or 3 of the pagination However posts in different categories including events and news also get treated randomly which isn't what is desired. I'd like these to be the latest first. I tried adding orderly = DESC but this makes no difference to that loop. The function from the previous post appears to override it. Is there a method of targeting just the artist category to be random within the seed function and to leave other loops alone. Thanks


How do I get the theme URL in PHP?

I need to get the URL of my theme directory to reference an image in the theme's image/headers directory. How is this done in PHP?


Is there a plugin-log plugin?

Is there a plugin that logs my usage of plugins on the blog? (when I downloaded a new plugin. When I activated/deactivated it and so on) ?


Rewrite loading custom template file but is_home() returns true, and there's no 404

I want to create some custom pages for my theme that don't appear in the Page listing in wp-admin. I have the following class which intercepts the url.               class jtvRewrite {          var $path = '';          function __construct($path) {              $this->path = $path;              register_activation_hook( __file__, array($this, 'activate') );              // Write rules -> Add query vars -> Recalculate rewrite rules         add_filter('rewrite_rules_array', array($this, 'create_rewrite_rules'));         add_filter('query_vars',array($this, 'add_query_vars'));              add_filter('admin_init', array($this, 'flush_rewrite_rules'));         add_action('template_redirect', array($this, 'template_redirect_intercept') );     }          function activate() {         global $wp_rewrite;         $this->flush_rewrite_rules();     }          function create_rewrite_rules($rules) {         global $wp_rewrite;         $newRule = array($this->path . '/(.+)' => 'index.php?' . $this->path . '='.$wp_rewrite->preg_index(1));         $newRules = $newRule + $rules;         return $newRules;     }          function add_query_vars($qvars) {         $qvars[] = $this->path;         return $qvars;     }          function flush_rewrite_rules() {         global $wp_rewrite;         $wp_rewrite->flush_rules();     }          function template_redirect_intercept() {         global $wp_query;         if ($wp_query->get($this->path)) {             $this->output($wp_query->get($this->path));             exit;         }     }          function output( $output ) {         global $wp_query;              if (file_exists( TEMPLATEPATH . '/' . $this->path . '/' . $output . '.php' )) {             include( TEMPLATEPATH . '/' . $this->path . '/' . $output . '.php' );             exit;         } else {             return $wp_query->is_404();         }     }          }     $member = new jtvRewrite('member');      However, if I run `is_home()` on this page it returns true. That makes sense since behind the rewrite is `/index.php?member=profile`. Is there something I can throw in there that makes it not home? The reason being I have another functions which adds something to the front page on `is_home()`. Secondly, I've got `return $wp_query->is_404();` in there if the theme file is not available (i.e. the page doesn't exist) but on a non existent url just a blank page is returned (WP_DEBUG true return nothing). Any idea how to send the 404 correctly? _Edit with solution:_ Otto suggested adding `$wp_query->is_home = false` to `template_redirect_intercept()` \- which worked a treat. And then I've made the `output` function check if a function exists based upon the path that was originally requested. If that function exists (see below) it calls it. That function provides the redirect. If it doesn't the 404 is set. This way I can use the `class jtvRewrite` as much as I like for each new template file I add.               function template_redirect_intercept() {         global $wp_query;         if ($wp_query->get($this->path)) {             $wp_query->is_home = false; // set is_home parameter to false                  if (! $this->output($wp_query->get($this->path)))                 $wp_query->set_404();         }     }          function output( $output ) {         global $wp_query;              $function = 'jtv_rewrite_action_' . $this->path . '_' . $output;              if (function_exists($function)) {             $function();             exit;         } else {             return false;         }     }      Then I can use the following function to fire off to the correct template file:               $member = new jtvRewrite('member');          /**      * Provide the theme template file      */     function jtv_rewrite_action_member_profile() {          include( TEMPLATEPATH . '/member/profile.php' );          }


Category RSS feed doesn't show category name

I'm pulling an RSS feed from a custom post type "blogs" under a category of "workers-compensation". Here is the URL: http://www.company.com/category/workers-compensation/feed/?post_type=blog The feed works fine, but I'm unable to pull the category name so that feed readers can display the title similar to this "Company >> Worker's Compensation", but I'm stuck with "Company >> " (where nothing gets pulled in for the second part). I'll admit I'm a pretty big RSS nub, so any and all help here would be greatly appreciated. Thanks!


Jetpack + VideoPress + Self Hosted Blog = Domain permission issue (1 post)

I recently subscribed for VideoPress for $60 a month. I had to sign into my WordPress account which is linked to my jetpack for my self hosted WordPress site. When I uploaded a video and embedded it on my post I got this message: > VideoPress Error > > http://www.MYSITEHERE.com is not an allowed embed site. > > Publisher limits playback of video embeds. Note: I removed my actual domain with "MYSITEHERE". I tried to contact Jetpack support, but they did not respond in a couple of days now, so I thought I'd try the forums as directed by the VideoPress support pages. I believe that because I had to signup for VideoPress by signing into WordPress.com it added the feature to MYSITEHERE.wordpress.com. How do I connect my self-hosted WordPress blog to VidepPress via Jetpack? Is that the problem? What am I missing? Thanks!


Problem adding 'has-children' class to wp_nav_menu

According to a number of references online, I should be able to use the following function to add the class, `has-children`, to menu items that have children under them:               function gtp_nav_menu_css_class( $css_class, $item ) {         global $wpdb;         $has_children = $wpdb->get_var("SELECT COUNT(meta_id) FROM wp_postmeta WHERE meta_key='_menu_item_menu_item_parent' AND meta_value='" . $item->ID . "'");         if ($has_children > 0) {             array_push($css_class, 'has-children');         }         return $css_class;     }     add_filter( 'nav_menu_css_class', 'gtp_nav_menu_css_class', 10, 4 );      I am using `wp_nav_menu()` in my `header.php`. However, after adding this code to `functions.php`, I am not seeing the `has-children` class being added to any menu items (when in fact there are menu items that contain children). Does anybody know what may be the culprit? Notes:   * I am using WP 3.4.1.   * I am running a Multisite setup   * Table prefix is 'wp_'   * Via debug echo statements, I can see that the function is getting executed, but not inside the conditional statement.


Adding Custom Forms

I'm looking to create a page for a wedding site that will have a form. The idea is that it is an RSVP page where a visitor will input a unique string that was on the invitation that they received and will take them to another page that will have the info (attending, how many guests, etc.), after that storing it in a database so I have a completed guest list that I can use for later purposes. I'm not very familiar with Wordpress yet, so what is the easiest way to have pages that involve forms and that the second input page would not be displayed in the navigation? I should be able to write the php and form html without too much trouble, just need a jumping off point.


Controlling the Admin panel for page templates

I want to maintain a specific layout for each page type, rather than embedding HTML into the page itself. I know there has to be a better way, For example I would like to:   * on the contact page create a style for each person   * on the about page i would like to keep the content formatted I know how to make a page-template.php but there has to be something i am missing I would think that in the admin panel there would be fields for each area. Thanks ahead of time.


Primary and secondary menus

I am trying to make each individual tab on my primary menu link to the secondary menu so that in effect each individual primary tab leads to an individual set of tabs in the secondary menu rather than it just remaining static. I hope you can help and I'm not an advanced WP user so its ok to use simple terms. ## Update I've added the code but it has shown up on my webpage and in the dashboard so I must have it wrong so I've pasted it below so you can see. I'm not sure how to find the primary slug but I think its what I've added in place of primary.               function km_dynamic_secondary_menu_reg() {         global $km_nav_menus;         $theme_location = 'nav-menus';          $locations = get_nav_menu_locations();         $menu_items = wp_get_nav_menu_items( $locations[$theme_location] );         if ( isset($menu_items) && !empty($menu_items) ) {             $km_nav_menus = array();             foreach( $menu_items as $item ) {                 if ( 'post_type' == $item->type ) {                     $post_type = ( 'page' == $item->object ) ? $item->object : 'post';                     $km_nav_menus[get_post_field( 'post_name',  $item->object_id ).'-'. $post_type] = '"'.$item->title . '" Secondary Menu';                     register_nav_menus( $km_nav_menus );                 } elseif ( 'taxonomy' == $item->type ) {                     $km_nav_menus[get_term_field( 'slug', $item->object_id, $item->object ).'-tax'] = '"'.$item->title . '" Secondary Menu';                     register_nav_menus( $km_nav_menus );                 } else {                     //Your default fallback if needed                 }                  }         }     }     add_action( 'init', 'km_dynamic_secondary_menu_reg' );


Offset a post in the loop, with using PageNavi Plug-in

I am trying to offset 1 post in my main loop, I have tried a few things Like query_posts() etc etc, and i can get the offset to work but my pagination ends up not working , I am using the PagNavi plug in , Any Help would be awesome , the Code is pretty generic , thanks again!               <?php if (have_posts()) : ?>     <?php query_posts('offset=1');?>     <?php while (have_posts()) : the_post(); ?>          //Content          <?php endwhile; else: ?>     <?php _e('Sorry, no posts matched your criteria.'); ?>     <?php endif; ?>


URL rewrites and pagination

I must say that I am a complete nooby at Wordpress custom URL rewrites. I have searched for past many days to find a clear explanation of how to determine and write correct pattern for URL rewrites. I have a custom page template that uses query var passed to it, e.g. http://example.com/pagename?user=username. In this "pagename" refers to the custom page template and "user" refers to the custom query var. I need this to be represented using the URL http://example.com/pagename/username. I also require the above to work with pagination. So http://example.com/pagename/username/page/2 should be able to represent http://example.com/pagename/page/2?user=username It would be great if someone can provide me with a working example and an explanation of how I should determine and write correct pattern for URL rewrites. Regards, John


How to dynamically save a selected option from page "Templates" selectbox?

When I select a template for a page from the "Templates" selectbox, the selected item gets “value=selected” only after I hit save draft/publish/update. `<option value='template-gallery.php' selected='selected'>Gallery</option>` How can the option receive the value “selected” without the need of save/publish/update hit button? (like on widgets page: they get saved without page refresh) Thank you!


Why is the reset password key missing in the reset password email?

Wordpress 3.2.1 - The reset password URL in the email generated by http://mysite.com/wp-login.php?action=lostpassword does not contain a valid key and so users are unable to reset their password. We do have Register Plus Redux plugin installed but the problem persists even if I disable it. Is this a known issue? Clicking the link gives the error "Sorry, that key does not appear to be valid." The link looks like this: http://mysite.com/wp-login.php?action=rp&key=&login=email%40mysite.com (they key is empty)


List Post Attachments - Remove Image Thumbnails

I'm using the following code to display a list of the posts attachments within a sidebar:
                 <?php $args = array(     'post_type' => 'attachment',     'post_parent' => $post->ID     );     $attachments = get_posts($args);     if ($attachments) {             echo '
This article has the following attachments:
';             foreach ($attachments as $attachment) {             echo '
';             the_attachment_link($attachment->ID, false);             echo '
';}             } else {              echo '
No documents attached to this article.
';     } ?>
      Most posts contain PDF's, Zip files and JPG/PNG files. The code above does list the attachments, however, when the attachment is an image it displays a thumbnail rather than just a link to the image. Can anyone advise how I can go about making sure each attachment is listed as a link? Thanks, Darren


WP_cron won't trigger my action

I'm in a dead end with a schedualed task in a wordpress plugin for a multisite. Somehow the action I added don't get triggered. The task is getting schedualed and returns a timestamp when I run wp_next_scheduled(), but the action itself doesn't go off and trigger the function. Information that might give some clues:   * It's running on a WPMU-site   * The cronjob is a part of a plugin   * I'm using OOP approach   * The things I'm importing is a custom post type. _Code Example:_               class Cronjobs     {         function Cronjobs()         {             add_action('init', array(&$this, 'add_cronjobs'));         }              function add_cronjobs()         {             add_action('update_properties_daily', array(&$this, 'do_updates'));                  if(!wp_next_scheduled('update_properties_daily') )             {                wp_schedule_event( time(), 'daily', 'update_properties_daily');             }         }              function do_updates()         {             /* Do updates */         }     }      Could really use the help of some wizes on this one, thanks! * * * ## UPDATE Solution: **Create a global function and call that from the custom action.** Apparently is there some glitch with creating custom actions while refering to an object. Since **custom actions is stored in the DB** (as far as I've understood), **the objected won't be instansiated** and therefor **can't use it's methods**. Therefor: back to basics and use a global function.


Suggestions for Developing a Flipbook Style Theme?

I'm currently working on a custom WordPress theme that will be a showcase of several different stories, "books" if you will, that contain individual chapters. I'd like to present each of the stories in a kind of flip book presentation using jQuery, AJAX or some combination thereof. Following is an example of what I'd like to do in WordPress: http://www.getfisk.com/somali_pirates At current I've got a basic theme designed with posts created for each chapter, however I'm thinking I might need to create some form of custom post type and/or fields for the flip book functionality to work. Would love any and all suggestions you guys might have on how best to go about doing this as at the moment I'm at a bit of a loss. Thanks in advance. :)


Get all posts without tags

I'm working with a tag plugin. Is there a WordPress way to get_posts or query all posts that have no tags?


Link profile page to the logged in users profile

I am new to wordpress and having troubles setting up the user profile page. I created a page 'Profile' and in the permalink option I need to have it so that it is http://mysite.com/members/"CurrentUser". I looked at this Diplay a registered user profile page but I am not able to add all those codes in the permalink. I believe I am missing something, any help is appreciated.


How to display many photo albums related to category

I am developing one project and in this project i have to display many photos albums related to each category name. **Particular.**               Photos [Custom page.Redirect to next sub-category with name {personal} ]              sub-category Personal Photos             sub-category Professional Photos             ........      I want all of content that i describe in the wireframe below. I want this for each category, and every album to be next to each other like Rome, Madrit album, etc also below this there is a field with number that describes the number of photos for each album like **Rome / 28 photos.** ![Wireframe](http://i.stack.imgur.com/6JWJM.jpg) I read many articles with multiple solutions. Some of them recommend to create this with Custom Post Types, i think that in addition i want to create a Custom Category Template. What are your opinion, how can organize all of these content and if you have any other suggestions, i would like to read. Thanks i advance.


Programmatically set featured images

Is there a way to set featured images in bulk? I have created a bunch of posts (200+) and would like to set featured images to all of them in bulk - without using the admin panel and setting the featured image for each post one by one?


Import 10,000 Users into Wordpress WITH a specific ID for each user

I have a website which has about 10,000 users. I am converting this site over to Wordpress. The new site is ready to roll, but I have to bring over all the users. There are a number of plugins available to importing users from a CSV file, and I've got the CSV file ready to go. The plugin that I'd like to use is the following: Import Users from CSV The reason I'd like to use this plugin is that it provides the option to import a CSV file containing user id's. Unfortunately, the plugin is currently designed so that if ID's are present in the CSV file, it assumes that these users already exist in your Wordpress database and you're trying to "UPDATE" those records. I'm not. I'm trying to make NEW users in the database, but with specific ID's (because these ID's are tied to another system and I don't want these losers to lose access to all of this other info as a result of an ID change from the old system to the new. It seems that the plugin above maybe be piggy-backing off of the built-in Wordpress functions for registering or updating users, so this may be the problem. How can I accomplish my goal with as little time investment as possible? BTW - I am pretty comfortable in phpmyadmin, so I don't mind doing it there, the only problem is I want to make sure that all users receive an email notifying them and providing their new password (because I can't move these over). Using the plugin, this is automatic. Without it, not to much. Thanks for any assistance.


get_theme_mod(); returns nothing

I am having trouble with my customize field in WordPress. The field shows up fine in the customize section of WP but it just does not echo out.               <p> <?php echo get_theme_mod('copyright_details'); ?> </p>      functions.php code:               function limus_customize_register( $wp_customize )     {        //copyright         $wp_customize->add_section('limus_copyright', array(             'title' => __('Copyright Details', 'limus'),             'description' => 'Add/Edit copyright information'         ));         $wp_customize->add_setting('copyright_details', array(             'default' => '© 2000-2013 Limus Design Inc. All Rights Reserved.'         ));         $wp_customize->add_control('copyright_details', array(             'label' => __('Copyright Information', 'limus'),             'section' => 'limus_copyright',             'setting' => 'copyright_details'         ));     }     add_action( 'customize_register', 'limus_customize_register' );


MySQL Database User: Which Privileges are needed?

The short installation instruction for WordPress ("5 Minutes") state that: > Create a database for WordPress on your web server, as well as a MySQL user > who has all privileges for accessing and modifying it. While setting up a new blog professionally I was wondering how that maps to what the MySQL database user privileges/permissions configuration offers me:   * **Data:** `SELECT`, `INSERT`, `UPDATE`, `DELETE`   * **Definition:** `CREATE`, `ALTER`, `DROP`   * **Extra:** `INDEX`   * **More:**     1. `LOCK TABLES`     2. `REFERENCES`     3. `CREATE TEMPORARY TABLES`     4. `CREATE VIEW`     5. `SHOW VIEW`     6. `CREATE ROUTINE`     7. `EXECUTE`     8. `ALTER ROUTINE` I'm pretty sure for the first three groups, I named them Data, Definition and Extra here. But what about the others below the **More** entry? Normally I would say, those are not needed, but I would like to get a second opinion.


Will reducing mysql permissions hinder WP function?

While installing WP, I created a mysql user to access only the relevant WP database. It's likely that not technical people will end up with access to this account, so I decided to remove DELETE and DROP privileges from this user. Was this a bad idea? Will anything in WP not function correctly because of this. Thus far, I got a couple of error messages during the install, but I looked up what they were doing, and that was precisely nothing. The DROP queries didn't match anything they would have dropped. UPDATE: It seems that my question is addressed by answers in this question: MySQL Database User: Which Privileges are needed?


Archive limit the text of the_content

here's the code for my archive page..               <?php     /*     Template Name: Archive Page     */     ?>          <?php get_header(); ?>
             <?php include'leftsidebar.php';?>
         <?php if (have_posts()) : ?>                  <?php $post = $posts[0]; // Hack. Set $post so that the_date() works. ?>                  <?php /* If this is a category archive */ if (is_category()) { ?>
Archive for the ‘<?php single_cat_title(); ?>’ Category
                  <?php /* If this is a tag archive */ } elseif( is_tag() ) { ?>
Posts Tagged ‘<?php single_tag_title(); ?>’
                  <?php /* If this is a daily archive */ } elseif (is_day()) { ?>
Archive for <?php the_time('F jS, Y'); ?>
                  <?php /* If this is a monthly archive */ } elseif (is_month()) { ?>
Archive for <?php the_time('F, Y'); ?>
                  <?php /* If this is a yearly archive */ } elseif (is_year()) { ?>
Archive for <?php the_time('Y'); ?>
                  <?php /* If this is an author archive */ } elseif (is_author()) { ?>
Author Archive
                  <?php /* If this is a paged archive */ } elseif (isset($_GET['paged']) && !empty($_GET['paged'])) { ?>
Blog Archives
                  <?php } ?>                  <?php include (TEMPLATEPATH . '/inc/nav.php' );?>
             <?php $i=0;?>                  <?php while (have_posts()) : the_post(); ?>                 <?php $i++; ?>
                 <div <?php post_class() ?>>                          <h2 id="post-<?php the_ID(); ?>"><a href="<?php the_permalink() ?>"><?php the_title(); ?>
                          <?php include (TEMPLATEPATH . '/inc/meta.php' ); ?>
                              <?php the_content();?>

                 <?php                  $Archive_Ads = array(                 'Archive Ad1',                 'Archive Ad2',                 'Archive Ad3'                 );                 if ($i % 3 === 0):                 if (function_exists('dynamic_sidebar')) :/*this is the line 69*/                 dynamic_sidebar($Archive_Ads[rand(0, 2)]);                 endif;                 endif;                 ?>                  <?php endwhile; ?>
                            <?php include (TEMPLATEPATH . '/inc/nav.php' ); ?>          <?php else : ?>
Nothing found
          <?php endif; ?>

     <?php get_footer(); ?>      Now What I want is to limit the text by 50 words without affecting the videos and images, I want my Images and Videos to be display, is it possible to do that?


Category List With Comma & Link

Trying to list the categories for post separated by a comma with link to the category archive.                               <?php                     foreach((get_the_category()) as $category) {                     if($category->name==$homecat) continue;                     $category_id = get_cat_ID( $category->cat_name );                     $category_link = get_category_link( $category_id );                     echo ''.$category->cat_name.'';                     } ?>      Thanks for any help!


Change category base based on category

How can I change the permalink based on the category? I would like to change the category base based on its category. I want the output to be like this:   1. /news/category1    2. /articles/category2   3. /articles/category3 In short, they're all just categories in one POST TYPE which is "post" but only the permalinks are different. PS. I know I can just build a CPT for this. Just trying not to do it if there's a way.


Are .MP3 files with capital letter extensions allowed in [audio] shortcode?

In WordPress 3.6, using the new `[audio]` shortcode, I can add a player for an .mp3 file like this:               [audio src="http://example.com/audio_files/test.mp3"]      However, if the .mp3 file has capital letters in the extension, it doesn't work:               [audio src="http://example.com/audio_files/test_capital.MP3"]      If I specify the format in the shortcode, it still fails, although in a different way:               [audio mp3="http://example.com/audio_files/test_capital.MP3"]      Looking at function `wp_audio_shortcode` in "wp-includes/media.php", I can see where this is happening. Is this intentional behavior for WordPress 3.6? Are there any workarounds (other than renaming the file)? Should I file a bug report? # Followup This bug has been fixed in the core for WordPress 3.7.


How to limit the number of blogs created in a WP multisite installation?

I adapted a function from @rohmann (and with the help of David Sader) to limit the number of blogs that a user can create in a Wordpress multisite installation. The function works well, but the error that it shows to the user on site registration above the fixed limit contains some more text than is set by this function. What here is wrong? This is the received error text: > You have already registered the maximum amount of 3 blogs! We suggest > adjusting the blog address below, in accordance with the following > requirements: » Only letters and numbers allowed. » Must be at least > characters. » Has to contain letters as well. This is the function:               add_filter('wpmu_validate_blog_signup','set_blog_creation_limit');          function set_blog_creation_limit( $result ) {              $blog_limit = 3;         $user_blogs_nr = 0;              $user_blogs = get_blogs_of_user($result['user']->ID);              foreach ($user_blogs as $user_blog) {             $blog_id = $user_blog->userblog_id;             $user_id_from_email = get_user_id_from_string( get_blog_option($blog_id, 'admin_email'));             if ( $result['user']->ID == $user_id_from_email )                 $user_blogs_nr++;         }              if ($user_blogs_nr == $blog_limit )             $result['errors']->add('blogname', __('You have already registered the maximum amount of ' . $user_blogs_nr . ' blogs!'));              return $result;          }


My post does not show up

I'm facing a WordPress strange behavior. One of my posts is not showing up. If I open post editor I can find the post full text and in my home page I can see an excerpt of this post. Does anybody have any idea how to fix this?


How can i disable a plugin for a mobile phone?

Is there a way I can not show something to mobile users? I have a floating social bar on my responsive theme, but it get in the middle of the content if I'm on my Android phone. I don't want to use display:none, since the JS will still load. Is there a function I can use to only show the floating bar for desktops users, and not mobile ones? Thanks in advance (:


Url redirection using htacess for my website

my website has some development issues i really need some help When someone types www.mysite.com/mysite.com/mysite.com/anypagename.php a page opens up which shows data of the original page but without pictures. this problem is occurring for all pages that are in the root directory. How can i solve this using htacess redirection? I don't know whats wrong and it is hurting my performance


Custom permalinks rules don't match and lost of query var in the process

For my theme i created custom post types (realisation, video). All is working now without the rewriting, but i have trouble when i apply rewriting. my urls are like this :               1) ?realisation=habillage-de-stands&parentid=38 // for custom post type 'realisation'     2) ?video=jardin-d-ailleurs&parentid=visite-jardin // for custom post type 'video'     3) ?video_category=institutionnel&parentid=pedagogique //for custom tag 'video_category' associated to custom post type 'video'     4) ?p=31&parentid=34 //for blog article     5) ?tag=site-web&parentid=34 //for tags      I tried in permalink               http://127.0.0.1/CONSTRUCTION/wordpress/%postname%/      and i added in functions.php               function add_query_vars($query_vars)     {         $query_vars[] = "parentid";         return $query_vars;     }     add_filter('query_vars', 'add_query_vars');          function add_parentid_rewrite()     {         add_rewrite_rule('^realisation/([^/]*)/([^/]*)', 'index.php?realisation=$matches[1]&parentid=$matches[2]', 'top');         add_rewrite_rule('^video/([^/]*)/([^/]*)', 'index.php?video=$matches[1]&parentid=$matches[2]', 'top');         add_rewrite_rule('^video_category/([^/]*)/([^/]*)', 'index.php?video_category=$matches[1]&parentid=$matches[2]', 'top');     }     add_action( 'init', 'add_parentid_rewrite' );      and i have               ?realisation=habillage-de-stands&parentid=38      becomes               realisation/habillage-de-stands/&parentid=0/      the link is working but i wish to have               realisation/habillage-de-stands/38/      also               ?video=jardin-d-ailleurs&parentid=visite-jardin      becomes               video/jardin-d-ailleurs/&parentid=visite-jardin/      instead of               video/jardin-d-ailleurs/visite-jardin      and also               ?video_category=institutionnel&parentid=pedagogique      becomes               video_category/institutionnel/&parentid=&parentid=pedagogique //width 2 &parentid= !!but the link is working      instead of               video_category/institutionnel/pedagogique      **=> what is wrong ? and why &parentid= stays in the rewrite link ?** But               ?p=31&parentid=34      becomes               article2/&parentid=0      and doesn't work => What could be done here for this ? The parentid is well taken into account when no rewrite is done (by doing a simple echo $wp_query->query_vars['parentid'];). But with the rewrite, the value is messed up! for instance :               ?p=31&parentid=34      gives me empty string with rewrite               ?realisation=habillage-de-stands&parentid=38      gives me the string '&parentid=0' Thanks in advance \--- EDIT --- if i var_dump($wp_query); in header.php, i've got in my results \- when permalinks ARE NOT rewritten :               ["query_vars"]=>       array(58) {         ["realisation"]=>         string(19) "habillage-de-stands"         ["post_type"]=>         string(11) "realisation"         ["name"]=>         string(19) "habillage-de-stands"         ["parentid"]=>         string(2) "38"     ...        }      ["query"]=>       array(4) {         ["realisation"]=>         string(19) "habillage-de-stands"         ["post_type"]=>         string(11) "realisation"         ["name"]=>         string(19) "habillage-de-stands"         ["parentid"]=>         string(2) "38"       }      when permalinks ARE rewritten :               ["query_vars"]=>     array(58) {         ["page"]=>         int(0)         ["realisation"]=>         string(31) "habillage-de-stands/&parentid=0"         ["post_type"]=>         string(11) "realisation"         ["name"]=>         string(9) "parentid0"         ["pagename"]=>         string(9) "parentid0"        ["parentid"]=>        string(11) "&parentid=0"         ...     }     ["query"]=>     array(4) {         ["realisation"]=>         string(31) "habillage-de-stands/&parentid=0"         ["post_type"]=>         string(11) "realisation"         ["name"]=>         string(31) "habillage-de-stands/&parentid=0"     }      Does anyone has a clue ?


Add postMessage to existing customizer settings

I'm trying to add postMessage to the transport of all the pre-exisiting wordpress customizer options. I don't want Site Title & Tagline etc to refresh when I change them. Is there a way to make this happen?


Get Users Post ID

I need a lil something done and I have looked over Google for and cant seem to find, not even a close solution. My site is totally user front end with wp-admin being blocked by users. When a user logs in they are taken to a "dashboard". Each person can only make one post. What i need is something to take the current logged in user and grab the post id of their post. so i can link to their edit page.


$wpdb->get_col and ORDER BY?

this is the query that returns the listing of a custom post type               $apartments = $wpdb->get_col( "                     SELECT DISTINCT( post_id )                      FROM $wpdb->postmeta                      WHERE meta_key IN( $fields_string ) AND                            post_id IN ( SELECT ID FROM $wpdb->posts                            WHERE post_type = 'tvr_apartment' AND                                  post_status = 'publish' )                      )" );      By default this returns the newest first, I want to order by random; this is how i am trying but then there are no results               $apartments = $wpdb->get_col( "                     SELECT DISTINCT( post_id )                      FROM $wpdb->postmeta                      WHERE meta_key IN( $fields_string ) AND                            post_id IN ( SELECT ID FROM $wpdb->posts                            WHERE post_type = 'tvr_apartment' AND                                  post_status = 'publish' )                      )                     ORDER BY $wpdb->postmeta.post_id rand()" );      what am i doing wrong?


Regsitration form on External page

I am trying to achieve where user can register from my another website which is in sub folder and in the same database. However both website has own tables and one is Wordpress and other is non-wordpress website. Means `www.wordpress-site.com` is my wp site and I want to place registration form where site is `www.wordpress-site.com/other-site/` Once user register it should redirect to the same/current page and not to any of wordpress pages. I would highly appreciate your help.


Get the name an the description of a link category

I have a link category with the id `$id=23;` and the slug `$slug=friends;`. I managed to read all links from that category using `get_bookmarks($id)`. Now I also want to use the name and the description ob the link category. How geht I get these values? I tried for example:               $cat = get_the_category($id);     $output .= "
Description: ".$cat[0]->category_description."
";      unfortunately this (and other things) did not work. So how can I receive the name and the description ob the link category with the id=23? Is it also possible to recieve this via the slug of the link category? I tried `get_category_by_slug($slug)`, but this always gave an empty result,...


How to Check Disk Space used by Media Library

Is there any way to find out how much of disk space has been used by Media Library? My blog's media files stored in a separate folder named "media" rather than the default "wp-content/uploads". Thanks


How can I hide Home in my menu in a specific page?

I want to how can I hide the home in the menu without setting show_home in functions.php to false, I just want to do is hide it in a specific page. How can I do this? I am using the Twenty-Eleven Theme.


Use and get custom user metadata

I wanted to check if a post custom field matches the logged user's custom metadata. If it does then list only posts that match. I think that's possible.


conditionally display text - on nextGEN gallery pages only

I'd like to use functions.php to display some text via a hook on pages displaying a nextGEN gallery. I can't find any documentation for nextGEN code. something like:               // add note to nextgen gallery pages     add_action( 'woo_post_inside_after', 'gallery_note',30 );     function gallery_note () {          if( page_is('nextgen-gallery') ):               echo 'here is a lovely note';         endif;       }      I know I could add the note via the nextgen template but this way is more elegant / easier to maintain ;)


About to migrate site to new domain

I've been developing a WordPress site for a client on my own hosting and domain and within the next week I'll be moving it to theirs. I have a number of questions regarding this as this is my first time doing something like this.   1. Once i've moved all the files and uploaded the database I plan to use the Search & Replace plugin. So say currently the site is at mywpsite.com and i'm moving it to newsite.com. Will simply Search & Replacing mywpsite.com with newsite.com change all links in the database as well as links to posts, pages, images etc. and have the site functioning correctly?   2. I've heard about deleting a licence file to make it harder to compromise the site security. Where exactly is this file and will the file be recreated every time WordPress is updated?   3. While i'm uploading and fixing the new site I would like to take their current site - newsite.com and move it to subdomain.newsite.com and redirect to there. How would i go about doing this? I'm sure these questions are simple enough but, as I said, this is my first time doing something like this and I'd appreciate any help with it. Thanks.


Wordpress upload folder on separate server

I separate uploads folder from root to subdomain. It works on one server. If I move it to another server it doesn not work. I think profblem with Upload Path. I used this settings ftp://user:password@server.com/, but it do nothing. WHat should I do?


Have latest post and recent posts display differently

I have a situation where I want the latest post to display with a larger image and more text than the recent posts which would display thereafter. So the most recent post might show about 500 characters of text and a large image. And any post thereafter would only have the thumbnail image and display 140 characters. This is the code for my posts currently:               <?php $query1 = new WP_Query( 'post_type=post&posts_per_page=1' );          while ( $query1->have_posts() ) {     $query1->the_post();     echo '
' . get_the_title( $query1->post->ID ) . '
';     echo '
' . get_the_post_thumbnail( $query1->post->ID, 'wpbs-featured-post' ) . '
';     echo '
' . get_the_content( $query1->post->ID ) . '
';          }     wp_reset_postdata();          $query2 = new WP_Query( 'post_type=post&posts_per_page=100&offset=1' );          while( $query2->have_posts() ) {     $query2->next_post();     echo '
' . get_the_title( $query2->post->ID ) . '
';     echo '
' . get_the_post_thumbnail( $query2->post->ID , 'thumbnail' ) .   '
';     echo '
' . get_the_excerpt( $query2->post->ID ) . '
';     }          wp_reset_postdata(); ?>       Is this possible?


wpColorPicker: How update colors on input value update?

**Setup:**   * An input field that has attached a `wpColorPicker` instance.   * An external event that changes the input value color. **Issues:**   * On value change the color shown by the colorpicker doesn't get automatically updated, neither the selection when user open up the colorpicker dialog box.   * `wpColorPicker` doesn't have neither`remove`, `destroy` nor `update` methods, so there is no simple way to do this.   * And lastly, they wrap the input field in a bunch of other tags to do the styling, so no simple manual removal can be done. **Question:**   * How can I update the color on the widget and its selection when user initiates interaction upon field value change?


Ajax not working in Wordpress but works fine elsewhere?

I'm using an image gallery plugin with WP theme twentyfourteen. I embedded a submit field in one of the plugin's files which executes just before the gallery is loaded and sorts the images. All the PHP and SQL modifications work fine. But I need to convert the form to ajax, and I am running into resistance. The problem seems to be wordpress because the ajax routines work fine outside of wordpress. Or when they are loaded on their own page. But when I try to embed the code somewhere in the plugin files or theme files, the form doesn't work. I've tried ajax plugins and they don't apply to the form I created. The page just refreshes. How can I get ajax to work in WP?


Check for uploaded file type wordpress way for multiple uploads

I have a form in the frontend that lets the user upload multiple images and other file types as needed. To process multiple files array I have followed this answer and here is the relevant. **PHP**               global $post;     if ($_FILES) {         $files = $_FILES['upload'];         foreach ($files['name'] as $key => $value) {             if ($files['name'][$key]) {                 $file = array(                 'name'     => $files['name'][$key],                 'type'     => $files['type'][$key],                 'tmp_name' => $files['tmp_name'][$key],                 'error'    => $files['error'][$key],                 'size'     => $files['size'][$key]                 );                      $_FILES = array("upload" => $file);                 foreach ($_FILES as $file => $array) {                     $newupload = wp_insert_attachment($file,$post->ID);                 }                                                }         }     }      **HTML** Please note that my form allows multiple images array eg. `upload[]`               <form method="post" id="attachment--form" action="" enctype="multipart/form-data" >     <input type="file" multiple="true" name="upload[]">     <?php wp_nonce_field('upload_attachments_nonce','secure_upload'); ?>     <input type="submit" id="upload_attachments_button" name="upload_attachments" value="UPLOAD">     <form>      * * * I would like to check filetype using native wordpress functions wp_check_filetypes, The codex doesnot say much about it. Please help me with an example.


Is it a bad idea to CHMOD 777 all the files on your site?

I think i heard that it might pose a security threat to your site, is that right? Makes it more vulnerable to it getting hacked? How should I undo this, which files should be `chmod` to what number?


What is 'term_group' for 'order_by' in get_terms()?

I was just reading the Codex regarding `get_terms();`. What exactly is the parameter `'term_group'`? You can use it in ( _example_ ): `'order_by'` for `get_terms();`. _Hint: I could be all terms that share the same names, but have different slugs._


Image not showing using a custom function and get_post_meta

I'm trying to create a function to display either a theme option or custom images based on user input. So basically, it's a custom meta box. The user selects either a display header image OR they can upload one they want to use. I've created a custom function to call later on the single page template. This is what I have so far.               //El display image     function el_display(){         global $post;         $eldisplay = get_post_meta($post->ID, '_cmb_el_theme', true);         $elcustomdisplay = get_post_meta($post->ID, '_cmb_custom_image', true);                  if(isset($eldisplay)){                 echo '';                     }elseif(isset($elcustomdisplay)){                     echo '';                 }else{                     echo '';                 }     }      When I call the function later (using el_display(); ), there is no display image showing. I'm a little stuck and have been trying to fix this for hours. Any help would be much appreciated, thanks! * * * **UPDATE** Ok, thanks to all for helping me out and pointing me in the right direction. I do have some code clean up to do and a possible all out change in code but I'll use this for now. I got it to work with the following code.               //El display image     function el_display(){         global $post;         $eldisplay = get_post_meta($post->ID, '_cmb_el_theme', true);         $elcustomdisplay = get_post_meta($post->ID, '_cmb_custom_image', true);                  if(!empty($eldisplay)){                 echo '';                     }elseif(!empty($elcustomdisplay) && isset($elcustomdisplay)){                     echo '';                 }else{                     echo '';                 }     }      Thanks again!


Missing WP Media Settings Fields

I have a WordPress-based website, that is causing a number of problems when I try to upload any media. Media Library: ![enter image description here](http://i.stack.imgur.com/LsTKo.png) After viewing my 'Media Settings', I've noticed that I am missing the default 'Store uploads in this folder' and the 'Full URL path to files' fields. Default Settings: ![enter image description here](http://i.stack.imgur.com/hQ4L3.png) My Current Settings: ![enter image description here](http://i.stack.imgur.com/4Jpo5.png) I previously removed the path/text in the field 'Store uploads in this folder' and then saved the settings which had caused the fields to be removed. My question is, how do I restore this back?


Get part of a page url

I've been searching for this, but I can't find the answer. What I want to do: Every post will have a link to a page and that page needs to get the content of the post (the current post from where the link has been clicked) So first I have to pass the post ID of the current post to the url of the page we will click on, and when we get to that page I need to get the ID from the current page url into the page's content so I can get the post content by ID example: I am viewing a post (that has the post id 12), www.example.com/current-post and somewhere in the post I have a dynamic link www.example.com/modify-post- here?post_id=`enter code here` would lead to www.example.com/modify-post- here?post-id=12 (currently the page will not pass the ID, it is removing this part of the url post-id=12, and only shows the question mark) and this page needs to take the content (just plain text) of the post I was viewing when I clicked the link (the post with id 12, in this case) , and make it editable so it can be sent in a form. Your help is much appreciated Thank you


Efficient way of saving plugin options

I'm considering the saving of options for a plugin I'm developing. The first obvious candidate is the wp_options table. While reading the Pro WP Plugin Development book I came across this: > Every option saved adds a new record in WordPress ’ option table. You can > simply store several options at once, in one array: This avoids cluttering > the database and updates the values in one single MySQL query for greater > efficiency and speed. On the other hand, I also imagine that if the plugin has a lot of settings it may hinder performance to store everything in one array. Would it therefore make sense to split options into separate records in such cases? Third option I can think of is to create custom tables to store the plugin settings, as I've seen some plugins do this as well. What are the rules/guidelines to decide which way to go?


Link from Post to Another Post Via Clicking on Words within Original Post

On WordPress (—-.wordpress.com), how can you write a post for example, but then within a post, create a link to another page on your website if someone clicks on a highlighted word? For example, if someone writes about pie and then uses the word cake in the post, can the person make it so that if people click (highlighted) cake, it will bring them to another article about cake on the website? If so, how?


Curly bracket shortcode in header.php

I am using a plugin which uses a short-code format with curly brackets `{` I want to display this short-code in the `header.php`. Usually the following code works: `<?php echo do_shortcode('[shortcode]'); ?>`, but because of the `{` brackets I can´t seem get it to work.


PHP error with shortcode handler from a class

Currently i am using the following generic flow for adding the shortcode for a plugin.               class MyPlugin {              private $myvar;              function baztag_func() {             print $this->myvar;                     }     }          add_shortcode( 'baztag', array('MyPlugin', 'baztag_func') );      Now when this class and it's method are called i get the following error. > Fatal error: Using $this when not in object context in ... (Line no is where i have printed the `$this->myvar`) Is this a problem on Wordpress's end or is there is something i'm doing wrong? It seems to be something really simple.


Can we give Pending as a Role to wp_insert_user?

Can we give role parameter the value of pending in wp_insert_user ?


Count > 1 Navigation Slider

I have a post type `slider`, when you have more than one post to display navigation. My code:               <?php          $count_slider = wp_count_posts('slider');     echo $count_slider->publish;           ?>          <?php if($count_slider > 1): ?>

          <?php endif; ?>      But it doesn’t work. Why?


Using the 'draft_to_publish' hook (post status transition)

I am trying to use the draft_to_publish hook (http://codex.wordpress.org/Post_Status_Transitions) to run a function when a post that is a draft becomes published. This hook does not appear to be working:               add_action('draft_to_publish', 'myFunction');      When I use this in my plug-in, myFunction is never fired. I have used/tested the function before. I know it is the hook, not the contents of myFunction. All 'solutions' I found just link to the Codex page above. Any ideas about why this hook is not working? **Edit:** Here is an example. It the email will not be sent, because the action never fires:               function myfunction () {             $to = "recipient@example.com";             $subject = "Hi!";             $body = "Hi,\n\nHow are you?";             if (mail($to, $subject, $body)) {               echo("
Message successfully sent!
");              } else {               echo("
Message delivery failed...
");              }         }     add_action('draft_to_publish', 'myFunction');


Custom database or Custom Post Types?

I have been searching throughout the web for the best way to implement what I need but just cannot find a best solution as there always seems to be some drawback. I'd prefer to do it right the first time and it's been weeks trying to find the best solution. On my current website, I need to add listings of businesses with their various information such as address, phones, URLs referring to the business, etc. There would be 30+ fields and as you can see with the example of the URLs there can be many URLs which refer to the business. I'll need another list with its own data which will be a many to many relationship to the businesses. I know SQL and could easily do this in C# ASP.NET but am trying to find the best way to do it with WordPress. I will be using the Genesis framework if that matters. It appears I have 3 solutions:   * create custom tables in the WP database   * use Custom Post Types with many custom fields   * rely on a plugin Custom tables: It seems easy to retrieve the custom table info via SQL code but it looks like I would have to create an admin and especially if I want it to appear in the admin dashboard for ease of use to modify the tables. Custom Post Types: They seem like they might work but then I'd need a way to do the many to many relationship and the solution there seems to rely on a plugin like Posts 2 Posts. Also I'm not quite sure how easily it is all managed since it seems like there would be many WP pages to navigate instead of having perhaps one UI. Plugin: I have seen some recommended but then you're at the mercy of hoping the author maintains the plugin and then what happens if it breaks hence killing your website. So to the more experienced WordPress users out there, if you were going to tackle this project, which method would you use? Thanks!


if statement display content even though no data

I am trying to figure out why this page is showing content when the criteria isn´t being met. I am using this code, so if there is a website in the custom meta box if will display the DIV with the a href in it:               <?php $infos = get_post_custom_values('_url'); ?>     <?php the_content(); ?>
     <?php if ( $infos ) { ?>
<a href="http://<?php echo $infos[0]; ?>" target="_blank">Website →
     <?php } // endif ?>      If you look here: hhttp://globalicn.com/preview/regions/europe/#southern- europe the bottom Portugal link has no website, but the website link is there and shows `http:///` If I delete the tag associated with this post, then the website link doesn´t display, which is correct. So when I add the tag Souther-Europe it somehow still adds the link. Full code: http://pastebin.com/8taYL6Da


Getting hierarchical custom post type permalinks to work just like pages

I've dug through every question here on custom post type permalinks, but most seem to be either problems with custom taxonomy rewrites, or the obvious missing of flush_rewrite_rules(). But in my case, I'm only using a custom post type (no taxonomy), set to be hierarchical (so I can assign parent-child relationships), with the proper "support" for the attributes metabox, etc, etc. I've flushed rewrite rules a thousand different ways. I've tried different permalink structures. But child URLs always result in 404! I originally had independent custom post types for the "parent" and "child" elements (using p2p), and I probably would have had no trouble using a taxonomy for the "parental" grouping - I know those would be semantically more accurate. But for the client, it is easiest for them to visualize the hierarchy when the "posts" are displayed in the admin just like pages are: a simple tree where children appear underneath the parent, prefixed with a "--", and in the proper order. Also, various methods for assigning order via drag-n- drop can be used. Grouping via taxonomy (or p2p) results in a flat list of "posts" in the admin listings, which is simply not as visually obvious. So what I'm after is literally the exact same behavior as core "pages", but with my custom post type. I've registered the post type just as expected, and in the admin it works perfectly - I can assign a parent and a menu_order for each newsletter "post", they appear correctly in the edit listings:               Spring 2012     — First Article     — Second Article      And their permalinks _appear_ to be constructed properly. In fact, if I change anything about the structure, or even alter the rewrite slug when registering the post type, they automatically update correctly, so I know something's working:               http://mysite.com/parent-page/child-page/                  /* works for pages! */     http://mysite.com/post-type/parent-post/child-post/        /* should work? */     http://mysite.com/newsletter/spring-2012/                  /* works! */     http://mysite.com/newsletter/spring-2012/first-article/    /* 404 */     http://mysite.com/newsletter/spring-2012/second-article/   /* 404 */      I also have standard core "pages" with hierarchical relationships created, and they look just the same in the admin, but they actually work on the front-end too (both parent and child URLs work fine). My permalink structure is set to:               http://mysite.com/%postname%/      I've also attempted this (just because so many other answers seemed to indicate it was needed, though it didn't make sense in my case):               http://mysite.com/%category%/%postname%/      My register CPT args include:               $args = array(         'public'                => true,         'publicly_queryable'    => true,         'show_ui'               => true,         'has_archive'           => 'newsletter',         'hierarchical'          => true,         'query_var'             => true,         'supports'              => array( 'title', 'editor', 'thumbnail', 'page-attributes' ),         'rewrite'               => array( 'slug' => 'newsletter', 'with_front' => false ),      The only visible difference between my custom post type _children_ and normal _page_ children, is that my CPT has the slug at the beginning of the permalink structure, then followed by the parent/child slugs (where pages just begin with the parent/child slugs, no "prefix"). Why this would foul things up, I don't know. Plenty of articles seem to indicate that this is exactly how such hierarchical CPT permalinks should behave - but mine, though nicely formed, don't work. What also baffles me is when I examine the query_vars for that 404 page - they seem to contain the correct values for WP to "find" my child pages, but something's not working.               $wp_query object WP_Query {46}     public query_vars -> array (58)     'page' => integer 0     'newsletter' => string(25) "spring-2012/first-article"     'post_type' => string(10) "newsletter"     'name' => string(13) "first-article"     'error' => string(0) ""     'm' => integer 0     'p' => integer 0     'post_parent' => string(0) ""     'subpost' => string(0) ""     'subpost_id' => string(0) ""     'attachment' => string(0) ""     'attachment_id' => integer 0     'static' => string(0) ""     'pagename' => string(13) "first-article"     'page_id' => integer 0     [...]      I've tried this with various themes, including twentytwelve, just to be sure it's not some missing template on my part. Using Rewrite Rules Inspector, this is what shows up for the url: http://mysite.com/newsletter/spring-2012/first-article/               newsletter/(.+?)(/[0-9]+)?/?$               newsletter: spring-2012/first-article                page:      (.?.+?)(/[0-9]+)?/?$                pagename: newsletter/spring-2012/first-article                page:       how its displayed on another inspector page:               RULE:     newsletter/(.+?)(/[0-9]+)?/?$     REWRITE:     index.php?newsletter=$matches[1]&page=$matches[2]     SOURCE:     newsletter      This rewrite output would lead me to believe that the following "non-pretty" permalink would work: http://mysite.com/?newsletter=spring-2012&page=first-article It doesn't 404, but it shows the parent CPT item "newsletter", not the child. The request looks like this:               Array     (         [page] => first-article         [newsletter] => spring-2012         [post_type] => newsletter         [name] => spring-2012     )


Link blogname and blogdescription to the Options Framework

I'm putting together a _Theme Options_ page, where the user(s) I'm building this for would like to be able to edit a few settings directly from this page, including of which - the _Site Title_ and _Tagline_. With some fantastic help from brasofilo, I have the following... **/inc/options-framework.php:**               /**      * Validate Options.      *      * This runs after the submit/reset button has been clicked and      * validates the inputs.      */     function optionsframework_validate( $input ) {     /* code */         $clean[$id] = apply_filters( 'of_sanitize_' . $option['type'], $input[$id], $option );     /* code */      **options.php:**               $options[] = array(         'name' => __('Input Text Mini', 'options_framework_theme'),         'desc' => __('A mini text input field.', 'options_framework_theme'),         'id' => 'blogname',         'std' => 'Default',         'class' => 'mini',         'type' => 'text');          $options[] = array(         'name' => __('Input Text', 'options_framework_theme'),         'desc' => __('A text input field.', 'options_framework_theme'),         'id' => 'blogdescription',         'std' => 'Default Value',         'type' => 'text');      **functions.php:**               add_filter( 'of_sanitize_text', 'wpse_77233_framework_to_settings', 10, 2 );          function wpse_77233_framework_to_settings( $input, $option )     {         if( 'blogname' == $option['id'] )             update_option( 'blogname', sanitize_text_field( $input ) );              if( 'blogdescription' == $option['id'] )             update_option( 'blogdescription', sanitize_text_field( $input ) );              return $input;     }      If the user(s) add in their own blogname/Site Title and blogdescription/Tagline within the _Theme Options_ page and then click the Save button, it will output the information to the front-end of the site accordingly, and update the information within each of the text-fields within the WP API _Settings > General_ menu. **Theme Options:** ![enter image description here](http://i.stack.imgur.com/FoViP.png) **Settings > General:** ![enter image description here](http://i.stack.imgur.com/qJYWa.png) However, if the user(s) make any changes the other way around (within the WP API _Settings > General_ menu), the information is output to the front-end of the site, but wont update the fields within the options-framework/Theme Options page. As I'm fairly new to PHP and how this all works, I was wondering how would I be able to make this work the other way too?


How to add text editor in plugin menu?

Can I add a **text editor to my plugin menu**? So I can let users edit custom css file? Something like `/wp-admin/plugin-editor.php` but I want users to be able to edit only one file. The custome css file. Could this be done using **Wordpress standard functions**?


Admin menu success message

I have created a simple admin menu that allows users to enter in some basic information that is stored in the footer. When they click save the url appends `&settings-updated=true` Is there a way, using jQuery to show a success/fail message? Can anyone show me how or give me an example? Thanks in advance, George


Working with an Array inside Your Theme Options Array - Multiple Values

I apologize if this is covered extensively elsewhere, I'm not sure how to phrase my searches on the topic. Basically, instead of the following standard code to store data in WP- options...               $options = array (     array("name" => __('Font','mytheme'),         "desc" => __('Change the font face)','mytheme'),         "id" => "mytheme_font",         "std" => "Arial",         "type" => "text"),     array("name" => __('Alternate Font','mytheme'),         "desc" => __('Change the alternate font face)','mytheme'),         "id" => "mytheme_font_alternate",         "std" => "Tahoma",         "type" => "text"),     );      I would instead like to store multiple values in the "std" portion, with its own array - like this:                   $options = array (             array("name" => __('Font','mytheme'),                 "desc" => __('Change the font face)','mytheme'),                 "id" => "mytheme_font",                 "std" => array('size' => '10px', 'face' => 'Arial', 'color' => '#000000'),                 "type" => "text"),             array("name" => __('Alternate Font','mytheme'),                 "desc" => __('Change the alternate font face)','mytheme'),                 "id" => "mytheme_font_alternate",                 "std" => array('size' => '13px', 'face' => 'Tahoma', 'color' => '#FF0000'),                 "type" => "text"),             );      I would assume this is allowed, but given that it is, I am at a loss for how to: **1)** Know which name/id to use on the admin form inputs to signify to go into "size" and "face" and "color". For example, in the standard code without the multidimensional array I would usually use code like this:               <input name="<?php echo $value['id']; ?>" id="<?php echo $value['id']; ?>" type="text" value="<?php echo stripslashes(get_option( $value['id'], $value['std'] )); ?>" />      I'm not sure what to place in the "name" and "id" sections for the input. **2)** How would I retrieve these values in the WP theme? I usually use code like this:               // Make values available     global $options;     foreach ($options as $value) {     $$value['id'] = get_option($value['id'], $value['std']);     }          // Print the actual value     <?php echo $mytheme_font; ?>;}      Any help is greatly appreciated! If anyone has any ideas or knows of any tutorials on this topic that would be excellent! Thank you!


Wordpress Rewrite

I'm trying to get http://example.com/site/vendors/?u=abc to rewrite to http://example.com/site/vendors/abc but I can't for the life of me figure out how to get the url rewrites to work. /site/ is the root directory for my WP installation /vendors/ is a page


permalink results to "page not found"

Whenever I change my permalink option from the default to /%postname%/, it results into my page cannot be found. Wordpress would complain that it cannot modify the .htaccess (because there was none), so I created it in /var/www/. The .htaccess has the same owner / permissions as my wordpress folder. Please help, I've been trying to fix this for 3 days now. Do I also need to change the mod_rewrite somewhere? EDIT: Solved! inside /var/www/.htaccess Add the line: Options +FollowSymLinks for the mod_rewrite problem: > Check for Apache Mod_ReWrite – Following lists all the loaded modules > > sudo apache2ctl -M Enable Mod_Rewrite > > sudo ln -s /etc/apache2/mods-available/rewrite.load /etc/apache2/mods- > enabled/rewrite.load Restart Apache view sourceprint? 1 sudo > /etc/init.d/apache2 restart courtesy of https://usingnix.wordpress.com/2010/12/21/apache-mod_rewrite-wp- permalinks/


How to delete all post and attachments of a user when I delete it?

When I delete a user, WordPress can just delete the post or page of this user, not his custom post and his attachments. An idea for a special hook?               add_action( 'delete_user', 'my_delete_user');          function my_delete_user($user_id) {         $user = get_user_by('id', $user_id);         $the_query = new WP_Query( $args );             if ( have_posts() ) {                  while ( have_posts() ) {                      the_post();                          wp_delete_post( $post->ID, false );                               // HOW TO DELETE ATTACHMENTS ?                 }             }     }


Add images to my theme with html

I've uploaded an image to my directory (themes/themename/images/file.png). I want this image to be displayed even if the directory preceding themes is changed (in case someone installs wordpress in a directory other than the home directory). What is the call I need to find the image? Simply using img src="/images/file.png" does not work.


500 error when using virtual host

I've got a Wordpress MU install in a sub-directory of my webserver. When I point my virtual host at that directory I get my index page but no styling or access to any pages. It's like it can't access anything in the sub-directories of my WP root, I get the 500 error. When I check the Apache log it says, "Request exceeded the limit of 10 internal redirects due to probable configuration error. Use 'LimitInternalRecursion' to increase the limit if necessary. Use 'LogLevel debug' to get a backtrace." From the research I've done it points to an htaccess problem. However, when I delete the virtual host everything works fine. I'm not sure what else I need to try. I'm using Turnkey Linux. Any suggestions? Here's my config,               RewriteEngine On     RewriteBase /examples/     RewriteRule ^index\.php$ - [L]          # uploaded files     RewriteRule ^([_0-9a-zA-Z-]+/)?files/(.+) wp-includes/ms-files.php?file=$2 [L]          # add a trailing slash to /wp-admin     RewriteRule ^([_0-9a-zA-Z-]+/)?wp-admin$ $1wp-admin/ [R=301,L]          RewriteCond %{REQUEST_FILENAME} -f [OR]     RewriteCond %{REQUEST_FILENAME} -d     RewriteRule ^ - [L]     RewriteRule  ^[_0-9a-zA-Z-]+/(wp-(content|admin|includes).*) $1 [L]     RewriteRule  ^[_0-9a-zA-Z-]+/(.*\.php)$ $1 [L]     RewriteRule . index.php [L]      I think I've narrowed it down to being something with the RewriteBase. Still no solution though. UPDATE: Getting closer. I tried changing the last RewriteRule to,               RewriteRule ^(.+)$ /index.php/$1 [L,QSA]      Now I'm not getting the 500 error anymore but the CSS for my main site isn't working and some image links. The second site works for the most part except a few broken links and such.


Hiding custom theme functionality using capabilities

have spent half an hour hunting around on Google to solve this so any ideas greatly appreciated! * * * I'm using a bought theme running wp3.2 and the theme includes a few extra features Testimonials, Portfolio and Slider (they show in the admin, but aren't plugins) I'm comfortable using `$role_objet->remove_cap();` in the funtions.php file to manage capabilities, but I'm not sure how to reference these features. Basically I'm want to hide these menu items off for Editors.


Standalone form does not post to the url when form fields are populated (otherwise it does)

So this is weird.... I have a form I've created myself (not a plugin, this is what I mean by standalone), and for some strange reason it does **not** post to the form's action when the form fields have data in them. However, when the fields are _empty_ it successfully posts to the other page. I have turned off all validators and really am not sure why this is happening. Do I need to hook into a Wordpress function to allow for my own form submission? I realized my permalink structure is `/%category%/%postname%/` so perhaps it cannot properly post to the URL since it's not an actual file. How can I achieve this? Thanks


Multiple Tax Query with Meta Key

I am trying to do a tax-query on a hierarchical taxonomy with no tags. I want to show results for the dealer state and brand being viewed by the user. For instance dealers in texas that also carry honda. I only want to show the results if the meta key value of wpcf-paid is 1 for the dealers. I have the below code, but it does not seem to work. Any suggestions? Thank you! `               $args = array(     'post_type'=>'dealers',     'meta_key'=>'wpcf-paid',     'meta_value'=> '1',          'tax_query' => array(     'relation' => 'AND',             array(                      'taxonomy' => 'dealerstate',                 'field' => 'id',                 'terms' => 'terms' => get_terms( 'dealerstate', array( 'fields' => 'ids' ) ),                 'operator'=> 'AND'             ),                  array(                 'taxonomy' => 'brands',                 'field' => 'id',                 'terms' => 'terms' => get_terms( 'brands', array( 'fields' => 'ids' ) ),                 'operator'=> 'IN'             )         )     );      query_posts( $args );`


How can I force users to a particular subdomain to log in for MU (Multisite)?

I have a Multi-Site installation of Wordpress, with multiple subdomains, but only one of the subdomains has an SSL certificate. The domains are such:               www.example.com     blog1.example.com     blog2.example.com          secure.example.com           `secure.example.com` is the subdomain which has a SSL cert installed. If someone types in `blog1.example.com/wp-admin/dashboard.php`, how can I force them to `secure.example.com/wp-admin` and then after they log in redirect them back to `blog1.example.com/wp-admin/dashboard.php`?


Best way to create multi-step form with data saved to user account for later updating?

I'm attempting to set up a fairly long multi-part form (~50 questions, a few questions per page) with conditional logic. I'd like to offer registered visitors the ability to save their data between each page/step and give them the option to return later to finish. I have Gravity Forms and thought that might work, but it sounds like this isn't functionality they offer yet. Does anyone have any advice/suggestions on other form plugins or code which might meet these requirements? Thanks in advance for all your help!


Does WordPress's HTTP API use any caching?

I'm working on a plugin to will retrieve data from a remote server and display it on the Dashboard. To do this, I'll be using the WordPress HTTP API but I'm not seeing any information on the HTTP API using any form of caching. As I don't want my plugin to cause problems for the admins of the remote server, I was wondering if I missed some documentation about the HTTP API doing caching or if I'll also need to use the Transients API to implement caching for my plugin?


Registering different Post Formats for Blog Post and CPT

I'm using following code to register post formats for my blog posts ...               add_theme_support( 'post-formats', array( 'gallery', 'video', 'audio' ) );      Now, i want to add post formats support for my CPT 'Portfolio' too, but using different set of post formats. Using this code will add post format support for my CPT ...               add_post_type_support( 'portfolio', 'post-formats' );      But i only want to register _gallery_ and _video_ post format for portfolio CPT. Using the code below does'nt work ...               add_post_type_support( 'portfolio', 'post-formats', array( 'gallery', 'video' ) );      What code should i use?


How can I make the "Preview Post" button save and preview in the same window?

When you choose "Preview", which is actually a link,               Preview      the post is saved and the preview opens in a new window. I'm sure there is a javascript event attached to this button, I'd like to override it so that it saves and then preview link opens in the same tab / window. ![Picture.png](http://img854.imageshack.us/img854/7986/picturek.png)


How can I automatically attach posts to a map?

I'd like to display a Google map of places relating to posts (eg, places I've visited). Is there a plugin or method available that will allow me to have a Google map on a page and when creating a post, I can put in an address or lat/long for the post, so that it automatically gets added to the map? I'm thinking of something a bit like Drupal's Location module, which adds nodes with lat/longs to a main map.


Problem with get_the_excerpt when using an add_action('the_content') containing script tags

Because of the add_action I'm doing on get_content(), where I'm appending social media icons to the end of the post, it appears that calls to get_the_excerpt() are picking up the part of the javascript and appending it to the end of the text returned from get_the_excerpt(). I suppose this is caused by the fact that the "" tags are being stripped out (due to the fact get_the_excerpt() filters them out) as a partial answer. However, why is this being picked up by get_the_excerpt() in the first place? It results in the text: > Here is the excerpt.document.write('')...               if((get_option('myTest_facebook_like') || get_option('myTest_plus1') || get_option('myTest_tweet')) && !get_option('myTest_share_title')){         add_action('the_content', 'myTest_get_social', 10);     }               function myTest_get_social($myTest_share = '') {         global $post;              if((get_option('myTest_plus1') == '' && get_option('myTest_facebook_like') ==  '' && get_option('myTest_tweet') ==  '') || in_category("dont-show-social", $post ) || get_post_meta($post->ID, '_noShare', true)) return $myTest_share;              $myTest_share .= '
';              $myTest_permalink   = is_front_page() ? get_bloginfo('siteurl') : get_permalink();              if(get_option('myTest_plus1')){             $myTest_share .='';             global $post;             if(get_post_meta($post->ID, '_myTest_plus1_href', true)){$myTest_share .= '';}         }


Extra option in editor

I'm sure there's an easy solution to this, but I'm wondering how to add custom input fields in the Wordpress editor. My goal is to have an image uploader to the right of the main editor, when an image is uploaded, it puts the image url into a `custom field` that I an access in my theme. What's the best way to go about this? I've researched & tried plugins, but I'd rather create my own as they all produced bugs. Thanks for any help/advice. Shane


Subsite with different template, and content

I have a Wordpress blog hosted on a shared web server: http://martinnormark.com I would like to add a whole new "area" to this site, called Consulting. When navigating to http://martinnormark.com/consulting \- another template with different navigation should be used, and the frontpage should be blog posts for that specific area. This also means, that the blog posts I write for the Consulting area should not be displayed on the front page of the root domain. I use the Genesis framework, but I think that might be my problem. It doesn't seem to support this setup. Any suggestions for frameworks, themes, or plugins? **Code**               function exclude_category( $query ) {         if ( !$query->is_category('hardware')) {             $query->set( 'cat', '-1' );         }     }     add_action( 'pre_get_posts', 'exclude_category' );


Taxonomies not showing in WP Dashboard Right Now widget

For some time I've been using this code snippet adding both custom post types and custom taxonomies to the WP Dashboard Right Now widget:               function dashboard_right_now_content_table_end() {         $args = array(             'public' => true,             '_builtin' => false         );         $output = 'object';         $operator = 'and';         $post_types = get_post_types($args, $output, $operator);         foreach ($post_types as $post_type) {             $num_posts = wp_count_posts($post_type->name);             $num = number_format_i18n($num_posts->publish);             $text = _n($post_type->labels->singular_name, $post_type->labels->name, intval($num_posts->publish));             if (current_user_can('edit_posts')) {                 $num = "name'>$num";                 $text = "name'>$text";             }             echo '
name . '">' . $num . '	';             echo 'name . '">' . $text . '
';         }         $taxonomies = get_taxonomies($args, $output, $operator);         foreach ($taxonomies as $taxonomy) {             $num_terms = wp_count_terms($taxonomy->name);             $num = number_format_i18n($num_terms);             $text = _n($taxonomy->labels->singular_name, $taxonomy->labels->name, intval($num_terms));             if (current_user_can('manage_categories')) {                 $num = "name'>$num";                 $text = "name'>$text";             }             echo '
name . '">' . $num . '	';             echo 'name . '">' . $text . '
';         }     }     add_action('right_now_content_table_end', 'dashboard_right_now_content_table_end');      Using this taxonomy:               function create_secondary_taxonomies() {         $labels = array(             'name' => _x('Mogelijkheden', 'taxonomy general name'),             'singular_name' => _x('Mogelijkheid', 'taxonomy singular name'),             'search_items' => __('Search Categories'),             'all_items' => __('All Categories'),             'parent_item' => __('Parent Category'),             'parent_item_colon' => __('Parent Category:'),             'edit_item' => __('Edit Category'),             'view_item' => __('View Category'),             'update_item' => __('Update Category'),             'add_new_item' => __('Add New Category'),             'new_item_name' => __('New Category Name'),             'menu_name' => __('Mogelijkheden')         );         register_taxonomy('mogelijkheden', array(             'portfolio'         ), array(             'labels' => $labels,             'hierarchical' => true,             'query_var' => true,             'rewrite' => array(                 'hierarchical' => true,                 'slug' => 'mogelijkheden',                 'with_front' => false             ),             'public' => true,             'show_ui' => true,             '_builtin' => true         ));     }     add_action('init', 'create_secondary_taxonomies');      This all worked great. Until recently. Currently it is still showing the custom post types, but it isn't showing the custom taxonomies anymore. Does someone notices any errors or things that could conflict with this code perhaps?


Display thumbnail from custom field

I have a custom field called `picture`. On the media settings page I've set thumbnail size to 100x100. If upload an image called `gecko.jpg`, Wordpress automatically resizes it and generates `gecko-100x100.jpg`. I want to use both the thumbnail size and original size, is it possible? With `<?php echo get_post_meta($post->ID, 'picture', true); ?>` I can only get the original size. Can anybody please assist me?


How do I allow users to sort posts?

> **Possible Duplicate:**   >  How do I sort multiples pages? I want to allow users to sort a long list of posts (that are displayed on multiple pages) by custom fields. Here is my form...               <form method="post" id="order">       <select name="sort" onchange='this.form.submit()'>         <option value="">Sort by</option>           <option value="zip">Sort by Zip Code</option>         <option value="type">Sort by Property Type</option>       </select>     </form>      I was told that I need to use sessions. However, I don't know how to code this. Could anyone give me an example based on the form above?


plugin install wants ftp (chown and 755 not enough)

I have root access in ssh to my install (and other wp install working) so im not sure what i missed... installing plugins through the wp-admin interface, it wants me to input ftp. i remember this from before, a long time ago. anyway, i tried already various things like chown and chgrp everything to the user. added user to www-data group chown'ed to www-data chmod 755 (even 777 the plugins dir to check!) nothing works! what did i miss?


wp_update_nav_menu_item not saving in multisite API

I'm creating a script that automates build a wordpress site from another CMS. I've been able to change every setting: themes, options, subdomain, site title, etc. But what is eluding me is being able to create custom menus. The code below SHOULD be able to do it for me. However it is not, and I am completely stumped on what to do. This code is not being executed in the admin panel (Its not a plugin). Its actually sitting on top of wordpress and includes wp-load and wp-admin functions pages.               $mymenu = wp_get_nav_menu_object("Main Navigation Menu");     $menuID = (int) $mymenu->term_id;     $itemData = array(         'menu-item-db-id' => 0,         'menu-item-object-id' => $pageId,         'menu-item-object' => 'page',         'menu-item-type'  => 'post_type',         'menu-item-parent-id' => 0,         'menu-item-position' => $itemOrder,         'menu-item-title' => $pageData['title'],         'menu-item-url' => get_permalink($pageId),         'menu-item-description' => $pageData['post_content'],         'menu-item-attr-title' => $pageData['post_excerpt'],         'menu-item-status' => 'publish',
         'menu-item-target' => ''
     );     $thisMenuItem = wp_update_nav_menu_item($menuID, 0, $itemData);      $itemData is the result of data coming in from another CMS plus the result of saving it off a post in wordpress to produce the menu item that I want in my menu. Any help on getting the wp_update_nav_menu_item to save would be very helpful. Again this is creating a custom menu without the use of the admin panel.`


WPSC how do i output product per category on one page (wpsc-product-page)

I am trying to output and sort products per category, like:               Cat1     prod     prod          Cat2      prod          Cat3     prod     prod     prod      I am able to get the cat_ID per product, but how do i display               <?php while (wpsc_have_products()) :  wpsc_the_product(); ?>         <?php                  $wpsc_product_category = get_the_product_category( wpsc_the_product_id() );             $curr_cat = $wpsc_product_category[0]->name;             $cat_id = $wpsc_product_category[0]->cat_ID;             //print_r( $wpsc_product_category);             echo $cat_id;              ?>      Any tips, suggestions?


Different way to export data from WP?

does anyone one if there is any other way how to export all data from WP than than the default export plugin? I need it because I have JSON arrays in my custom fields and when I import XML file which was done via default WP plugin for export so it's not the same JSON array (string). It seems that Wordpress when exports custom fields delete all "\" from JSON array so after export it's broken JSON array. So that's why I'm searching for any alternative how to export all WP data. Or if you know solution how to fix this problem it would be the best. Thank you for all advices.


Query by meta_key and order by meta_value_num return orderby date

I'm trying to use the `orderby` and custom `WP_Query` features of wordpress. It works nicely to select item by their meta and to order by `date`. Unfortunately, it seems that I could not get the post result ordered by a `meta_value` numeric. Here is the args for the query :               $args = array(                     'post_status' => 'publish',                     'post_type' => 'participant',                     'order' => 'DESC',                     'meta_key' => 'participant_partage_class',                     'order_by' => 'meta_value_num,                     'meta_query' => array(                                  'key' => 'participant_partage_class',                                  'type' => 'SIGNED',                                  'compare' => '>',                             ),                     'posts_per_page' => '8',                     'paged' => $paged                 );      This result in the following query (token via request `$GLOBALS['wp_query']->request`) :               SELECT SQL_CALC_FOUND_ROWS wp_posts.ID FROM wp_posts INNER JOIN wp_postmeta ON (wp_posts.ID = wp_postmeta.post_id) WHERE 1=1 AND wp_posts.post_type = 'participant' AND (wp_posts.post_status = 'publish') AND (wp_postmeta.meta_key = 'participant_partage_class' ) GROUP BY wp_posts.ID ORDER BY wp_posts.post_date DESC LIMIT 8, 8      Which can not gave the list in order by meta_value. What I've seen is that this query :               SELECT wp_posts.*     FROM wp_posts      INNER JOIN wp_postmeta ON (wp_posts.ID = wp_postmeta.post_id)     WHERE 1=1       AND wp_posts.post_type = 'participant'       AND (wp_posts.post_status = 'publish')       AND wp_postmeta.meta_key = 'participant_partage_class'     GROUP BY wp_posts.ID     ORDER BY CAST(wp_postmeta.meta_value AS SIGNED) DESC     LIMIT 0, 8;      So my question is, how to handle this by simply using `WP_Query` object and not the default MySQL approach?


Custom Post Types and Child Themes!

OK here is my question.... I have a professionally purchased theme that has a custom post type of "PortFolio" built into the theme. The post type is ideal for what i'm trying to achieve in the website project but I wish to rename the actual post type to "Services" instead of "Portfolio". At the same time im planning to remove some of the fields in the post type but to also change the layout of the actual page too. Within the theme itself there has been a lot of custom modifications, and what im worried about is that if I change any of these settings, when it comes around to updating the theme, I presume the settings will be overwritten?? I have setup a child theme for this project, and wanted to know if I make any changes to the functions within the child theme, when I eventually update the theme, will the function updates change too? I know this may be a blindingly obvious question, but whats the best way to achieve this? Regards Tom


Nested WordPress shortcodes

Can I pass attributes from a shortcode to a nested one. Example:               [row $number_of_cols=4]         [col]             $width=total_width/$number_of_cols;         [/col]     [/row]


What hook can I use to modify custom post data before it is displayed on the page?

I need to check if a certain value is true in the post_meta right after the wp fetches a custom post from database, If it's false I need to modify/add some data to the post and then display the modified version, if it's true it should continue as usual. What would be the best hook and approach in general to accomplish something like this? Edit: Forgot to mention before, but I would HIGHLY prefer to do this inside a plugin.


How to load comment form with AJAX?

We have a Wordpress website with a large number of logged in users. Hence, we cache as much as possible, which includes post pages. We've setup our website so that that the page is mainly dynamic, so it doesn't matter if you are logged in or not. The exception is the comment submission form, which shows logged in users submission forms to others, which is not good obviously. So I want to load the comment submission form -- and just the comment submission form, not the whole list of comments -- with AJAX to avoid this. Below is my code; it isn't working. Any help on what I'm doing wrong? Thanks!

      PHP function               add_action('wp_ajax_my_form_action', 'my_form_action_callback');          function my_form_action_callback() {     global $wpdb;     $comment_form = comment_form();     echo $comment_form;     die();     }


Is there a plugin to protect downloads with recaptcha?

Is there any plugin to protect a download via recaptcha?