title: WP 3.3 RC1 new switch_theme() method foobars sidebars

text: I've been testing the new 3.3 RC1 code against my plugin and I've found a significant difference in the switch_theme() function that foobars my ability to preset widgets dynamically. The problem appears to be the call to the global $sidebars_widgets. Notice that in prior versions, the switch_theme() method did not involve the sidebar widgets. Anyone know what the purpose of that is? I have a plugin that creates and inserts widgets dynamically just before installing a new theme and calling switch_theme() during plugin activation. The code runs fine in 3.2.1, but does not run in 3.3 rc1 (The sidebar widgets are created, just not inserted into the sidebars) Here's the code from 3.2.1               function switch_theme($template, $stylesheet) {         global $wp_theme_directories;              update_option('template', $template);         update_option('stylesheet', $stylesheet);         if ( count($wp_theme_directories) > 1 ) {             update_option('template_root', get_raw_theme_root($template, true));             update_option('stylesheet_root', get_raw_theme_root($stylesheet, true));         }         delete_option('current_theme');         $theme = get_current_theme();         if ( is_admin() && false === get_option( "theme_mods_$stylesheet" ) ) {             $default_theme_mods = (array) get_option( "mods_$theme" );             add_option( "theme_mods_$stylesheet", $default_theme_mods );         }         do_action('switch_theme', $theme);     }      And here's the updated code from 3.3 rc1               function switch_theme($template, $stylesheet) {         global $wp_theme_directories, $sidebars_widgets;              if ( is_array( $sidebars_widgets ) )             set_theme_mod( 'sidebars_widgets', array( 'time' => time(), 'data' => $sidebars_widgets ) );              $old_theme = get_current_theme();              update_option('template', $template);         update_option('stylesheet', $stylesheet);              if ( count($wp_theme_directories) > 1 ) {             update_option('template_root', get_raw_theme_root($template, true));             update_option('stylesheet_root', get_raw_theme_root($stylesheet, true));         }              delete_option('current_theme');         $theme = get_current_theme();              if ( is_admin() && false === get_option( "theme_mods_$stylesheet" ) ) {             $default_theme_mods = (array) get_option( "mods_$theme" );             add_option( "theme_mods_$stylesheet", $default_theme_mods );         }              update_option( 'theme_switched', $old_theme );         do_action( 'switch_theme', $theme );     }


title: MySQL query performed 4 times inside loop

text: I have enabled custom php in my pages through the use of the `exec-php` plugin so I can run more complex pages than the standard WordPress page. I have had no problems with this plugin so far. I have recently moved a page I was using independently from WordPress to inside the WordPress system. Now instead of running a `INSERT` mysql query once like it should, it runs it 4 times leaving me with 3 redundant rows in my database. As far as I can tell there is no help on this issue, has anybody encountered this problem or know of a way to circumvent this? ~~As it may impact the answer I am using`mysql_query()` in favour of `$wpdb->query()`.~~ EDIT:   I have since rewrote the page to use the most appropriate `$wbdb` function (my code can be found here). In addition I found that when I use `$wpdb->flush();` it inserts 1 row only however it seems to break the loop as it doesn't load the template.


title: How does $wpdb handle COUNT(*)

text: I understand how to do simple queries and display results using $wpdb. This is my process:               <?php $sql = 'select * from wp_votes;'; ?>     <?php $votes = $wpdb->get_results($sql); ?>     <?php if ( !empty ( $votes ) ) { ?>          <?php foreach ( $votes as $vote ) { ?>                <?php echo $vote->id; ?>	               <?php echo $vote->post_id; ?>	               <?php echo $vote->date_voted; ?>	          <?php } ?>      <?php } ?>       Now, what if my query is more complicated, where there is a COUNT(*) involved, like so:               <?php $sql = 'select wp_votes.post_id, wp_posts.post_title, count(*) from wp_votes INNER JOIN wp_posts ON wp_votes.post_id = wp_posts.id group by wp_votes.post_id order by count(*) desc;'; ?>       This should return:               --------+------------+----------+     Post ID | Post Title | Count(*) |     --------+------------+----------+     1       |  "My post" |   6     2       |  "Hello..."|   5      Would it be OK if I do something like this?               <?php $wpdb->get_results($sql, ARRAY_N); ?>       and then, to get the count,               <?php echo $row[2]; ?>       EDIT: Turns out, it's actually just this simple, I don't have to do anything else $row[x] will work.


title: Question about the way that wp_register_script works

text: Ok so I'm using the Roots Theme for WordPress (https://github.com/retlehs/roots), which, is sort of a starter theme or theme framework. I'm confused about the way that it deregisters the WordPress loaded version of jQuery and but it registers it again **without specifying the exact location of the script**. So in the header.php of the theme there's this code:               ...     <script src="//ajax.googleapis.com/ajax/libs/jquery/1.6.4/jquery.min.js"></script>       <script>window.jQuery || document.write('<script src="<?php echo get_template_directory_uri(); ?>/js/libs/jquery-1.6.4.min.js"><\/script>')</script>     ...      ,which, reads to me: 'download the Google hosted jQuery script but if for some reason the jQuery object isn't present then just create a script element that loads the script that comes with the theme. However, inside a theme file called roots-cleanup.php that is included in the functions.php of theme there is this code that deregisters the jQuery script that comes with WordPress but immediately registers jQuery again without really specifying the script's url:               ...     function roots_head_cleanup() {       ...            // don't load jQuery through WordPress since it's linked in header.php       if (!is_admin()) {         wp_deregister_script('l10n');         wp_deregister_script('jquery');         wp_register_script('jquery', '', '', '', true);       }     }          add_action('init', 'roots_head_cleanup');     ...      Now I went to see what the documentation says about this and it says something like: _"This parameter [the location parameter] is only required when WordPress does not already know about this script."_ So I'm wondering, by including the script tags that load jQuery in the header.php does that mean WordPress is aware of them as far as calling wp_register_script goes? Like so:               wp_register_script('jquery', '', '', '', true);      I'm asking because I wanted to try this technique but I didn't get the results I expected. Namely, javascripts that I included using wp_enqueue and that depended on jQuery still loaded even when I removed the script tags that includethem in the header, which, means the javascripts I loaded failed because there was no jQuery being loaded. This also tells me that WordPress isn't necessarily aware of the jQuery script if I don't specify the location paramater.


title: Posts 2 Posts: query connected -- orderby problem

text: Using Posts 2 Posts plugin I've created `'piece'`, `'person'` and `'collection'` custom post types: any piece may be connected to person (with roles `'author'`, `'conductor'` etc) and collection. Now the relevant code looks like this:               // get all audio pieces connected to current $person:     $audio_ascond = p2p_type( 'pieces_persons' )->get_connected( $person->ID,           array( 'connected_meta' => array( 'role' => 'conductor' ),              'media_tag' => 'audio_tag',              'posts_per_page' => -1 ) );     // get their IDs:     $audio_ascond_IDs = array_map( create_function( '$p', 'return $p->ID;' ),                                           $audio_ascond->posts );     // get collections for those pieces:     $colls = p2p_type( 'pieces_collections' )->get_connected( $audio_ascond_IDs,                 array( 'orderby' => 'menu_order title', 'posts_per_page' => -1 ) );      So, the problem is that `'orderby'` has no any effect. Everything else works great. `print_r($colls)` looks like ok. What this could be, please? Thanks!


title: images in wordpress themes

text: I am developin a theme in php using wordpress.I want to display images on the website . so my question is what will be the best practise 1)store the image itself in a table using an "image" or "binary data" data type of the database server. or 2)store the images as a file in the file system and create a record in a table with the exact path to that image. ..trying to bother the database as little as possible... .


title: TinyMCE - TypeError: r is undefined

text:
With the latest pgrade of wordpress tinyMCE was upgraded. This resulted in my custom plugin being rendered useless with deprecated calls. I was able correctly format the event handling and now I am seeing the issue:               TypeError: r is undefined      Can anyone explain what 'r' is? Any way to further debug tinyMCE?               (function($) {     tinymce.create('tinymce.plugins.editor_toolkit', {         init : function(ed, url) {                     var VK = {                         DELETE: 46, BACKSPACE: 8, ENTER: 13, TAB: 9, SPACEBAR: 32, UP: 38, DOWN: 40, LEFT: 37, RIGHT: 39,                         modifierPressed: function (e) {                             return e.shiftKey || e.ctrlKey || e.altKey;                         }                     };                      function scrollToThisNode(node, padding) {                     vp = ed.dom.getViewPort( ed.getWin() )                     y = ed.dom.getPos(node).y;                     if (y < vp.y || y + padding > vp.y + vp.h) {                         ed.getWin().scrollTo(0, y < vp.y ? y : y - vp.h + padding);                     }                 }                  // Adds an observer to the onInit event using tinyMCE.init             tinyMCE.init({                setup : function(ed) {                   ed.onInit.add(function(ed) {                       console.debug('Editor is done: ' + ed.id);                       ed.dom.addClass(ed.getBody(), 'editor-toolkit');                              // Last-ditch effort to structure content                         $('#post').submit(function(){                             $( ed.getBody() ).children('p').each(function(){                                 $(this).replaceWith('

' + $(this).html() + '

');                             });                             return true;                         });                   });                }                plugins: "compat3x"                  });                  ed.on('BeforeSetcontent', function(ed, o){               if (adminpage == 'post-new-php' && !$( ed.getBody() ).hasClass('editor-toolkit-init') ) {                     o.content = '

';                     ed.dom.addClass(ed.getBody(), 'editor-toolkit-init');                 }             });                  ed.on('KeyDown', function(ed, event){               if ( event.keyCode === VK.DELETE && !VK.modifierPressed(event) ) {                    }               if ( event.keyCode === VK.BACKSPACE && !VK.modifierPressed(event) ) {                    }               if ( event.keyCode === VK.ENTER && !VK.modifierPressed(event) ) {                 setTimeout(function() {                     var currentNode = ed.dom.getParent(ed.selection.getRng().startContainer, ed.dom.isBlock);                     var prevSibling = $(currentNode).length > 0 ? currentNode.previousSibling : false;                     var nextSibling = $(currentNode).length > 0 ? currentNode.nextSibling : false;                     var prevPrevSibling = $(prevSibling).length > 0 ? prevSibling.previousSibling : false;                     var nodeIndex = $(currentNode).length > 0 ? $(currentNode).index() : false;                     var nodeIsLast = $(currentNode).length > 0 ? $(currentNode).is(':last-child') : null;                          var nodeParent = ed.dom.getParent(currentNode, 'div');                     var nodeParentPrevSibling = $(nodeParent).length > 0 ? nodeParent.previousSibling : false;                     var nodeParentNextSibling = $(nodeParent).length > 0 ? nodeParent.nextSibling : false;                     var nodeParentChildren = $(nodeParent).length > 0 ? $(nodeParent).children().length : false;                          var contentBody = ed.getBody();                     var contentFirstChild = ed.getBody().firstChild;                          var newNodeData = '

';                          function isEmpty(node) {                         if (ed.dom.isEmpty(node) || node.firstChild.nodeName === 'BR' || $(node).html() === ' ')                             return true;                         else                             return false;                          }                          switch(true) {                         // Start new block at selection point ("after")                         case nodeIsLast && nodeIndex + 1 === nodeParentChildren && nodeParentChildren > 3:                         case nodeIndex === 2 && nodeParentChildren === 3 && ( !isEmpty(prevSibling) || !isEmpty(prevPrevSibling) ):                             if ( isEmpty(prevSibling) && isEmpty(currentNode) ) {                                 $(nodeParent).after('
' + newNodeData + '
');                                 ed.dom.remove(prevSibling);                                 ed.dom.remove(currentNode);                                 newBlock = nodeParent.nextSibling;                                 ed.execCommand('mceSelectNode', false, newBlock.firstChild.firstChild);                                 ed.selection.select(newBlock.firstChild.firstChild, true);  // Extra to get FF to show cursor                                 scrollToThisNode(newBlock, 100);                             }                             break;                         // Start new block at selection point ("before")                         case nodeIndex === 2:                             if ( isEmpty(prevSibling) && isEmpty(prevPrevSibling) ) {                                 $(nodeParent).before('
' + newNodeData + '
');                                 ed.dom.remove(prevSibling);                                 ed.dom.remove(prevPrevSibling);                                 newBlock = nodeParent.previousSibling;                                 if ( $(newBlock).is(':first-child') ) {                                     ed.execCommand('mceSelectNode', false, newBlock.firstChild.firstChild);                                     ed.selection.select(newBlock.firstChild.firstChild, true);  // Extra to get FF to show cursor                                     scrollToThisNode(newBlock, 100);                                 }                             }                             break;                         // Correct new paragraph created outside a block                         case currentNode && currentNode.nodeName === 'P' && !nodeParent:                             newNodeData = $(currentNode).html();                             $(currentNode).after('

' + newNodeData + '

');                             newBlock = currentNode.nextSibling;                             ed.dom.remove(currentNode);                             break;                         // Rare but best to cover all angles (problematic on empty pages)                         case contentFirstChild.nodeName === 'P':                             $(contentFirstChild).replaceWith('
' + newNodeData + '
');                             newBlock = ed.getBody().firstChild;                             ed.execCommand('mceSelectNode', false, newBlock.firstChild.firstChild);                             ed.selection.select(newBlock.firstChild.firstChild, true);  // Extra to get FF to show cursor                             break;                         // Fix empty block                         case ed.dom.is(ed.selection.getNode(), 'div') && isEmpty(currentNode):                             ed.execCommand('mceReplaceContent', false, '

');                             break;                     }                          // Run a check for paragraphs outside a block, at root level                     setTimeout(function() {                         $(contentBody).children('p').each(function(){                             $(this).replaceWith('

' + $(this).html() + '

');                         });                     }, 250);                          ed.execCommand('mceCleanup');                 }, 0);               }             });            },       createControl : function(n, cm) {           return null;       },       getInfo : function() {           return {               longname : "Editor Toolkit",               author : 'Studio Anino',               authorurl : 'http://studioanino.com/',               infourl : 'http://studioanino.com/',               version : "1.0"           };       }     });     tinymce.PluginManager.add('editor_toolkit', tinymce.plugins.editor_toolkit);     })(jQuery);      **Is it at all possible to downgrade tinyMCE within wordpress?**


title: Plugin to redirect all 404 pages to a specific page

text: I want to redirect all 404 pages to a specific page (not the homepage). Is there any plugin that does that?


title: Have parent category contain only one post?

text: Projects <-contains basic info about projects      -Proj1 <-detailed info about proj1      -Proj2 <-detailed info about proj2      -Proj3 <-detailed info about proj3      I have a post attributed to the parent category 'Projects', and I want only that post to be seen when 'Projects' is clicked. By default, each of the subcategories' posts are being shown when I click 'Projects.' Is there a way to change this default setting, so that no posts from subcategories 'Proj1,' 'Proj2,' and 'Proj3' are seen in 'Projects'? I was referred to a plugin called Cat Lists Plus, but this completely eliminates the parent category link. (This has also not been released yet.)


title: wp 3.9.1. - default image resizer of WordPress doen't work!

text: I have a problem with the default image resizer of WordPress. Simply doesn't work. All images are uploaded as are. No thumbnails are generated. Probably there is some environment problem. I'm using windows 200 server with php 5.5, all it works fine for the other tks


title: Pods CMS - Get ACT's attached image records by auto-id?

text: I have a situation where I can't use usual Pod object and I have Advanced Content Type to deal with. I have a very large record set and I need to build a custom query to fetch the attached image records with main record. **Example Data:** Pod Name = coupons Fields (e.g.) id, name, description, thumbnails(multiple image upload field). Now, I am querying for example like this:               SELECT t.id, t.name FROM `wp_pods_coupons` t      How do I get the images attached (thumbnails field) with each coupon? I can't do new Pod('coupons').


title: Proper way to make a tweaked theme into child-theme setting?

text: I've started to tweak a theme and it's been a long road since I've started, but I came across several sources that claim this is not a good practice. I've read that the proper way to do this modifications is to make a "child theme" first. I've tried to set up a child theme but I couldn't even get the parent's css... Having this in mind, how would you migrate all the tweakings and modifications you've already done to the main original theme into a child theme? Is there a straight-forward way to do this?


title: images not showing despite using add_theme_support('post-thumbnails');

text:
I've got a system for post images where I have a specific category's post thumbnail shown in the header, with a cropped version appearing in the blog `#preview`, and the full size image appearing in the full post. Images are not appearing in any of the 3 locations, and I'm not quite sure why. functions.php-               <?php         register_sidebar();              if (function_exists('add_theme_support')) {           add_theme_support('post-thumbnails');           set_post_thumbnail_size(140,170);         }              if ( function_exists( 'add_image_size' ) ) {          add_image_size( 'custom-image', 440, 265, true ); //(hard cropped)         }              function ravs_get_custom_image( $featured_img ){         global $post, $posts;         $args = array(             'post_type' => 'attachment',             'numberposts' => 1,             'post_status' => null,             'post_parent' => $post->ID,             'exclude' => $featured_img         );            $attachments = get_posts( $args );          if ( $attachments ) {             foreach ( $attachments as $attachment ) {                          $img =  wp_get_attachment_image( $attachment->ID, 'custom-image' );                return $img;               }          }else{              echo 'Please attach images to your post';          }         }     ?>      index.php               <?php echo get_header('cait');;?>     <?php echo get_sidebar();;?>

             <?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>
                 <?php echo ravs_get_custom_image( get_post_thumbnail_id () ); ?>

<?php the_title() ;?>
                                      <?php the_excerpt('read more...'); ?>                     <?php endwhile; else: ?>
Sorry, no posts to list
                          <?php endif; ?>
>> Posted on <?php the_date('M-d-y'); ?> >> <?php the_tags('tags: ', ', ', '
'); ?>

               <?php get_footer(); ?>


title: Show limited menu to admin

text: I am using the latest wordpress 3.2.1. I would like to let create a new admin to do ONLY this: 1) Manage order to change the order status to (e.g. approve..reject). 2) Able to view user only without the ability to Edit or Delete. 3) Accept email notification on new registered user and new order. This would meant that when this new admin login, he is able to view only these 3 menu and All other menu will be invisible. Could anyone advice? I have tried many like the Adminimize, Admin Menu Editor, hide-admin-panels.. But all don works as it is a role based instead of user based. Should i create a new `admin` for these features above? or should i create an `editor` instead ? Then change the menu for editor.. I need your advice. thanks


title: How to upload image without post ID using the new media uploader?

text: In the past when using thickbox to upload images, an image could be uploaded without having the post ID 'attached' to it by simply using the code below :               jQuery('.upload_slider_button').click(function() {          tb_show('', 'media-upload.php?post_id=&type=image&TB_iframe=true&referer=matrix-settings');          return false;     });      However, how can I achieve the same thing using the new Media Uploader which was introduced since WP3.5? I have spent the whole day searching in the internet but there isn't much resources available on this new media uploader. Most of it are focused on utilizing it in theme options / plugins. Or perhaps there are other ways of uploading an image without having the post ID 'attached' to it and yet not using any plugins? Thanks a lot for helping.


title: the_content() is not displaying content, why?

text:
I have a custom theme and have built a blog page where I'd like to utilize "the loop", but get_content() is not working. Instead of displaying page content, it displays code from a template. I don't understand why this doesn't function properly, because get_posts(), the_time(), and the_title() all work fine... here's what my code looks like:                  <?php get_header(); ?>

             <?php if(function_exists('bcn_display'))                 {                     bcn_display();                  }?>

                                  <?php if( is_page('blog') ) {                   $debut = 0; //The first article to be displayed                        while(have_posts()) : the_post(); ?>
<?php the_title(); ?>

                  <?php                    $myposts = get_posts('numberposts=-1&offset=$debut');                  foreach($myposts as $post) :                  ?>
<?php the_time('d/m/y'); ?>

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

                   <?php the_content(); ?>
                     <?php endforeach; ?>
                  <?php endwhile; ?>                 <?php } else{ ?>                          <?php while ( have_posts() ) : the_post(); ?>                          <?php get_template_part( 'content', 'page' ); ?>                               <?php endwhile; // end of the loop. ?>                      <?php } ?>
                    <?php get_sidebar(); ?>                  <?php get_footer(); ?>
      And my output:               03/05/12      Cool Post 1      /*       Template Name: All posts       */        ?>         $debut = 0; //The first article to be displayed         ?>         $myposts = get_posts('numberposts=-1&offset=$debut');          foreach($myposts as $post) :           ?>         : 03/05/12        Test Post        /*         Template Name: All posts         */          ?>         $debut = 0; //The first article to be displayed          ?>         $myposts = get_posts('numberposts=-1&offset=$debut');         foreach($myposts as $post) :         ?>          : 19/04/12          Hello world!         /*         Template Name: All posts         */        ?>        $debut = 0; //The first article to be displayed         ?>        $myposts = get_posts('numberposts=-1&offset=$debut');          foreach($myposts as $post) :         ?>          :      Whatever it is, it's messing with my css as well. I noticed he /* Template Name: All posts */, but I don't have a template (to my knowledge) named all posts, so I don't know where this code came from. If anyone could please lend a hand, I'd greatly appreciate it


title: Redirect to post with only post ID in the URL vs post_type/post ID

text: The title may be a little confusing, I don't know how to word it to be short. Right now my permalink structure is `/%post_id%/%postname%` so the final URL is `/post_type/%post_id%/%postname%`. When I go to `domain.com/post_id` then it redirects to `domain.com/post_type/%post_id%/%postname%` but when I got to `domain.com/post_type/post_id` it doesn't redirect but shows the correct post. I'm not sure how to make it work the way the default redirect works.


title: Limit the number of inactive widgets

text: I'm trying to restrict the number of widgets from the "wp_inactive_widgets" sidebar to maximum 10, because the widgets admin page is incredibly slow:               add_filter('pre_update_option_sidebars_widgets', 'cleanup_inactive_widgets', 10, 2);          function cleanup_inactive_widgets($new, $old){       if(!empty($new['wp_inactive_widgets']) && count($new['wp_inactive_widgets']) > 10)         $new['wp_inactive_widgets'] = array_slice($new['wp_inactive_widgets'], -10, 10);            return $new;     }      This works apparently, but the problem is that the widget instance options still remain in the database, regardless if the widget instance exists or not inside a sidebar... Does anyone know a way to remove the widget options too? * * * ~~I found out a solution:~~ Edit: in certain situations it seems to remove widgets from other sidebars too, I'm not sure what's causing this...               if(!empty($new['wp_inactive_widgets']) && count($new['wp_inactive_widgets']) > 10){            // find out which widget instances to remove       $removed_widgets = array_slice($new['wp_inactive_widgets'], 0, -10);            // remove instance options       foreach($removed_widgets as $widget_id)         if(isset($GLOBALS['wp_registered_widgets'][$widget_id])){                $instance = $GLOBALS['wp_registered_widgets'][$widget_id]['callback'][0]->number;           $option_name = $GLOBALS['wp_registered_widgets'][$widget_id]['callback'][0]->option_name;                $options = get_option($option_name);   // get options of all instances           unset($options[$instance]);            // remove this instance's options           update_option($option_name, $options);         }            // keep only the last 10 records from the inactive widgets area       $new['wp_inactive_widgets'] = array_slice($new['wp_inactive_widgets'], -10, 10);          }     return $new;


title: How to only list the child terms of a taxonomy and not their parents?

text:
I'm creating an age select menu in the admin, populated from a taxonomy of `age`. The taxonomy is hierarchical as follows:   * 18-25 (parent, ID 183)      * 18 (child)     * 19     * 20     * 21     * 22     * 23     * 24     * 25   * 26-30 (parent, ID 184)      * 26     * 27     * 28     * 29     * 30 I would like to only list the children (18, 19 etc) and not the parents (18-25, 26-30) etc. Currently I am using `get_terms` with the `parent` argument, but it doesn't accept more than 1 parent ID. Here's what I have so far, which shows the children from 18-25.                   $ages = get_terms( 'age', array(             'hide_empty' => 0,             'parent' => '183',         ));      Here's what I want it to do, but isn't supported. I have also tried it with an array but it doesn't work either.                   $ages = get_terms( 'age', array(             'hide_empty' => 0,             'parent' => '183,184',         ));      I see there is a get_term_children function but I'm unsure of how to use this either as it looks like it only accepts one value also. Eg: In this example it would build an unordered list but I could modify for select menu.               <?php         $termID = 183;         $taxonomyName = "age";         $termchildren = get_term_children( $termID, $taxonomyName );              echo '
';         foreach ($termchildren as $child) {         $term = get_term_by( 'id', $child, $taxonomyName );         echo '
name, $taxonomyName ) . '">' . $term->name . '
';         }         echo '
';     ?>


title: wp_set_post_terms example?

text: My client has a post type that uses a lot taxonomies. I plan to put this script in a post meta box and hide the existing taxonomies. **Do you know of a greatwp_set_post_terms example?** I want to make this:   ![enter image description here](http://i.stack.imgur.com/ZbFEY.png) Look like this: ![enter image description here](http://i.stack.imgur.com/4VODQ.png) Related functions? wp_update_term


title: alphabetically order role drop-down selection in dashboard

text: The site I'm working on will have a very large number of unique user roles via a members plugin. Because of that, I'd like to have the Role drop-down selection on the Add New User page to display roles alphabetically, rather than descending order of creation. Is there any way to do this?


title: What's the opposite of required valid user in .htaccess authentication

text: I'm familiar with password protecting files and directories using apache authentication. I am working on a site where I have two WordPress installs on the same domain. One WP install is in the root /public_html/ another one is in a sub directory. We do NOT want to merge the user database this is why we are using separate WP installs. The issue is I want to password protect wp-login.php file on the main install, but not on the sub directory install. I went ahead and added the following code to my .htaccess file in my public_html directory.               AuthName "Admins Only"     AuthUserFile /path/to/passwd     AuthGroupFile /dev/null     AuthType basic          <Files wp-login.php>     require valid-user     </Files>      The issue is that this code blocks it for both the main WP site and the sub directory wp-login.php file. I was hoping if there is a way that I can add in my /folder/.htaccess which will keep the other WP install open for login by anyone. Let me know


title: Ascending order has strange effects on wordpress loop

text: I have a custom loop:               $args = array(         'post_type' => 'symposia_program',         'taxonomy' => 'days',          'term' => 'day-1',         'order' => 'ASC'     );          $query = new WP_Query($args);     if ( $query->have_posts() ) :         while ( $query->have_posts() ) :             $query->the_post();             .....(code)....         endwhile;      endif;     wp_reset_query();      For some reason, the `'order' => 'ASC'` parameter has strange effects on the output of the loop. Basically it doesn't render some of the posts, namely some recent ones. If I switch back to `DESC`, all the posts show up. Please help!


title: Style the archives/category sidebar widget via theme

text: I would like to change the appearance of the categories and archives widgets in the sidebar such that each category/month alternates the row color. The only way I know how to accomplish this requires modifying the PHP code in the core that generates the category and archives widgets (outputting alternating css styles depending on odd/even rows). I want to avoid modifying core files and instead do everything in the theme. Is there a way to accomplish this even/odd row styling for these widgets from within the theme or via CSS only?


title: Check if a different page has any attached images

text: I am trying to make a notification function for a user's account dashboard that displays if they have not added any images to their profile's gallery. I found this page, which is a function that checks if the CURRENT page has any attachments: Check if post/page has gallery? How can I change that to check by a specific post ID, i.e. a function that will check if post 2 has a gallery or not?


title: Which plugin gives me pretty html syntax in the editor/dashboard?

text: I'm looking for a plugin that gives me some on-the-fly syntax highlighting in the HTML editor of posts and pages. I swear I've seen it somewhere, but I can't find it, all the ones I find are for showing it nicely on the front-end of the post/page to users. In case it's not clear, I Would like to have my HTML editor tab show me stuff like this: http://i.stack.imgur.com/wdYvr.png


title: Custom disqus_identifier not properly changing default value

text: I have several pages that are all part of the same topic, and I would like them to use the same comment thread on Disqus. I am using the following code to pull the custom identifier from a custom field:               <?php         //Attempt to get identifier         $disqus = get_post_meta($post->ID, 'disqusid', true);         //if isset & not blank else use $post->ID         $disqus = (!empty($disqus)) ? $disqus : $post->ID;     ?>     <script type="text/javascript">         var disqus_identifier = '<?=$disqus?>';     </script>      The code is displaying the value from the custom field correctly, however, the Disqus plugin is still using the page ID as the identifier when I inspect the page code. Meaning each page still uses its own comment thread. I have tried placing the code in several different places: just before the comments_template(); code, in header.php in various places (before/after wp_head), and in footer.php in various places (before/after wp_footer). Everything I've read makes it sound as simple as adding the identifier code before the embed.js call for Disqus. I feel like I may be missing something special that needs to be done. Is it possible something else is interfering with it? Everything else is working as expected. Disqus WordPress Plugin: http://wordpress.org/extend/plugins/disqus-comment- system/ The site I'm working on isn't live until this issue is fixed, but I can set it live if viewing the whole site code will help.


title: Prevent wp_login_form() from redirecting to wp-admin when there are errors

text: I have made a login form on the front-end of my site using `wp_login_form()`. However, when the user types in an incorrect username/password they are redirected to the wp-admin login form. How can you instead display any error messages above the login form? Ideally, I don't want the user to ever have to see the Wordpress admin section. I have tried using the `redirect_invalid_login()` hook but this doesn't seem to work?


title: Remove date and category filters when editing custom post types

text: The answers to this question give excellent instructions for adding filters to the admin edit.php screen for custom post types. But they don't explain how to remove the existing filters on date and category. Does anyone know whether this is possible, and if so how to do it?


title: jQuery dialog prints HTML-Tags under Wordpress

text: i need some help. I am using wp_localize_script in my Wordpres_Plugin. Inthe documentready-function i use this Code to bring the Message up:               $('#button-setup-league').click(function()      {     $( "#dialog p" ).append('<span>'+wpslm_v_script_vars.delete_league+'</span>');                 $( "#dialog" ).dialog({                      modal: true                 });      });      The Situation is, that in Wordpress 3.4 it runs very well with no Problems. But under Wordpress 3.2 there are all the HTML-Tags like `<strong>` or `<br />` in the Messagebox visible. If i look in the Sourcecode, everything looks very good. WP 3.2 runs jQuery 1.4 and WP 3.4 runs jQuery 1.7. Does this maybe effect the outputs? Any help is very appreeciated. Thank you all


title: All post attachments in gallery grid to full screen slideshow?

text: Using the default wp gallery for displaying the attachments. All attachments for the specific post in full screen slideshow when click on image. I am using also Bootstrap frond end framework. Possible with carouse?


title: Moved WordPress to New Server, Now Tries to Download a File

text: Let me start by saying that I have moved dozens of websites from one server to another, without issue. I recently moved a website and when the URL is visited, a file named "download" with no extension and only a 1KB file size downloads automatically. I backed up all files and downloaded the databases using four different methods, just to make sure: BackWPup, BackUpWordPress and manually by zipping the files & downloading the files via FTP. The original website works perfectly on the original server. I used the method I've always used when moving to a new server. On the new server:   1. Create new DB, user and import database   2. Upload files and unzip   3. Edit wp-config.php with new DB name, user, password   4. Change the website URL using the functions.php method in the WordPress Codex, here - http://codex.wordpress.org/Changing_The_Site_URL I should also mention that I uploaded the site to three different servers (including a sub-domain on the original server), all with the same result. In addition to the methods mentioned above, I tried the following things to try to troubleshoot:   1. Changed the "plugins" folder name to see if a plugin was causing the error    2. Changed the active theme folder name to see if the theme was causing the error    3. Changed WP_DEBUG to "true" in wp-conig.php - But the site never loads, so no errors are displayed. Currently, the erroneous website is located at - http://cgdev.webworksplayground.com/ Thanks for the help.


title: Unable to add widgets to sidebars in custom theme

text:
I'm trying to add a footer area to wordpress so I can drop widgets and things there. I see my footer area in the admin section, but if I add a text (or any other) widget and then save it, nothing shows up on the footer. If I refresh the page, the widget that I dragged to the right in my footer area is no longer listed there. I checked the network requests and there aren't any errors that I'm seeing. Did I miss a step? **footer.php** contains:               <?php     get_sidebar('footer_widget_area');     wp_footer();     ?>      **functions.php** contains:               // Register widgetized areas     function theme_widgets_init() {         // Area 1       register_sidebar( array (       'name' => 'Primary Widget Area',       'id' => 'primary_widget_area',       'before_widget' => '
',       'after_widget' => "
",         'before_title' => '
',         'after_title' => '
',       ) );              // Area 2       register_sidebar( array (       'name' => 'Secondary Widget Area',       'id' => 'secondary_widget_area',        'before_widget' => '
',       'after_widget' => "
",         'before_title' => '
',         'after_title' => '
',       ) );              // Footer       register_sidebar( array (       'name' => 'Footer',       'id' => 'footer_widget_area',        'before_widget' => '
',       'after_widget' => "
",         'before_title' => '
',         'after_title' => '
',       ) );     } // end theme_widgets_init          add_action( 'init', 'theme_widgets_init' );      **Update:** It's not just the new widget area I can't add widgets to, it's all of them.


title: Date archive permalinks for custom taxonomy

text: Is it possible to have date based permalinks for a custom taxonomy? ie http://www.blah.com/taxonomy/taxonomy-term/2011/08/08 TIA! d.


title: add post meta front end edit

text:
I'm trying to allow users to add meta values in my posts but it doesn't seem to be adding it in my front end post edit
     <form id="edit_post" name="edit_post" method="post" action="">

Description
     <textarea id="description" name="description" ><?php echo $post_to_edit->post_content; ?></textarea>
          <fieldset class="data">               data               <input type="text" value="" id="data" size="60" tabindex="20" name="data"></textarea>     </fieldset>
<input type="submit" value="Edit" tabindex="6" id="submit" name="submit" />
     <input type="hidden" name="action" value="edit_post" />     <input type="hidden" name="pid" value="<?php echo $post_to_edit->ID; ?>" />     <?php wp_nonce_field( 'edit-post' ); ?>     </form>
     <?php          if( 'POST' == $_SERVER['REQUEST_METHOD'] && !empty( $_POST['action'] ) &&  $_POST['action'] == "edit_post" && isset($_POST['pid'])) {     $the_post = get_post($_POST['pid']);                $the_post = array();      $the_post['post_content'] = $_POST['description'];     $the_post['data'] = array($_POST['data']);          add_post_meta($pid, 'rating', $the_post['data'], true);            $pid = wp_update_post($the_post);                  $link = get_permalink( $pid );       wp_redirect($link);     }     ?>      but I can't seem to get it to work for the front end editing I'm pretty sure I'm doing it wrong help...


title: Specific Days, Specific image on Front Page

text: Is there a plugin that will allow me to do the above? Basically I have a webcomic that updates twice a week with two different stories. http://www.lunarblade.com What I would like to be able to do is have it somehow automatically use image A for Tuesdays that'll tell people there's a new page of story A, and image B on Thursdays to show there's a new page of story B. So if anyone knows a solution, via plugin or scripts (I'm a novice scripter of CSS), I would be very appreciative. I would love to find something that sets a specific image for a specific day. Thank you for your time reading this! Anat.


title: How to Display Wordpress Plugins in Normal Website (Without Wordpress)?

text: Probably it can by reverse engineering, but is there any easier way of doing this?


title: Jquery in IE, fully messed up

text:
I am using the nivo slider in one of my website, the slider looks perfect in Firefox, but in IE 7, 8 its height is increased upto 1006px, the slider works, but the height has increased a lot, I have deactivated all the plugins, still its viewing the same, but in my localhost it works in IE also, but I cant differentiate the actual problem in it, here is the site http://www.marqueehireauckland.net.nz/ Can anyone help me in this? My nivo slider code is this

                             <img src="<?php bloginfo('template_directory'); ?>/images/header.jpg" alt="" width="1002"/>                             <img src="<?php bloginfo('template_directory'); ?>/images/header1.jpg" alt="" width="1002" />                             <img src="<?php bloginfo('template_directory'); ?>/images/header2.jpg" alt="" width="1002"/>                             <img src="<?php bloginfo('template_directory'); ?>/images/header4.jpg" alt="" width="1002"/>                             <img src="<?php bloginfo('template_directory'); ?>/images/header5.jpg" alt="" width="1002"/>

      EDIT: I have fixed this. Thank you


title: How to change a meta value (of a published post) after X days.?

text: I have a custom field. I would like to change the text of that custom field after x days. I want something like this:               if ( published post is more than 90 days old ) {         echo "your post is more than 90 days old";      }     else {         echo "your post is less than 90 days old";     }      Can anyone help me to achieve this? Thanks.


title: Syncing content in Multisite. Possible?

text: I'm looking to setup Multisite and use the second site to show the same exact pages, accessing the same posts, and excluding those pages with a custom field that reads something like "Parent site only". Any idea on how to go about this?


title: is_active-sidebar loop

text:
So I have 4 widgets which is in large-3 columns, when they're not active I place a placeholder as user guide so the user would know where to put what. I did manage to work out the is_active but it turns out to be a long code, I was wondering if there is a way to shorten it. Widgets from available-course-list-1 to -4               <?php if ( is_active_sidebar( 'available-course-list-1' ) ) : ?>

            <?php dynamic_sidebar( 'available-course-list-1' ); ?>

     <?php else: ?>

Available Course List #2

To add lists courses in this widget, please use the Available Course List widget panel.

     <?php endif; ?>      I tried something like this:               <?php if ( is_active_sidebar( 'available-course-list-1', 'available-course-list-2' ) ) : ?>

                <?php dynamic_sidebar( 'available-course-list-1', 'available-course-list-2' ); ?>
      but that didn't work.


title: Custom Field sort not working (WP 3.8.1)

text: I am trying to sort a custom wp_query using the date format YYYYMMDD (php: date('Ymd') ). This will not be regarded as date field, but rather as a numeric one stored in custom field. My WP-QUERY code is the following:               $today = date("Ymd", strtotime(current_time('mysql')));          $args = array(      "post_type" => "post",      "post_status" => "publish",      "posts_per_page" => -1,      "cat" => 13,      "meta_query" => array(       array(        "key" => "event-date",        'type' => 'NUMERIC',        'value' => $today,        "compare" => ">="       )      ),      'orderby' => 'meta_value_num',                                  'order' => 'ASC'      );      $eventsbody = new WP_Query($args);        var_dump($eventsbody->request);      upon the dump it produces the following code:               "SELECT wp_posts.* FROM wp_posts INNER JOIN wp_term_relationships ON (wp_posts.ID = wp_term_relationships.object_id) INNER JOIN wp_postmeta ON (wp_posts.ID = wp_postmeta.post_id) LEFT JOIN wp_icl_translations t ON wp_posts.ID = t.element_id AND t.element_type LIKE 'post\_%' LEFT JOIN wp_icl_languages l ON t.language_code=l.code AND l.active=1 WHERE 1=1 AND ( wp_term_relationships.term_taxonomy_id IN (13) ) AND wp_posts.post_type IN ('post', 'page', 'attachment') AND (wp_posts.post_status = 'publish') AND ( (wp_postmeta.meta_key = 'event-date' AND CAST(wp_postmeta.meta_value AS DATE) >= '20140326') ) AND (t.language_code='el' OR t.language_code IS NULL ) GROUP BY wp_posts.ID ORDER BY wp_posts.post_date ASC "       The problem is, that it disregards the meta_value_num ordering and does the order by wp_posts.post_date. Is it a wp3.8.1 problem?


title: Where do I find "log in" and "register" link which are located on the top right corner?

text: My site has "log in" and "register" links on the top right corner of homepage and every page. Where do I find these in the source code?


title: How to hook in after user's registration email has been sent?

text: I want to redirect to a page **after the user's registration email has been sent**. What is the correct hook? `user_register` is too early, that is the user is entered into the database but the email isn't send. Thank you!


title: Change the default Category selection from a checkbox to an optionbox

text: Is there any way to transform the default "Category" taxonomy menu in the admin panel (once in a post) from a checkbox multi-option to a checkbox single option, or an option box. My aim is to prevent a user to add a content in more than one category. Thanks


title: Put an extra check box on "Page Attributes" widget

text: that will add `lang="ur"` attribute in page's main `<body>` tag. How I can do that? I try different plugin including polylang, but look not working. Please suggest plugin if you know or do some simple coding.


title: how can I query all wordpress users of a blog

text: How can I loop through all Wordpress users in a blog, and sort them in ascending order by their usernames?


title: WP Super Cache versus W3 Total Cache

text: I recently moved to a dedicated server and I've been having some problems with W3 Total Cache, server crashing, eating up a lot of RAM, back end interface becoming slow.. Everything appeared to work fine in shared hosting.. I am keen to try WP Super Cache. I am using a lot of plugins and I hope the combination of WP Super Cache and WP Minify would do the job better than W3 Total Cache. Any advice would be much appreciated as I have already spent a lot of research hours on the topic of caching but it seems that there is no clear answer as to the advantages and disadvantages of each option. I am now on a 12GB RAM server and have to serve about 500 visitors per day..


title: Efficiently loop over huge number of posts

text: I want to loop all posts to do some processing, but one of my concern is there are many posts and it might used up my memory, so I want to loop posts with `offset`, something like `paging`. e.g.               $posts = get_posts(array('post_status' => 'publish', 'posts_per_page' => -1));          foreach ($posts as $post) {       // Huge memory requirement as $posts might be huge     }      Any recommended way to do it?


title: How do I change the image from the default mysteryman in the WP Profile page

text: I work for a company that has recently added a plugin for WordPress. We have a company profile page, as the plugin owner, and we want to change the image from the the default mysteryman to a logo. I realize this is a small detail to most of you, but I am a tech. writer not a developer and am in need of some help. Thank you in advance. Yaacovg


title: Problems w/ ups shipping plugin

text: I am trying to get my site up and running but am having problems with my ups plugin. I can not get it to calculate shipping rates. im getting this error: [UPS] No rate returned for service code 03, Invalid Access License number (UPS code: 250003). I have checked the license # and it is correct. All products have shipping info.


title: Add a user to a specific blog when they register?

text: I've setup a WP MU site and I need to know how to sign up a user to a specific blog when they register. As it is now, if a visitor is visiting a specific site and they click the register button they are taken to the main network site and then they are given the option to register as a user or create their own blog. I can create my own registration page but I'm not sure how to add that user to a specific site. This is what I have so far:               $meta = apply_filters( 'add_signup_meta', array() );     $emailSent = wpmu_signup_user( $user_name, $user_email, $meta );


title: How can I hide tags on a child-category page, if that tag has not been used?

text:
I have a section of my site where I'm using child-categories and tags to sort content. I'm have a tertiary navigation for the tags (templates/nav-tags.php):
             <?php               $tags = get_tags(                      array(                          'hide_empty' => true                         )                      );                 if ($tags) {                     foreach ($tags as $tag) {                         echo '
slug                              .'" href="" title="'                              . sprintf( __( "filter post by %s" ), $tag->name )                              . '" '                              . '>'                              . $tag->name                             .'
 ';                     }                 }             ?>
           The problem is, this lists ALL of the tags, even if `child-category-b` doesn't have any posts tagged in `tag-a`, it will list `tag-a` when on the `child- category-b` page. I need a way to hide tags/only show tags if they have been used in that child- category. Here is a screenshot of what I'm working with:   ![enter image description here](http://i.stack.imgur.com/ovNPDm.png)   _click to enlarge ⤴_ The `posts` template (templates/posts-easy-steps.php):
              <?php             $category = get_the_category();                              $args = array(                    'post_type' => 'easy_steps',                    'posts_per_page' => 4,                    'category__in' => ($cat),                 );                        $second_query = new WP_Query( $args );             if ( $second_query->have_posts() ):                while( $second_query->have_posts() ) : $second_query->the_post();                     $titlechars = 45; // Character Limit                $posttitle = get_the_title();                $modtitle = substr($posttitle, 0, $titlechars);                     $contentchars = 120; // Character Limit                $postcontent = get_the_excerpt();                $modcontent = substr($postcontent, 0, $contentchars);                  echo '
';         ?>              <?php                  if( get_field('image') ):                      $attachment_id = get_field('image');                 $size = 'customfeatins'; // (thumbnail, medium, large, full or custom size)                 $image = wp_get_attachment_image_src( $attachment_id, $size );                  echo '';         ?>              <?php else : ?>                  <?php echo '' ?>              <?php endif; ?>              <?php             echo '
' . $modtitle .'

' . get_the_date() .'

' . $modcontent . '… More ›

';         ?>              <?php                                           endwhile;             endif;             //wp_reset_postdata(); // to reset the loop         ?>
      And the `parent-category` and `child-category` template (category- easysteps.php):   _I'm using a function to force`child-categories` to use the `parent-category` template_
          <?php get_template_part('templates/masthead'); ?>     <?php get_template_part('templates/header-top-navbar'); ?>

Easy Steps                  <?php                 if ( is_category() ) {                     $category = get_category( $cat );                     echo ' -  '.$category->cat_name.' ';                     } else {                 } ?>
                      <?php edit_post_link('edit this entry', '
', '
'); ?>
                 <?php get_template_part('templates/easy-cats'); ?>
                 <?php get_template_part('templates/nav', 'tags'); ?>                  <?php get_template_part('templates/posts-easy-steps'); ?>
                      <?php if (hchw_sidebar()) : ?>                     <?php get_template_part('templates/sidebar', 'right'); ?>                 <?php endif; ?>

       I've been searching for a solution but I'm at a loss...


title: How to hook a function only when I need to delete permanently a post?

text: I need to hook a function only when I delete permanently a post from the database, I've tried the 'before_delete_post' hook, however, it's called both when it's trashed and permanently deleted. The wp_delete_post() function calls wp_trash_post() and should stop processing, but it looks like the wp_delete_post() is called again after the post is trashed. I've seen this question: Wordpress Delete hook with wp_delete_post function?. My need is exactly the oposite of it.


title: Frontend editing, Frontend user dashboard

text: I am creating a website so that users can submit their articles from the front end. I have quite a few things set up:   * The ability to submit custom post types from the front end   * Blocked from the back-end. I'd like to create a page (for logged in users) labeled "my posts" or my "submissions" that will show logged in users their own custom post post types and their status so that they know what's been published, what will be published in the future, pending, drafts (so they can go back and edit), and pending (so that I as Editor, know when an article is ready for my review). I'm guess I'm looking for a frontend user dashboard. I've tried WP User Frontend, but it clashes with s2member and won't show posts from s2member registered users. I just need something simple that will allow users easy access from the front end to manage their posts. I've been trying plugin after plugin and adding things to my short code creator but nothing works the way I need it to. It doesn't have to be pretty, just a simple code that a non coder (like me) update per by custom post types. To explain further, i'd like to have one code on a page shows the users all the deals they've submitted (and their status), and another code to show users all the articles they've submitted (and their status), etc. Any help would be very useful Thanks in advance!


title: How to change settings so I can upload images in Wordpress posts?

text: When I try to upload an image in a post on this WordPress site: http://richardclunan.com/ ...I get the message "Unable to create directory **__**. Is its parent directory writable by the server?" How do I change settings so I can upload images?


title: Problem Implementing parallax in header of bp-default theme

text:
I'm trying to implement parallax in bp-default theme's header, but facing problem ....   1. The page getting glitches, the adminbar is centre aligned but the rest of the content of the page is getting left aligned , the below image show the example .... http://img822.imageshack.us/img822/1476/bpdparallax.jpg   2. Cannot change the default header from the **default.css** file , though I change the background image url under **#header** to a different file in different location , the page shows the **default_header.jpg** in every circumstances, even though I _hard-refresh_ the browser .... the codes I'm using are as follows : header.php within the `<head></head>` tag between the wp_head() and the end of the head tag I place ...                                          <link rel="stylesheet" type="text/css" href="http://localhost/swabandhab/wp-content/plugins/buddypress/bp-themes/bp-default/_inc/parallax/reset-min.css">      and in the beginning of the `<body>` tag just after the `<div id="header">` I place

      and I use               #parallax {      width: 960px;      height: 200px;      position: relative;      overflow: hidden;      margin: 0 auto;     }      this css in default.css file inspite of these problems the parallax animation is working just fine ! What am I doing wrong ?


title: How to use stack flair on my site?

text: I want to add stack flair on my WordPress site. How can I use that? I want to put it in the right hand side column. Can anyone help me with this?


title: Force use of RSS 0.92 feed

text: Just wondering if there was an elegant way to force WordPress to use the RSS 0.92 feed at all? The reason I ask is that we have added some custom XML tags to a site's feed so that an accompanying iOS app can pull certain data from the feed - WordPress has recently deprecated RSS 0.92 in favour of RSS 2.0 and this is breaking the app, so reverting to RSS 0.92 as a short term fix would be ideal. I will very much look forward to any thoughts you might have! Alex


title: Uknown meta entries in wp_postmeta

text: I'm working on a site that has been running for few years and had different maintainers so it's kind of a mess. What I found weird is a lot of entries in `wp_postmeta` where all the keys are numeric and contain a string like this:               wpAjaxe17fbeda4c811052694cd66e93bf1868f720040882f22c2bba8432e030f010c8069596982baf4cc001345db989c7f98c      where `wpAjax` is the fixed part and the rest is a sequence of hexadecimal values (or so they seem). These entries are 1170 and the `meta_key` ranges from 45511 to 46788 and the last post (as in the one with the greatest ID) referred to one of these meta keys is dated almost three years ago, so I think they might have been created by some plugin which has been long forgotten now. Is there any way to find out if any plugin uses those kind of meta values? I did a search but found nothing. I'd like to know if they're safe to delete because they seem useless and also mess up the post creation page as they fill the custom field dropdown select (I had to modify the code to exclude numeric meta keys).


title: Multiple featured sizes / images / excerpts

text:
Usually I google but I couldn't find an answer for my problem. Most entrys I found were dealing with adding extra featured image sizes, but not when it comes to having different featured image sizes displayed on the index site embeddeed within a custom div with an option to choose from. What I try to do is working with columns and give them different options when it comes to their featured image size and options for the excerpt. Because it is a bit difficult to explain what I try to achieve I added an image to illustrate what I try to do. Not with jmasonry though and not with plugins. I don't expect a solution for this here.. def not since it seems complex what I try to do. But if anybody has an suggestion what to look for or with what approach I could start and look at to solve this. I would def. be very thankful. To describe it a bit better lets say post box 1 is in
content
      ( which, lets say has a width of 600 px and height of 400px ) and post box 2 looks like this
content
      ( which has a width of 200 px and height of 400 px ) ![The image](http://www7.pic-upload.de/25.10.12/nqmxj6ot694l.png)


title: Leveraging browser caching issue

text: I am triying to obtain a good calification on Page Speed test, now I've obtained 85 points but I am still on the problem of "Leverage browser caching". This is the Page Speed test message about this problem:               Leverage browser caching     Setting an expiry date or a maximum age in the HTTP headers for static resources instructs the browser to load previously downloaded resources from local disk rather than over the network.     Leverage browser caching for the following cacheable resources:     https://cdn.syndication.twimg.com/…ollowing&lang=es&screen_names=lomasguapa (10 minutes)     http://platform.twitter.com/widgets.js (30 minutes)     https://apis.google.com/js/api.js (30 minutes)     https://apis.google.com/js/platform.js (30 minutes)     http://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js (60 minutes)     http://pagead2.googlesyndication.com/pagead/osd.js (60 minutes)     https://oauth.googleusercontent.com/…e:rpc:shindig.random:shindig.sha1.js?c=2 (60 minutes)     http://stats.g.doubleclick.net/dc.js (2 hours)     http://www.google-analytics.com/ga.js (2 hours)      However I have seen in many source on Internet that this solution works for this case, the solution is a modification of .htaccess file. There is the first block.               ## EXPIRES CACHING ##     **<IfModule mod_expires.c>     ExpiresActive On     ExpiresByType image/jpg "access 1 year"     ExpiresByType image/jpeg "access 1 year"     ExpiresByType image/gif "access 1 year"     ExpiresByType image/png "access 1 year"     ExpiresByType text/css "access 1 month"     ExpiresByType text/html "access 1 month"     ExpiresByType application/pdf "access 1 month"     ExpiresByType text/x-javascript "access 1 month"     ExpiresByType application/x-shockwave-flash "access 1 month"     ExpiresByType image/x-icon "access 1 year"     ExpiresDefault "access 1 month"     </IfModule>**     ## EXPIRES CACHING ##          # REST OF MY .HTACCESS     # BEGIN Better WP Security     Options -Indexes          Order Allow,Deny     Deny from env=DenyAccess     Allow from all     SetEnvIF REMOTE_ADDR "^1\.234\.83\.77$" DenyAccess     SetEnvIF X-FORWARDED-FOR "^1\.234\.83\.77$" DenyAccess     SetEnvIF X-CLUSTER-CLIENT-IP "^1\.234\.83\.77$" DenyAccess     SetEnvIF REMOTE_ADDR "^211\.110\.140\.70$" DenyAccess     SetEnvIF X-FORWARDED-FOR "^211\.110\.140\.70$" DenyAccess     SetEnvIF X-CLUSTER-CLIENT-IP "^211\.110\.140\.70$" DenyAccess     SetEnvIF REMOTE_ADDR "^91\.200\.13\.45$" DenyAccess     SetEnvIF X-FORWARDED-FOR "^91\.200\.13\.45$" DenyAccess     SetEnvIF X-CLUSTER-CLIENT-IP "^91\.200\.13\.45$" DenyAccess     SetEnvIF REMOTE_ADDR "^200\.27\.231\.114$" DenyAccess     SetEnvIF X-FORWARDED-FOR "^200\.27\.231\.114$" DenyAccess     SetEnvIF X-CLUSTER-CLIENT-IP "^200\.27\.231\.114$" DenyAccess     # END Better WP Security          # BEGIN WordPress     <IfModule mod_rewrite.c>     RewriteEngine On     RewriteBase /     RewriteRule ^index\.php$ - [L]     RewriteCond %{REQUEST_FILENAME} !-f     RewriteCond %{REQUEST_FILENAME} !-d     RewriteRule . /index.php [L]     </IfModule>          # END WordPress          <IfModule mod_deflate.c>         # compress text, HTML, JavaScript, CSS, and XML (for more page speed)         AddOutputFilterByType DEFLATE text/plain         AddOutputFilterByType DEFLATE text/html         AddOutputFilterByType DEFLATE text/xml         AddOutputFilterByType DEFLATE text/css         AddOutputFilterByType DEFLATE application/xml         AddOutputFilterByType DEFLATE application/xhtml+xml         AddOutputFilterByType DEFLATE application/rss+xml         AddOutputFilterByType DEFLATE application/javascript         AddOutputFilterByType DEFLATE application/x-javascript     </IfModule>          # remove browser bugs (for more page speed)     BrowserMatch ^Mozilla/4 gzip-only-text/html     BrowserMatch ^Mozilla/4\.0[678] no-gzip     BrowserMatch \bMSIE !no-gzip !gzip-only-text/html     Header append Vary User-Agent     # END       The case is that solution does not work and the page speed is showing again the caching problem. I put all the .htaccess in order to give more information, may be some lines cause any king of problem.


title: Simple loop with shortcode rendering problem

text:
The following loop is in a `single.php` template file. It works ok, but the shortcodes aren't rendered.   **the loop:**
           <?php if(have_posts()): while(have_posts()): the_post(); ?>
<?php the_title(); ?>
           <?php ik_mostra(the_content()); ?>                     <?php endwhile; endif; ?>
      **outputs:**   Some text I put **html works fine** , but `[shortcodes]` aren't rendering, any sugestions? edit: that `ik_mostra()` function is here:               function ik_mostra($secao) {         if ($secao != NULL) :         echo apply_filters('the_content', $secao);         endif;     }      A way I tried to render it.


title: get_the_title in edit post_link

text: Basically I would like to link to the edit post interface in Wordpress with the string to display being the post title. Cannot get it to work have tried any syntax that I could come up with, but I am also only 2 days into php. Here is what I came up with. It creates a link but does not display the post title.               <a href=<?php edit_post_link('<?php echo get_the_title($ID);?>'); ?> </a>      http://codex.wordpress.org/Function_Reference/edit_post_link http://codex.wordpress.org/Function_Reference/get_the_title


title: Style wordpress image captions in RSS

text: My WordPress site includes the full article in its RSS feed. This includes the text of the post and basic formatting. It also includes post images and their captions. The problem is that my captions are not formatted. They appear below my images, but they look like plain text. This makes it hard for a reader to see that they are associated with the preceding image. How can I change the formatting of the image captions in an RSS feed reader? I'd like to make the captions italic or to use a gray color to distinguish it from the other text.


title: Add filter function in media modal box

text: I'm trying to extend the media modal, but I cant' find any documentation / tutorials about it. I'm not a master of backbone too ;-) I want to add a select box for each taxonomy that is attached to the attachment post type. At the moment only one select box is shown. So this is what I came up with. It works great except that it replaces the default toolbar. * * * ## Code               /**      * Extended Filters dropdown with taxonomy term selection values      */     jQuery.each(mediaTaxonomies,function(key,label){              media.view.AttachmentFilters[key] = media.view.AttachmentFilters.extend({             className: key,                  createFilters: function() {                 var filters = {};                      _.each( mediaTerms[key] || {}, function( term ) {                          var query = {};                          query[key] = {                         taxonomy: key,                         term_id: parseInt( term.id, 10 ),                         term_slug: term.slug                     };                          filters[ term.slug ] = {                         text: term.label,                         props: query                     };                 });                      this.filters = filters;             }              });              /**          * Replace the media-toolbar with our own          */         media.view.AttachmentsBrowser = media.view.AttachmentsBrowser.extend({             createToolbar: function() {                      media.model.Query.defaultArgs.filterSource = 'filter-media-taxonomies';                      this.toolbar = new media.view.Toolbar({                     controller: this.controller                 });                      this.views.add( this.toolbar );                      this.toolbar.set( 'terms', new media.view.AttachmentFilters[key]({                     controller: this.controller,                     model:      this.collection.props,                     priority:   -80                 }).render() );             }         });          });      * * * ## Original ![enter image description here](http://i.stack.imgur.com/htUKB.png) * * * ## My result ![enter image description here](http://i.stack.imgur.com/zSQuZ.png) * * * ## What I want ![enter image description here](http://i.stack.imgur.com/mlA7Y.jpg) * * * ## Full code https://github.com/Horttcore/Media-Taxonomies


title: Multiple recent Custom Post Type (CPT) on homepage issue

text: I have created a homepage template which shows multiple `CPT's` on homepage and its working fine. I have limited these `CPT's` to show only 1 recent post on home page using this function.               function hwl_home_pagesize( $query ) {         if ( is_home() || is_post_type_archive( 'Books' ) || is_post_type_archive( 'gear' ) || is_post_type_archive( 'movies' )) {             $query->set( 'posts_per_page', 1 );             return;         }     }     add_action( 'pre_get_posts', 'hwl_home_pagesize', 1 );      Now the issue is that the regular `Post` also getting limited to 1 recent posts, while i want to show 5 recent posts from `Post`. Please guide me on this issue. Thanks in advance.


So here is the scenario. I have to build my client side and he want to grab some categories to display on his homepage with its thumb. So my route is, just find the first post of that categories and get its thumbnail, but I don't know how to do this. I have follow this code http://stackoverflow.com/questions/15607840/display-first-last-post-from-each- categories-in-wordpress, but it will show all categories andd I don't know how to pull just certain (chosen) categories. So The questions are:   1. Is my route correct or you can suggest me another route or method.   2. How to Grab first Image from some Chosen Categories Here is the code I use to pull some chosen category.               $categories = get_categories('hide_empty=0&orderby=id');     $include="";          foreach($categories as $category):         $cat_field = 'rockable_cat_' . $category->cat_ID;         if( //some argument return true )            $include .= '
term_id ).'" title="' . esc_attr( sprintf( __( "View all posts in %s" ), $category->name ) ) . '">'.$category->cat_name.'
';     endforeach;          if($include)     $include = substr($include, 0, -1); //Remove the last comma     return $include;      Solved..!! here is my full code   1. grab the category name from category chosen               function rockable_build_cat_exclude(){              $categories = get_categories('hide_empty=0&orderby=id');         $exclude="";              foreach($categories as $cat):         $cat_field = 'rockable_cat_' . $cat->cat_ID;         if( get_option($cat_field) and get_option($cat_field)=='false')             $exclude .= "" . $cat->cat_name . ",";               endforeach;                   if($exclude)         $exclude = substr($exclude, 0, -1); //Remove the last comma                   return $exclude;     }        2. Code to pull it in the front (index.php)              <?php     $exclude = rockable_build_cat_exclude();     $exclude_array = explode(",",$exclude);          foreach ($exclude_array as $value){         $cat_query = new WP_Query(array('category_name'=>$value,'showposts'=>1));         if ($cat_query->have_posts()):while($cat_query->have_posts()):$cat_query->the_post();              $category_id = get_cat_ID( $value );?>
             <?php the_post_thumbnail('home-thumb');?>             <a href="<?php get_category_link( $category_id );?>" title="<?php echo esc_attr( sprintf( __( "View all posts in %s" ), $value ) ) ;?>"><?php echo $value;?>
              <?php endwhile;         endif;     }          ?>      Please share your thought if you have some suggestion or have some better solution.


title: Permalinks not working with Vagrant

text: I am using Vagrant to build up a little Wordpress development VM. When I select permalinks (postname) then the page from an article doesn't load. However, when I select the standard link (i.e page id) all is working good. I've used the service PuPHPet to build the VM. My settings can be found here I am using Wordpress 3.9.1 and Apache2 I've enabled mod_rewrite be executing:               a2enmod rewrite      And my .htaccess file from Wordpress is as follows:               # BEGIN WordPress     <IfModule mod_rewrite.c>     RewriteEngine On     RewriteBase /svisa/     RewriteRule ^index\.php$ - [L]     RewriteCond %{REQUEST_FILENAME} !-f     RewriteCond %{REQUEST_FILENAME} !-d     RewriteRule . /svisa/index.php [L]     </IfModule>          # END WordPress      it has the following permissions and ownership:               -rw-rw-rw- 1 vagrant www-data   248 May 30 14:52 .htaccess      My virtualhost file for the site (`/var/www/svisa/`) can be found here. from my host computer, I browse to the site via adress: `http://wpdev- vm/svisa/` where `wpdev-vm` is the name of the vm. Does anybody know what I am missing to make the permalinks work?


title: Wp-Admin extremely slow!

text: I noticed my wp-admin became extremely slow so I installed a plugin called debug bar extender to get some more info and found this: ![http://glui.me/?i=mquiiute9joj3vp/2014-05-30_at_3.00_PM.png/](http://i.stack.imgur.com/r9wb3.png) Any idea what on earth could be causing such a slow down? This was taken loading `options-general.php` in wp-admin


title: Is there a way to publish links as we do on Facebook?

text: Posting links to Facebook is very convenient. Facebook automatically fetch an extract of the website you want to share and download a thumbnail. Do you know any way to get this behaviour for Worpdress ? I would like to post links on my wordpress in the way it's done on facebook. Thanks a lot !


title: Bulk img-rename images in gallery

text: I'm trying to add the content of some text-fields to the selected images of a gallery. I found out, how to create the input-fields. My problem is to get the content of the text-fields and write it to the selected images. http://i.imgur.com/80MLEvk.png To create the text fields I use add_filter( 'attachment_fields_to_edit' ...). Help appreciated.


title: update permalinks, sign out, sign in NIGHTMARE

text: Is there a secret workflow I don't know for developing Wordpress sites? I am constantly finding I have to either update permalinks or sign out and sign back in to see changes. Sometimes I have to do both. I am using MAMP and Coda 2 as my IDE. I'd love a list of tricks to make life better while developing for Wordpress.


title: get_term_children returns WP_Error for custom taxonomy

text:
What I'm working on is a ajax based dropdown option form which returns child terms based on the option selected. When the option is selected, a function is fired using onchange, where the script grabs the term_id and taxonomy of the selected option, and sends both of those to the server. The server side script I created accepts `$_POST`, I have verified that the variables are properly assigned by echoing them back to the client and checking the console logs.               <?php     //Include wordpress     require_once( 'wp-config.php' );     require_once( 'wp-includes/wp-db.php' );     $wpdb = new wpdb( DB_USER , DB_PASSWORD , DB_NAME , DB_HOST );          if (isset($_POST)){         $taxID = $_POST[id];         $taxType = $_POST[tx];     }     else {         echo "Error: invalid data recieved. Please contact the site administrator.";         die();     }          $termchildren = get_term_children( $taxID, $taxType );          echo '
';     foreach ( $termchildren as $child ) {         $term = get_term_by( 'id', $child, $taxType );         echo '
name, $taxType ) . '">' . $term->name . '
';     }     echo '
';     die();     ?>      The goal of this script is to return some html that I can insert into another element.   \- The ID of the element causing issues is `4`, which contains a child with ID of `15`   \- The taxonomy of the element is `classifieds_categories`   \- Passing these values manually does not work either.   \- When I echo the `li` `a href` I get this error:   `Catchable fatal error: Object of class WP_Error could not be converted to string in ...` Does anyone have any suggestions? Because quite frankly I'm about to throw my laptop towards the nearest window at this point.


title: Post Rating System with wordpress

text: I'm using a Post Rating System with wordpress and jQuery, i followed this tutorial for that. `               jQuery(document).ready(function(){                jQuery("a.like:not('.voted')").live("click",function(){         heart=jQuery(this);         post_id=heart.data("post_id");     jQuery.ajax({     type:"post",     url:ajax_var.url, //--> "http://.../wp-admin/admin-ajax.php"     data:"action=post-like&nonce="+ajax_var.nonce+"&post_like=&post_id="+post_id,     success:function(a){           if(a!="already"){           heart.addClass("voted");           heart.parent().addClass("voted");           heart.parent().find(".vote-count").text(a);           heart.attr("data-original-title",a+" likes");           heart.find("i").removeClass("icon-heart-empty").addClass("icon-heart")         }         }        });         return false})});      ` and post-like.php                  function post_like()     {         // Check for nonce security         $nonce = $_POST['nonce'];              if ( ! wp_verify_nonce( $nonce, 'ajax-nonce' ) )             die ( 'Busted!');              if(isset($_POST['post_like']))         {             // Retrieve user IP address             $ip = $_SERVER['REMOTE_ADDR'];             $post_id = $_POST['post_id'];                  // Get voters'IPs for the current post             $meta_IP = get_post_meta($post_id, "voted_IP");             $voted_IP = $meta_IP[0];                  if(!is_array($voted_IP))                 $voted_IP = array();                  // Get votes count for the current post             $meta_count = get_post_meta($post_id, "votes_count", true);                  // Use has already voted ?             if(!hasAlreadyVoted($post_id))             {                 $voted_IP[$ip] = time();                      // Save IP and increase votes count                 update_post_meta($post_id, "voted_IP", $voted_IP);                 update_post_meta($post_id, "votes_count", ++$meta_count);                      // Display count (ie jQuery return value)                 echo $meta_count;             }             else                 echo "already";         }         exit;     }      My issue here is to understand how this post into post_like since the url is define to admin-ajax.php. Should i need to add an actin on admin-ajax.php. The problem is that my "a" variable on my jquery function is define with a entire html file which is not suppose to do that it is supposed to retry this $meta_count value. Can you help me with this? Thanks in advance.


title: Plugin's custom page

text: I'm making a plug-in changing default login page to custom login page. Assume that such page is laid to file `custom-login.php` in folder of plug-in. And two problems appear now: \- how to access WordPress functions? should I include some file? \- how to replace url of the page so that address does not show a plug-in directory? instead somewhat `page-based-on-wp.com/login- man.php`?


title: WP_Query and is_page_template() conditional

text: I have a custom query that goes looks like this:                       $temp = $wp_query;             $wp_query = null;             $args = array('posts_per_page' => 5, 'post_type' => 'gallery', 'post_status' => 'published', 'paged' => $paged);             $wp_query = new WP_Query($args);             if($wp_query->have_posts()):                 while($wp_query->have_posts()) : $wp_query->the_post();                     if(get_post_format()) {                         $post_format = get_post_format();                     } else {                         $post_format = 'standard';                     }                     get_template_part('/templates/parts/format', $post_format);                 endwhile;             endif; ?>      Inside post format that I call with `get_template_part('/templates/parts/format', $post_format);` I have conditional `is_page_template()`. This conditional isn't working. But when I use regular `WP_Query` without resetting the default one it does work. What can i do to make this work?


title: Template for Custom Post Type and its Category

text: I have created a custom post-type ( Testimonials ) and i have custom taxonomies for this post-type to separate the testimonials. Custom Testimonial Taxonomies are 1) Commercial 2) Residential Now, i am having issue when displaying them.. 1 ) When the user clicks the parent link testimonials ( we will show testimonials from all category) 2 ) When the user clicks Commercial or Residential ( we want to show testimonials from that specific custom taxonomy ) How to create template for the above scenario?


title: Remove query string except from google map api

text: I have an issue similar to many others in the web, but still with no solution so far. To remove query strings i've used the following code:               function _remove_script_version( $src ){         $parts = explode( '?', $src );         return $parts[0];     }     add_filter( 'script_loader_src', '_remove_script_version', 15, 1 );     add_filter( 'style_loader_src', '_remove_script_version', 15, 1 );      What i'ld like, is to know if someone believe to know how to set up a code to exclude googple map api query string from being removed. To fix the error below: > “The Google Maps API server rejected your request. The “sensor” parameter > specified in the request must be set to either “true” or “false”. Does anyone beleive to know how to fix this?


title: What are the advantages of using a custom post type archive?

text: I'm currently working on a theme that makes heavy use of custom post types to structure the content. To display a lot of the content I am using the respective `archive-$posttype.php` but this seems in many ways more cumbersome than using a page template. When using a page template to display the archive I can easily set or modify:   * a descriptive title   * a description   * the slug   * a header image for the page   * meta boxes for whatever added piece of information I might need   * the page can be easily integrated into the menu Unless I'm mistaken none of this can be done for the archive without modifying the template files. Theme settings might help with some of that but I haven't dealt with them yet and it's certainly more difficult than simply using a page template. The only advantage I'm seeing is less clutter when selecting a page template and maybe less hassle with the link structure when display single custom posts. There is probably a performance impact but I have no clue how large. Considering all that why should I use the custom post archive?


title: Multiple install for multilanguage. How to?

text: I (will) have a multilingual (3 lang actually) site. I used WMPL some time, but this plugine made me sad... Finally, I decided to install each language a part. How should it be done? I have my `/` So, should I install   `/en` `/fr` `/it` or   `/` \+ `/fr` `/it` is there some plugin that will help me to synchronize content?


title: How can I password protect a WordPress site without requiring users to log in?

text: I don't want people to have to log in, I just want to prompt them with a question and if they can answer it, they can access the site. All the solutions and plugins that I've found seem to be overkill for my needs. Does this kind of thing exist?


title: How to remove links generated by SEO-smart-links?

text: I tried seo-smart-links plugin and it linked all my posts to tags/categories and other posts. This looks stuffing and spamming to me so I uninstalled this plugin. Now the links are still there but the plugin author said links are created on the fly so they will be removed after uninstallation but it didn't. Kindly let me know how can I revert it and remove those links created by this plugin. You can have a look at technostall.com to see the situation.


title: Adding Plugin-specific Fields with wp_insert_post()?

text: _( **Moderator's note:** The original title was "wp_insert_post() and plugins")_ I use `wp_insert_post()` like this:                $my_post = array(      'post_title' => 'title',      'post_content' => $post,      'post_status' => 'publish',      'post_author' => 1,      'post_date' => date('Y-m-d H:i:s', $oldtime),      'post_category' => array(3,4)           );           wp_insert_post( $my_post );      Everything works fine, but I want to use plugins like _"All in One SEO Pack"_ I can't figure out how to save their custom fields. I tried this but it did not work:                $my_post = array(      'post_title' => 'title',      'post_content' => $post,      'post_status' => 'publish',      'post_author' => 1,      'post_date' => date('Y-m-d H:i:s', $oldtime),      'post_category' => array(3,4)      'aiosp_description' => 'description',      'aiosp_keywords' => 'keywords' // these (aiosp_) is from post edit page in WP (<input type="text" size="62" name="aiosp_keywords" value="keywords">)           );           wp_insert_post( $my_post );      How can I save these fields? Thanks for any help!!!


title: FeedWordPress duplicated posts problem

text: FeedWordPress is pulling in two, three, four, and as many as 15 copies of the same post when it updates (via manual cron triggers or via auto updates). It doesn't happen all the time, and it doesn't happen with every post. I also noticed that it occasionally says that a FWP post was "created locally on this site", even though it wasn't. Copies of that same post will sometimes say "local", and sometimes "syndicated". And one more strange behavior, it's actually posting stuff from one domain into another completely different domain, but it only seems to pull the post_title across, no content or categories. I'm on a WP Multi-site 3.0.1 install with FWP v2010.0905. I'm also using WP Super Cache if that might make a difference. Has anyone experienced any of this before? Does the duplicated posts FWP filter work properly? Thanks for your help, Dave Morris


title: How to enable category hierarchy for links?

text: It looks that by default WordPress had hierarchy only for page/post categories and not for links categories. How can I enable that?


title: RSVP form for Facebook events from a Wordpress post?

text: Is there a way to add a RSVP form to a Facebook event in a Wordpress post? (let's assume I have a website linked to a Facebook application and I want to publish public events I have published on a Facebook page also on my website, letting people RSVP from Wordpress and only from my FB page) thanks


title: Get posts by meta data OR title

text: I have a _working_ query that calls all my posts that have a certain meta value for one of two meta keys:               $term = $_GET['term'];     $args = array(         'post_type' => 'some_cpt_name',         'meta_query' => array(             'relation'      => 'OR',             array(                 'key'     => 'foo',                 'value'   => $term,                 'compare' => 'LIKE',             ),             array(                 'key'     => 'bar',                 'value'   => $term,                 'compare' => 'LIKE',             ),         )      );     $query = get_posts( $args );      I need to query all posts that have the `$term` as meta key "foo" or "bar" or as post title. Problem is _how to_ add the post title as additional possible key? > **Q:** How can I _also_ check if the `$term` maybe is in the `post_title`?


title: Custom admin post.php page

text: I'm working on a CPT but I need to have more control over the layout of the post/edit page (post-new.php and post.php). I thought hacking through admin_init would be the best option, but I can't get the script to work at all. Help?               function init_shelf_page() {         if (!current_user_can('edit_shelves') && $_SERVER['PHP_SELF'] == '/wp-admin/post.php') {             if (isset($_GET['post'])) {                 $postID = intval($_GET['post']);                 $post = get_post($postID);                 if ($post->post_type == 'shelf') {                     $post_type_object = get_post_type_object($post->post_type);                     if (!current_user_can($post_type_object->cap->edit_posts)) {                         wp_die(__('Cheatin’ uh?'));                     }                     include(dirname(__FILE__) . '/shelf-page.php');                     die;                 }             }         }     }     add_action('admin_init', 'init_shelf_page');


title: How to add php stylesheet to admin section instead of admin_head hook

text: how can we do the below code using separate file let say admin-style.php               add_action('admin_head', 'custom_admin_style');     function custom_admin_style() {        $bg_color = get_option('custom_color');        echo '<style>';        echo 'body { background: #' . $bg_color . '}';        echo '</style>;     }


title: Using custom field as custom post title

text: I've setup a custom post type with a series of custom fields using the WPAlchemy class. I'm trying to take the value of one of the custom fields and use that as the post title. So far, though, I've had no success. I've been browsing around and I've tried the following two different blocks of code:               function custom_post_type_title ( $post_id ) {         global $wpdb;         if ( get_post_type( $post_id ) == 'listing' ) {             $title = get_post_meta($post_id, 'listing_name', true);             $where = array( 'ID' => $post_id );             $wpdb->update( $wpdb->posts, array( 'post_title' => $title ), $where );         }     }          add_action('init', 'listing_save_post');     function listing_save_post( $post_id ) {             if ( ! defined( 'DOING_AUTOSAVE' ) && ! DOING_AUTOSAVE ) return;             add_action('save_post', 'custom_post_type_title', 100);             add_action('publish_post', 'custom_post_type_title', 100);     }      And.. (temporarily commenting out the nonce fields until I figure out how they work)               add_filter('wp_insert_post_data', 'change_title', 99, 2);     function change_title($data, $postarr)     {             // If it is our form has not been submitted, so we dont want to do anything         if(defined('DOING_AUTOSAVE') && DOING_AUTOSAVE) return;              // Verify this came from the our screen and with proper authorization because save_post can be triggered at other times        // if(!isset($_POST['my_nonce_field'])) return;              // If nonce is set, verify it        // if(isset($_POST['my_nonce_field']) && !wp_verify_nonce($_POST['my_nonce_field'], plugins_url(__FILE__))) return;                 // Combine address with term         $title = $_POST['listing_name'];         $data['post_title'] = $title;              return $data;     }      In both cases, the results are the same:   1. On saving the new post, it reloads the page, says it worked, and all of the custom fields are empty. (Without either code set running, the custom post works just fine and the fields are saved).    2. On viewing the custom post type index, the posts aren't there. Any ideas? **UPDATE** To clarify, I am using a custom post _without_ the title support. I am trying to populate the title field nonetheless, though, using the value in the custom field.


title: Line breaks not showing up properly

text: I'm trying to have spacing show up between a paragraph and heading in the following excerpt: In my article series on handling extracurriculars, I coined the term Sovereign Zen philosophies. It builds off of Cal Newport’s Zen Valedictorian philosophy. Before you criticize this article as being a copycat, there are some subtle differences between both philosophies, namely the self-protective critical thinking components, and their applicability beyond schooling career.      # Definition **Zen Valedictorian:** A way of living to become less overloaded and less stressed without becoming less impressive However, the line break between career and definition isn't showing up properly even with two `<br`>`<br`>. How would you suggest dealing with this?Blockquote


title: Custom Metabox with Ajax in Edit Post - Stuck

text: I'm trying to create a custom meta box with multiple text fields. The idea is that there is initially one text box, then you can click the button 'Add New' and a another text box is added (using Ajax; no need to publish or update the post for the text box to be created). I'm using the following code (below), but it just doesn't work. I'm completely stuck; really need some help. I'm even willing to donate some cash if anyone can help me figure this out. http://pastebin.com/usRhiJJ4


title: upload featured image from front end using wordpress add media button

text:
I want to submit custom post from frontend. i have made form to make this happened. But i want to upload featured image form add media button of wordpress. Code is               <?php     /*     Template Name: post submition Template          Description: Use this page template to hide the sidebar. Alternatively     you can simply remove all widgets from your sidebar to hide it on     all pages.     */     ?>          <?php get_header(); ?>     <?php           // Check if the form was submitted     if( 'POST' == $_SERVER['REQUEST_METHOD'] && !empty( $_POST['action'] )) {          // Do some minor form validation to make sure there is content     if (isset ($_POST['title'])) {          $title =  $_POST['title'];      } else {          echo 'Please enter a title';     }     if (isset ($_POST['description'])) {          $description = $_POST['description'];      } else {          echo 'Please enter the content';      }          // Add the content of the form to $post as an array     $post = array(         'post_title'    => $title,         'post_content'  => $description,         'post_category' => $_POST['cat'],  // Usable for custom taxonomies too         'post_status'   => 'draft',         // Choose: publish, preview, future, etc.         'post_type'     => 'contast'  // Use a custom post type if you want to     );     echo $pid = wp_insert_post($post);  // Pass  the value of $post to WordPress the insert function              if ($_FILES) {     array_reverse($_FILES);     $i = 0;//this will count the posts     foreach ($_FILES as $file => $array) {         if ($i == 0) $set_feature = 1; //if $i ==0 then we are dealing with the first post         else $set_feature = 0; //if $i!=0 we are not dealing with the first post         $newupload = insert_attachment($file,$pid, $set_feature);         echo $i++; //count posts         }         }                //attachment helper function                         // http://codex.wordpress.org/Function_Reference/wp_insert_post         //wp_redirect( '/submit-2/' ); // redirect to home page after submit          } // end IF     // Do the wp_insert_post action to insert it     ?>          <form action="" method="post" enctype="multipart/form-data">
Titolo
             <input type="text" id="title" value="" tabindex="1" size="20" name="title" />

Testo
             <textarea id="description" tabindex="3" name="description" cols="50" rows="6"></textarea>
          Filename:     <input type="file" name="file" id="file">

<input type="submit" value="Invia" tabindex="6" id="submit" name="submit" />
                  <input type="hidden" name="post_type" id="post_type" value="domande" />         <input type="hidden" name="action" value="post" />         <?php wp_nonce_field( 'new-post' ); ?>     </form>          <?php get_footer(); ?>      and function is               function insert_attachment($file_handler,$post_id,$setthumb='false') {     if ($_FILES[$file_handler]['error'] !== UPLOAD_ERR_OK){ return __return_false();      }      require_once(ABSPATH . "wp-admin" . '/includes/image.php');     require_once(ABSPATH . "wp-admin" . '/includes/file.php');     require_once(ABSPATH . "wp-admin" . '/includes/media.php');          echo $attach_id = media_handle_upload( $file_handler, $post_id );     //set post thumbnail if setthumb is 1     if ($setthumb == 1) update_post_meta($post_id,'_thumbnail_id',$attach_id);     return $attach_id;         }


title: Add 'Creator' User Meta when adding user

text: I am creating a custom web using WordPress. I need to get information about who has created an account/user. The meta for example **`created_by`**. So that I can retrieve who are the users that created by user X and who are the user created by Y and so on.


title: How to hide menu on WordPress admin

text: I want to hide some menus on admin panel: Appearance, Plugins, and Tools. How to hide it without plugin? And how can I un-hide them later easily?