title: How to translate add_contextual_help to get_current_screen()->add_help_tab()

text: I followed this tutorial: http://wp.tutsplus.com/tutorials/using-the-settings- api-part-1-create-a-theme-options-page/ There is a deprecated tag               add_contextual_help      It says to use this instead               get_current_screen()->add_help_tab()      However, I don't understand how to translate add_contextual_help to get_current_screen()->add_help_tab() This is the block of code that uses add_contextual_help               /**      * The Admin menu page      */     function wptuts_add_menu(){          $settings_output        = wptuts_get_settings();     // collect our contextual help text     $wptuts_contextual_help = $settings_output['wptuts_contextual_help'];          // Display Settings Page link under the "Appearance" Admin Menu     // add_theme_page( $page_title, $menu_title, $capability, $menu_slug, $function);     $wptuts_settings_page = add_theme_page(__('Wptuts Options'), __('Wptuts Options','wptuts_textdomain'), 'manage_options', WPTUTS_PAGE_BASENAME, 'wptuts_settings_page_fn');         // contextual help         if ($wptuts_settings_page) {             add_contextual_help( $wptuts_settings_page, $wptuts_contextual_help );         }         // css & js         add_action( 'load-'. $wptuts_settings_page, 'wptuts_settings_scripts' );         }      How do I do it?


title: get postviews under every posts in the main page

text: i need to display under every article in the main page, the respective number of post views. I tried with a plugin called wp.postviews but I cant figure out how it's works...it allow only the widget component. What I have to do to get the postviews? I think I have to use the plugin above and add some extra php code on the index.php Thanks for help


title: Why aren't my Follow Me links working?

text: I've been working o my website and I just noticed that most of the links from my Follow Me plugin are broken. The feed link works fine, but everything else leads to a 404. I can see what's wrong with the URL - my site address and "%20" gets put in front of every link and there are some additional problems. What I can't figure out is why this is happening or how to fix it. I have never touched the plugin code and every other link on my site works fine. I tried reentering the links and deleting and reinstalling the plugin. The problem persists. I'm self taught in HTML and CSS, so the plugin code is a little beyond me. Here's my site. The Follow Me plugin is at the top of the sidebar on the right. Thanks in advance.


title: How does WP generate html?

text:
I think this must be a simple question, despite the seemingly broad title. My wordpress theme by default displays several social icons. (You can see them here, in the upper right corner.) I'm trying to add a new icon to the existing ones. I've already generated and uploaded a new image, modified all the css and php files that (I think) required modification. However, I'm missing one key thing: somewhere, somehow the theme generates some source html that includes an unordered list that displays the icons:

RSS Feed

facebook

twitter

      I cannot figure out where this code is generated so that I tweek it to include my new additional icon. If someone could point me in the right direction (a function, some wp documentation), I'd really appreciated it.


title: check if post title in a custom post type exists in page

text: I just created a post type called 'Movies', I just added a couple of movie posts using the name of the movie as title of the post. Like > Karate Kid as a title of one post. Now i wanted to check if that custom post type title exists in page post type's content anywhere and replace it with a link. I have tried the following, but in vain.               <?php     // createa a custom post type named Keywords     function create_post_types() {         register_post_type( 'movies_ronny',             array(                 'labels' => array(                     'name' => __( 'Movies' ),                     'singular_name' => __( 'Movie' )                 ),             'public' => true,             'has_archive' => true,             'publicly_queryable' => true             )         );     }     add_action( 'init', 'create_post_types' );          //loop throught to get the title and and check if it exists on page.     function get_post_type_title($content){          if('movie_ronny' == get_post_type()){                      $mv_title = get_the_title(); //get title of movie post type              }         $wp_posts = get_the_content('page');// get content of pages.         $content = str_ireplace($mv_title,''.$mv_title.'',$wp_posts); //perform a search and replace.         return $content;          }     add_filter('the_content','get_post_type_title');


title: wp-cli displays php notices when display errors off

text: I am using wp-cli and I am having php notices and errors show up when running wp-export. Some of these warnings and errors are ending up in the output file. How can I force errors to NOT show up. I have tried `ini_set('display_errors', 0);` and `error_reporting(0);` in wp-wp-config.php               root@roc-apache-4:/var/www/blogs/html# wp export --quiet=true --debug=false --url=http://blogs.democratandchronicle.com/fleet-feet-beat/ --dir=/root/wordpress_exports --file_item_count=100000000     PHP Notice:  date_default_timezone_set(): Timezone ID 'America/New York' is invalid in phar:///usr/bin/wp/php/wp-cli.php(21) : eval()'d code on line 16     PHP Notice:  Constant ABSPATH already defined in phar:///usr/bin/wp/php/wp-cli.php(21) : eval()'d code on line 68     PHP Notice:  Undefined index: combineCommentCounts in /var/www/blogs/html/wp-content/plugins/facebook-comments-for-wordpress/facebook-comments.php on line 265          Notice: Undefined index: combineCommentCounts in /var/www/blogs/html/wp-content/plugins/facebook-comments-for-wordpress/facebook-comments.php on line 265     PHP Notice:  define() was called with an argument that is deprecated since version 3.0! The constant VHOST is deprecated. Use the boolean constant SUBDOMAIN_INSTALL in wp-config.php to enable a subdomain configuration. Use is_subdomain_install() to check whether a subdomain configuration is enabled. in /var/www/blogs/html/wp-includes/functions.php on line 3466


title: Too Many Redirects - WP-Admin Only

text: I have a couple of sites on a shared hosting server. The sites load just fine, and everything appears to work, including local links. The only thing that isn't working is that the entire wp-admin directory is throwing a "too many redirects" error message. Here is what my redirects look like to handle the domain (this is the only non-standard part of this install):               <configuration>         <system.webServer>             <rewrite>               <rules>                 <rule name="Site 2 Redirect" stopProcessing="true">                     <match url="^(.*)" />                     <conditions>                         <add input="{HTTP_HOST}" pattern="^blog\.site2\.com$" />                     </conditions>                     <action type="Rewrite" url="/site2/" />                 </rule>               </rules>             </rewrite>         </system.webServer>     </configuration>      I did see other posts claiming that the admin folder required 705 permissions, which I have set to no avail. Any help would be greatly appreciated.


title: embedding php in javascript to switch out image in child theme

text: I am trying to embed a some php in my javascript to switch out images...               $(document).ready(function() {         $('.small-port-images a:nth-child(3)').click(function() {         $('.large-port-image img').attr('src', '<?php echo get_stylesheet_directory_uri() ?>/images/large-brigham.jpg');         });     });      I believe I am missing something, for this is not working. Any advice?


title: How do I create an HTML embed code to publish WP posts on other non-WP websites?

text: I would like to offer an embed code on my WP blog allowing users to re-publish recent posts on their websites using HTML/ Javascript code snippet that they can copy from my WP site and paste into their non-WP site. Can you guys help?


title: When developing a distributable Theme, does it HAVE to be "inheritable"?

text: I'm currently developing a complex Theme (or framework, if it can be called that) for my own personal use. However, in the event that it becomes appreciated to the public - does it necessarily _HAVE_ to be inheritable (the ability to have **Child Themes** derive from it)? Am I right in guessing that there is some publicly available **Themes** that are filed under some sort of "non-extendable" category?


title: How To Show Get Adjacent Posts If Posts Are Sorted By Custom Field

text: I want to get the ID of adjacent posts. For posts sorted chronologically you can use:               get_adjacent_post      Are there any standard methods for finding the adjacent post if the posts are sorted by custom field value. Unless its very simple my skills are not up to writing a new function for this purpose. Thanks.


title: Ajax Load More Posts in Category Page

text:
I am developing a theme where I need to load more posts with ajax. Currently, when I click load more on the category pages, all the posts are loading. The category.php looks like this : ` ### >> Design <<                   <?php $counter = 0; ?>                   <?php while ( have_posts() ) : the_post(); ?>                   <?php  $style = ($counter % 2 == 0) ? 'col1 masonry-item ' :  'col2 masonry-item '; ?>                   <article id="post-<?php the_ID(); ?>" class="single-article post <?php echo $style; ?>" >
                         <a href="<?php the_permalink() ?>" rel="bookmark">                           <?php if (has_post_thumbnail( $post->ID) ) { ?>                            <?php if ($counter % 2 == 0) {                             $image = wp_get_attachment_image_src( get_post_thumbnail_id( $post->ID ), 'masonry_thumb_large');                            } else {                             $image = wp_get_attachment_image_src( get_post_thumbnail_id( $post->ID ), 'masonry_thumb_small');                            } ?>                           <img src="<?php echo $image[0]; ?>" alt="" />                           <?php } ?>

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

<?php echo the_category('/ ') ?> | Nº <?php the_field('sub_page_article_number'); ?>

<?php echo get_the_title(); ?>
                                   <?php the_excerpt(); ?>                                   <a href="<?php echo the_permalink() ?>" class="click-more">More

                            <?php $counter++; endwhile;?>
          <a class="load_more" data-nonce="<?php echo wp_create_nonce('load_posts') ?>" href="javascript:;">+ Load More +
`      Once you click the "Load More" button it calls for the /functions.php which has this code :               add_action( "wp_ajax_load_more", "load_more_func" );     function load_more_func() {     if ( !wp_verify_nonce( $_REQUEST['nonce'], "load_posts" ) ) {       exit("No naughty business please");     }     $offset = isset($_REQUEST['offset'])?intval($_REQUEST['offset']):0;     $posts_per_page = isset($_REQUEST['posts_per_page'])?intval($_REQUEST['posts_per_page']):10;     $post_type = isset($_REQUEST['post_type'])?$_REQUEST['post_type']:'post';     ob_start();                $args = array(           'post_type'=>$post_type,         'offset' => $offset,         'posts_per_page' => $posts_per_page,         'orderby' => 'date',         'order' => 'DESC'           );     $posts_query = new WP_Query( $args );     if ($posts_query->have_posts()) {       $result['have_posts'] = true;        $counter = 0;       while ( $posts_query->have_posts() ) : $posts_query->the_post(); ?>            <?php  $style = ($counter % 2 == 0) ? 'col1 masonry-item ' :  'col2 masonry-item '; ?>       <article id="post-<?php the_ID(); ?>" class="single-article post masonry-brick <?php echo $style; ?>" >
           <a href="<?php the_permalink() ?>" rel="bookmark">             <?php if (has_post_thumbnail( $post->ID) ) { ?>               <?php if ($counter % 2 == 0) {               $image = wp_get_attachment_image_src( get_post_thumbnail_id( $post->ID ), 'masonry_thumb_large');               } else {               $image = wp_get_attachment_image_src( get_post_thumbnail_id( $post->ID ), 'masonry_thumb_small');               } ?>             <img src="<?php echo $image[0]; ?>" alt="" />             <?php } ?>

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

<?php echo the_category('/ ') ?> | Nº <?php the_field('sub_page_article_number'); ?>

<?php echo get_the_title(); ?>
                 <?php the_excerpt(); ?>                 <a href="<?php echo the_permalink() ?>" class="click-more">More

            <?php $counter++; endwhile;     $result['html'] = ob_get_clean();          else {     $result['have_posts'] = false;               if(!empty($_SERVER['HTTP_X_REQUESTED_WITH']) && strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) == 'xmlhttprequest') {             $result = json_encode($result);             echo $result;          }     else {              header("Location: ".$_SERVER["HTTP_REFERER"]);         }     die();      } The javascript is :               $('.load_more:not(.loading)').live('click',function(e){     e.preventDefault();     var $load_more_btn = $(this);     var post_type = 'post';      var offset = $('#posts_list .single-article').length;     var nonce = $load_more_btn.attr('data-nonce');     $.ajax({         type : "post",         context: this,         dataType : "json",         url : headJS.ajaxurl,     data : {action: "load_more", offset:offset, nonce:nonce, post_type:post_type, posts_per_page:headJS.posts_per_page},         beforeSend: function(data) {             $load_more_btn.addClass('loading').html('+ Loading... +');             },             success: function(response) {                     if (response['have_posts'] == 1){                         var $newElems = $(response['html'].replace(/(\r\n|\n|\r)/gm, '')).css({ opacity: 0 });                         $newElems.imagesLoaded(function(){                                 $newElems.animate({ opacity: 1 });                                 $('#posts_list').append( $newElems ).masonry( 'appended', $newElems);                                  $load_more_btn.removeClass('loading').html('+ Load More +');                             });                         } else {                             $load_more_btn.removeClass('loading').addClass('end_of_posts').html('End of posts');                          }                     }         });      I have tried querying the posts differently, but nothing has worked. Any help would be greatly appreciated.


title: Get page permalink without wpurl

text: I currently have an ID of a page that I want to use its permalink as the front of a permastruct of a CPT I'm setting up. Now I can use get_permalink() but that returns the full URL: `http://www.example.com/imapage/subpage/subsubpage` but all I want to return is `imapage/subpage/subsubpage` Is there a function that can do this or do I have to device something that can subtract the non-needed part of the url?


title: Getting add_rewrite_rule and add_rewrite_tag to work

text: I am new to using **add_rewrite_rule** and **add_rewrite_tag**. I am trying to get a very basic example to work, but nothing I do seems to make it work. **I want to access this URL (this works when entering this URl in directly):**               http://localhost/?author_name=rewrite      **Via this URL:**               http://localhost/name/rewrite      **I have the following code in functions.php:**               $wp_rewrite->flush_rules();          add_action( 'init', 'addMyRules' );     function addMyRules(){         add_rewrite_rule('^people/([^/]*)/?','index.php?author_name=$matches[1]','top');         add_rewrite_tag('%author_name%','([^&]+)');     }      But I keep seeing a 404 page. Not sure what I am doing wrong.


title: Create custom URL with different levels

text: I am new to Wordpress and used to Drupal. In drupal I could put any url for any post. It is not bound to category or tags. for example, pages in any category can have any structure of different urls like below               1. /page/about/vision.html     2. /page/about/topics     3. /page/employee/motivation/artcle/1.html      But I noticed, in wordpress I can not modify the levels other than what I put in "Permalink Settings"'s custom structure section. After save the setting on it, i can not create more levels in page. Any one worked in Drupal will understand the question easily. What my question is, is there any plugins that can allow me create any URL or aliases with any levels to any post?


title: Pre-populate Slug / Permalink with URL

text: I would like to not only pre-populate the title, tags, and categories, but would also like to pre-populate the slug / permalink as well. Can I do this and if so how? **Here's my functions.php code:**               add_action( 'load-post-new.php', 'myplugin_post_new' );     function myplugin_post_new(){         add_action( 'wp_insert_post', 'myplugin_wp_insert_post_default' );     }     function myplugin_wp_insert_post_default( $post_id ){         wp_set_post_tags( $post_id, $_REQUEST['tags']);         wp_set_post_categories( $post_id, $_REQUEST['cat']);     }      If I go to **.../post-new.php?post_title=testing &content=testing2&tags=2014&cat=1**, I get my title, content, tag, and category pre-populated. Only missing the slug/permalink. Currently, I'm not wanting to use the XML-RPC method... **What I would like to do:** I would like to generate a page dynamically from a user's response in a form. The user would then be presented an editor where they can make final edits before publishing.


title: Can Wordpress Drop-ins be given their own directory?

text: Drop-in files, like advanced-cache.php or object-cache.php, sit in the root of the wp-content directory. Is it possible to give drop-ins in their own subdirectory of wp-content instead? Looking at `_get_dropins()` in wp-admin/includes/plugins.php there are no filters to set the path to the drop-in files. Also, looking at `wp_plugin_directory_constants()` in wp-includes/default-constants.php there are no constants set specific to drop-ins (as of 3.8.1).


title: Use the_taxonomies() to create a simple list

text:
I'm trying to create `<div class="cat-hidden categories"></div>` where `categories` is a list of the categories the current post is posted in. When just using `the_taxonomies()`, it outputs something like this:

`      Whereas I want it to output something similar to this: `

` That means I'm going to also have to parse the categories that are outputted because I need `Web Development/IT` to be `Web-Development/IT` or `Web- Development-IT`. I'm unsure about the `/` being in there because I think CSS doesn't allow a `/`. That's where you experts come along. I am very proficient in HTML and CSS, and know some PHP and Wordpress, but I don't know where to begin. If any more info is needed, please let me know. Thank you!


title: Custom Login page

text: we have some member sites which have member blogs in it. member site is in .Net (different domain)and blogs are in Wordpress. we need to put blogs behind the login screen of member site. It means when someone directly try to go blogs he/she should do the login first in member site. The authentication should be from member login details not wordpress users table.I want to know few things:   1. How can I create custom login page through plugin. I don't want to create page in each theme as we have lots of theme. I want a plugin so if the plugin is activated user will go on Login screen   2. I have the API to talk with member authentication.   3. After login user should be go on first page of blog instead of wp-login. Please help as I am new in Wordpress. Thanks


title: Woocommerce custom shared taxonomy

text: I've added custom shared taxonomy `season` for `product` type from woocommerce and my custom type `care`. `Care` type and taxonomy are created in `functions.php` file of my custom theme.               add_action('init', function() {         register_post_type('care', array(             'labels' => array(                 'name' => __('Cares'),                 'singular_name' => __('Care'),             ),             'menu_position' => 4,             'public' => true,             'show_ui' => true,             'has_archive' => true,             'publicly_queryable' => true,             'supports' => array('title')         ));              register_taxonomy( 'season',             array('product', 'care'),             array(                 'label' => __('Season'),                 'show_ui' => true,                 'hierarchical' => true,             )         );     });      Now when I access `season` taxonomy term, no matter which `post_type` been passed, I always get to woocommerce products archive, i.e. http://example.com/?season=helloworld&post_type=product and http://example.com/?season=helloworld&post_type=care lead to the same page with woocommerce products archive. How to make woocommerce share taxonomy properly? P.S. Using WordPress 3.8.1 and Woocommerce 2.0.20. No explicit rewrite rules added.


title: How exactly do automatic updates work?

text: I received an email this morning stating that my Wordpress site had been automatically updated to the latest version. I knew about the feature but I've always wondered exactly how it works. PHP isn't a permanently-running process: it only runs when requested. So as far as I can tell, Wordpress can only update itself when someone loads a web page. But the update process is not instantaneous, so surely a user visiting the site would have a really slow page load. Is there a different trick they use for automatic updates? I've searched all over the place but haven't found any explanation.


title: Alphabetical sorting of custom post type - one letter per page

text: Basically what I am looking for is a way to sort custom post type in alphabetical order and separate each letter, so you have one letter per page. See illustration. Hopefully there is a plugin or another genious way to do this. Link to illustration -> http://postimg.org/image/5yyhidf7n/


title: wp_mail() is not working on server

text: i am breaking my head from last 1 hour but not getting any idea that what's going wrong with my code... i am developing my own plugin and i am using wp_mail() function for sending mail in that but it's not sending mail it seems. i tried to use PHP Mailer which is working fine but i want to use wp_mail().. this is my code..                 $from = "abc@gmail.com";         $headers[] = "From:" . $from;         $send = wp_mail("myemail@gmail.com", "hiii", "hiiii",$headers);           if($send) {               echo "send";             return false;            } else {                echo $send;             return true;            }      Can any body help me to figure out my mistake... i am testing it on my server only... Thanks in advance


title: Add a special filter link to All Posts in admin

text: I have a featured posts slider on my site's front page. It displays `n` posts (5 right now) from the category `featured`. If I have 5 posts in that category, and publish a 6th, the oldest of the 6 doesn't show up in the slider or below in the list of all recent posts. My solution right now is to go to All Posts > Published > Featured, pick one to un-feature, and go on with my life. I'll take suggestions on a better solution (fix the featured slider is probably a decent response), but what I'm looking for here is a way to add a link to All Posts that will show me all published featured posts. ![enter image description here](http://i.stack.imgur.com/Qk56x.jpg)


title: Upgraded from 2.8.x to 3.3.1 and lost content

text: First of all I did a manual upgrade of the wordpress site. I did everything by the book. I disabled all plugins, did all the backups. I upgraded to the new version, everything went fine. Only that I lost all content. I switched from my custom themes to default one (Twenty Eleven 1.3) still my content seems to be gone. On my php my admin page I SEE my content, they are not lost, just now shown. Question, what do I need to do to make it appear? I did upgrade the database during the install, it seems something went wrong. Please help! Thank you in advance! EDIT1: I added errors after enabling debugging mode. The hungarian text reads: the use of register_sidebar_widget is no longer supported since version 2.8. I beleive this error was there earlier, since I upgraded from version 2.9.x. All help appriciated!               Notice: add_option was called with an argument that is deprecated since version 2.3 with no alternative available. in /mnt/buffer.1/srv/www/laszloerika.hu/wordpress/wp-includes/functions.php on line 3553      Notice: add_option was called with an argument that is deprecated since version 2.3 with no alternative available. in /mnt/buffer.1/srv/www/laszloerika.hu/wordpress/wp-includes/functions.php on line 3553      Notice: add_option was called with an argument that is deprecated since version 2.3 with no alternative available. in /mnt/buffer.1/srv/www/laszloerika.hu/wordpress/wp-includes/functions.php on line 3553      Notice: add_option was called with an argument that is deprecated since version 2.3 with no alternative available. in /mnt/buffer.1/srv/www/laszloerika.hu/wordpress/wp-includes/functions.php on line 3553 Notice: register_sidebar_widget használata nem támogatott a 2.8 verzió óta! Ezt javasoljuk helyette: wp_register_sidebar_widget(). in /mnt/buffer.1/srv/www/laszloerika.hu/wordpress/wp-includes/functions.php on line 3467     Notice: register_sidebar_widget használata nem támogatott a 2.8 verzió óta! Ezt javasoljuk helyette: wp_register_sidebar_widget(). in /mnt/buffer.1/srv/www/laszloerika.hu/wordpress/wp-includes/functions.php on line 3467     Notice: register_sidebar_widget használata nem támogatott a 2.8 verzió óta! Ezt javasoljuk helyette: wp_register_sidebar_widget(). in /mnt/buffer.1/srv/www/laszloerika.hu/wordpress/wp-includes/functions.php on line 3467     Notice: register_sidebar_widget használata nem támogatott a 2.8 verzió óta! Ezt javasoljuk helyette: wp_register_sidebar_widget(). in /mnt/buffer.1/srv/www/laszloerika.hu/wordpress/wp-includes/functions.php on line 3467     Notice: register_widget_control használata nem támogatott a 2.8 verzió óta! Ezt javasoljuk helyette: wp_register_widget_control(). in /mnt/buffer.1/srv/www/laszloerika.hu/wordpress/wp-includes/functions.php on line 3467      EDIT2: I have this after switching to main theme. HOW do I disable widgets, I don't see any active one in the dashboard, I see widgets that can be used, but none active...               Notice: add_option was called with an argument that is deprecated since version 2.3 with no alternative available. in /mnt/buffer.1/srv/www/laszloerika.hu/wordpress/wp-includes/functions.php on line 3553 Notice: add_option was called with an argument that is deprecated since version 2.3 with no alternative available. in /mnt/buffer.1/srv/www/laszloerika.hu/wordpress/wp-includes/functions.php on line 3553               Notice: add_option was called with an argument that is deprecated since version 2.3 with no alternative available. in /mnt/buffer.1/srv/www/laszloerika.hu/wordpress/wp-includes/functions.php on line 3553 Notice: add_option was called with an argument that is deprecated since version 2.3 with no alternative available. in /mnt/buffer.1/srv/www/laszloerika.hu/wordpress/wp-includes/functions.php on line 3553     Notice: register_sidebar_widget használata nem támogatott a 2.8 verzió óta! Ezt javasoljuk helyette: wp_register_sidebar_widget(). in /mnt/buffer.1/srv/www/laszloerika.hu/wordpress/wp-includes/functions.php on line 3467     Notice: register_widget_control használata nem támogatott a 2.8 verzió óta! Ezt javasoljuk helyette: wp_register_widget_control(). in /mnt/buffer.1/srv/www/laszloerika.hu/wordpress/wp-includes/functions.php on line 3467      -----------------Update 3--------------------- One of the plugins were sneaky and turned itself on. I switched it off, no errors. BUT NO CONTENT!!!!!!!!!!!!!!!!!! :(:( What now :D?


title: lists post with current post title IN tag

text: We're starting from two different situations. The main one: I know I should be using pages instead of posts for building my structure, but all the data comes from a site build in java and totally customized. So there are some posts that are the main one in a series, then there are other posts that have the title as a tag (mixed with other tags). There is a 'main' category and 'chapter' category with no parent/child relationship (Should be a relationship between those two?). I want to show those 'child' posts that have the title of the main post in their tag list, and, when I enter in a 'child post' I need the 'parent' one to be listed next to the others. It's a little tricky. Are there any ideas? By know, I get the normal 'related posts', via tags. I need something more 'exact'. :( Thanks!


title: Removing the advanced menu properties

text: As I'm often involved with people who don't know anything about WordPress, a CMS or even the internet :) I try to hide things irrelevant (for them) as much as possible. Normally this would involve removing a meta box here and there, but I have to admit, I'm sort of stuck on the WP menu system. Would anyone know perhaps a way to remove the fields marked in red (picture)? ![enter image description here](http://i.stack.imgur.com/vcSsy.png)


title: Include drafts in internal link dialog

text: Ok, so I'm doing a new project and we're going to be using Wordpress as a magazine CMS. In some cases we'll have a cluster of articles about a topic and it will be natural to link from one article to another. So, here we are in final edit in WP.   We want to add a link from one draft article to another draft article in the cluster, but the target article hasn't been published, so WP doesn't show it in the `Link to Existing Content` box. Sure, I can get the shortlink for the draft of the article I want to link to, but then I need to open that tab, get the shortlink (or the draft's slug), move back to the post that I want to link from, add the link. Doing this occasionally is fine but as a constant task it's crappy workflow. Now, we can simply publish and then hurriedly go through the articles and link things, but that's suboptimal. I can't imagine all of the magazines and other sites that do periodical publishing with WP do that though. I'll play with Editflow to see if it has a way to deal with this, but does anyone know of a way to link from one draft to another and have the link be correct when they're both published? And yes, I know I can link things up after publishing. See 'crappy workflow'.


title: Moving Categories submenu to Media, but still opens Posts menu

text: I'm developing a very media-centered site with WordPress and am using the default categories and tags on uploaded media using, in part this plugin Media Categories. I am displaying a sub-menu item under 'Media' for each 'Categories' and 'Tags' successfully using:               add_media_page( 'Tags', 'Tags', 'edit_posts' , 'edit-tags.php?taxonomy=post_tag');      It is linking through properly, but it seems somewhere in WordPress this page is assigned as a child of the default Posts type, as when I click it, it opens the 'Posts' menu and displays the Tags page, rather than keeping the 'Media' menu opened and displaying it from there. Is there any way to keep the parent page open (i.e. Media)? This isn't an essential fix, but it would be good for the UI and continuity to have the Media menu stay open, rather than swapping to the Posts menu. I can provide screenshots if this is confusing. Thanks! **EDIT** I've just discovered a cheeky little definition in edit-tags.php: `$parent_file = 'edit.php';` It seems each file corresponding to a submenu item in the WP Admin Menu has this $parent_file set. Now obviously, I can simply change this to 'upload.php' to refer to the Media parent, but I'm wondering if there's a non-hacky way that I can modify this value from functions.php in my theme file?


title: Admin Post Update Redirection to Posts Screen

text: Is there a hook I can use that when a post is created or updated it goes back to the list/table page of all the posts. If it is also possible to target a post type as well that would be cracking. It's a really silly request I know and have argued the toss about it but wanted to make sure it was achievable if not very user friendly. Steve


title: Image upload and crop in wordpress

text: I am new to wordpress and buddypress plugin. I want image upload and crop functionality in a new page. How can I do this. I searched over the internet and couldn't able to find a tutorial to do this. In usual way we will find a jquery plugin. Includes the js. includes the css. build the HTML and php script to process the image upload. So my question is is there any simple way to do this or should I use this traditional procedure... Pls help me...


title: Advice on plugin structure

text: I'm looking for a bit of advice on structuring the classes within a plugin I'm writing for my charity website. At the moment the plugin is OOP based with a single class. However, its becoming quite ungainly with a lot of functions in a single file. I'm wondering if it would be better to split out separate aspects into different classes, so for example one class for front end, one for back end and one for when validating options. The difficulty I get into is the best way to call each class and how to handle helper functions. My initial thinking was to have a 'parent' class which would then 'require' the appropriate class depending on a number of checks (such as `is_admin`). My difficulty is what to do with the helper methods and variables. If I put them in the parent class, how would I access them in the child class? Any thoughts would be appreciated.


title: Config file with no Keys..?

text: I'm working on a site for someone that doesn't have any keys in the wp-config file. Isn't this a serious issue? I know I can generate these but I wonder if this will have any side-effects..also, is this currently a security risk because the site had been hacked. Example:               define('AUTH_KEY', 'put your unique phrase here');     define('SECURE_AUTH_KEY', 'put your unique phrase here');     define('LOGGED_IN_KEY', 'put your unique phrase here');     define('NONCE_KEY', 'put your unique phrase here');


title: Obtain page data and use regular loop

text: Is there a way to obtain the data from a certain page outside the regular flow, more efficiently than via `get_post($id)`? I know that I can get for example the title with               $post = get_post($id);     $title = $post->post_title;      But I prefer to use the loop, rather than picking every single page element in the way I described above. So what I want, is to read the entire page data, and then perform a 'regular loop', using `the_title()`, `the_content()`, `the_post_thumbnail()` etc. The reason why I ask this is because I'm busy creating a '404 solution' for my theme, where one is able to create and edit a custom 404 page in the WordPress backend.


title: 3 random images from custom post type, each in a div with a diffrent class

text:
I'm trying to build a loop using query posts to display 3 featured images from the custom post type 'portfolio'. My problem is that each picture has to be in a div with a diffrent class, so i was thinking of tree diffrent loops, but than you have a problem that sometimes a picture is showing two or three times. Also I think it is possible within one loop, i just don't know how. What I have now is:
         <?php query_posts( 'post_type=portfolio&showposts=1' . '&orderby=rand&order=ASC&posts_per_page=-1'); ?>         <?php if (have_posts()) : while (have_posts()) : the_post(); ?>
<?php $featured = wp_get_attachment_image_src( get_post_thumbnail_id( $post->ID ), "Full"); ?>             <img src="<?php bloginfo('template_url');?>/thumb.php?src=<?php echo $featured[0]; ?>&w=360&h=213&zc=1&q=100&" width="360" height="210" data-thumb="<?php bloginfo('template_url');?>/thumb.php?src=<?php echo $featured[0]; ?>&w=360&h=213&zc=1&q=100&" alt="<?php the_title(); ?>" />
         <?php endwhile; endif; ?>         <?php query_posts( 'post_type=portfolio&showposts=1' . '&orderby=rand&order=ASC&posts_per_page=-1'); ?>         <?php if (have_posts()) : while (have_posts()) : the_post(); ?>
<?php $featured = wp_get_attachment_image_src( get_post_thumbnail_id( $post->ID ), "Full"); ?>             <img src="<?php bloginfo('template_url');?>/thumb.php?src=<?php echo $featured[0]; ?>&w=660&h=310&zc=1&q=100&" width="560" height="310" data-thumb="<?php bloginfo('template_url');?>/thumb.php?src=<?php echo $featured[0]; ?>&w=660&h=310&zc=1&q=100&" alt="<?php the_title(); ?>" />
         <?php endwhile; endif; ?>         <?php query_posts( 'post_type=portfolio&showposts=1' . '&orderby=rand&order=ASC&posts_per_page=-1'); ?>         <?php if (have_posts()) : while (have_posts()) : the_post(); ?>
<?php $featured = wp_get_attachment_image_src( get_post_thumbnail_id( $post->ID ), "Full"); ?>             <img src="<?php bloginfo('template_url');?>/thumb.php?src=<?php echo $featured[0]; ?>&w=360&h=213&zc=1&q=100&" width="360" height="210" data-thumb="<?php bloginfo('template_url');?>/thumb.php?src=<?php echo $featured[0]; ?>&w=360&h=213&zc=1&q=100&" alt="<?php the_title(); ?>" />
         <?php endwhile; endif; ?>         <?php wp_reset_query(); ?>
      Is there a way to do this within one loop, and show three diffrent random pictures in the diffrent classes ( first class="pcscreen side left" second class="pcscreen middle" and third class="pcscreen side right" I know it is possible with jquery, now sure how to do it exacly but I prefer doing it within the php loop. Is it possible? and how?


title: Get attributes of nested shortcodes

text: When you've got your shortcodes defined like this:               [myform]         Foo: [mytextbox name="foo"]     [/myform]      And in your php:               function shortcode_myform($atts, $content = null) {        return '<form action="#" method="post">' . do_shortcode($content) . '</form>';     }     add_shortcode('myform','shortcode_myform');          function shortcode_mytextbox($atts) {        return '<input type="text" name="'$atts['name']'" />';     }     add_shortcode('mytextbox','shortcode_mytextbox');      What would be the most elegant way to get the `name` attribute of any children of `myform` attribute inside the `shortcode_myform` function? I figured I could use sessions or globals but that doesn't feel like the right thing to do.


title: woocommerce features to add product along with link

text: I have used woocommerce plugin for this site. Now you can see in the home page all the products are placed. At the top section there is one category named as All Products. In that category you can see there are 5 products with their percentage off, price and the buy now button is made. Now when user will click the buy now user will redirect to the product details page. Now my question is all of the things have been done in hard coding. So can someone kindly tell me how to do this so that admin will get the full feature to control it. Admin will upload all the picture and he will adjust all the price, discount text. So kindly suggest me how to do this? Is there any relevant plugin is available for this? Any help and suggestions will be appreciable. Thanks


title: Help with forms and nonces

text:
I am trying to create a nonce to use with a (public-facing) form. Below is my code:               function my_form() {         if (isset($_POST['submit'])) {               $name = $_POST['name'];         $description = $_POST['description'];         $output_form = false;                  if (wp_verify_nonce($_POST['added'], 'add-item') )             {             //validate             echo 'form submitted with nonce correctly';             }              } else {            $output_form = true;         }         if ($output_form) {         ?>         <form method="post" action="">             <?php wp_nonce_field('add-item','added'); ?>                 Title:
                 <input type="text" name="name" value="<?php echo $name; ?>"/>
                 Description:
                 <textarea name="description" rows="3" cols="10"><?php echo $description; ?></textarea>
                 <input type="submit" name="submit" value="submit">             </form>         <?php         }             }          add_shortcode('PODS FORM', my_form);      I can see my form on my page, but when I submit (and fill it our correctly) instead of seeing my 'correct' message I am only seeing blank page.


title: page template for custom post type

text:
I'm trying to build a debates-like system. It will work like this: A page will display the post with a countdown timer, so user will be able to submit comment till a specific period of time. (this will be the first page users will see) All the comments submitted in that period of time will be displayed in a child page so there the users will be able to see all the comments. And the other page will display some stats from the comments page like best comments(based on votes), poll results from a plugin shortcode. All three pages will contain the same post ( the title, the content). This is how I'm thinking to approach this: As long as the countdown plugin have the option to display other URL after the time is over I can replace the first page after the countdown is over with the page containing the poll results. So by creating three pages in a parent-child relationship this can work. Briefly, each of them will have different additional content ( first page will have a comments section where users will submit a comment, the other page will contain the comments submitted in the first one, and the third one will contain informations from the comments page like the poll results and best comments and also will replace the first page after the countdown is over.) The first page will be the single-{myCPT}.php. Second page which will be a child of the first page getting the comments from it. I will create this first from the dashboard assign it as a child to the first page and use a template for it something like page-{'slug'}.php Third page the same but of course with a different template. I was thinking a lot and this seems the only solution. Is this the way to go ? Or It can be done in a much easier way ? **LATER EDIT:** I've modified the **cpt** with my name and now I'm getting this:               Fatal error: Call to undefined function wpse121567_get_cpt_hierarchy()       SNIPPET FROM MY single-cpt.php:
                         <?php if ( 'debate-parent' == wpse121567_get_cpt_hierarchy() ) {         // Normal loop here         if ( have_posts() ) : while ( have_posts() ) : the_post();              get_template_part( 'inc/post-format/single', get_post_format() );          endwhile; endif;     }      // Child CPT     else if ( 'debate-child' == wpse121567_get_cpt_hierarchy() ) {         // Globalize post object         global $post;              // Output Parent CPT title and content         $parent = get_post( $post->post_parent );         echo '
' . $parent->post_title . '
';         echo '
' . apply_filters( 'the_content', $parent->post_content ) . '
';              // Fetch parent CPT comments         $parent_cpt_comments = get_comments( array(             'post_id' => $post->post_parent,             'status' => 'approve'         ) );         // Loop through parent CPT comments         foreach ( $parent_cpt_comments as $comment ) {             // Output comment list markup here         }     }     // Grandchild CPT     else if ( 'debate-grandchild' == wpse121567_get_cpt_hierarchy() ) {         // Comment Stats code goes here               ?>              <?php                        $enable_rtl         = of_get_option('enable_rtl', false);                            if(!of_get_option('disable_pagination')){                      if($enable_rtl){                          $next_post = get_adjacent_post( false, '', true );                           $prev_post = get_adjacent_post( false, '', false );                       }else{                          $next_post = get_adjacent_post( false, '', false );                           $prev_post = get_adjacent_post( false, '', true );                       }                      ?>                      <?php                  }                        // show related posts by tag              if(!of_get_option('disable_related_posts')){                   get_template_part( 'inc/related-posts' );              }                                  // If comments are open or we have at least one comment, load up the default comment template provided by Wordpress              if ( comments_open()  )                  comments_template( '', true );                     }else{ // Well, if there are no posts to display and loop through, let's apologize to the reader (also your 404 error) ?>

<?php _e('Page not found', 'outbox'); ?>

                    <?php } // OK, I think that takes care of both scenarios (having a post or not having a post to show) ?>


title: Mysterious HTTP 404 header in my own scripts

text: I have a WordPress 3.5.1 + nginx configuration. Its nginx configuration is this:               server {         root /mysite/public_html;         server_name wp.mysite;         location / {             try_files $uri $uri/ /index.php;             index index.php index.html index.htm;         }         location ~ \.php(.*)$ {             try_files $uri =404;             include /etc/nginx/fastcgi_params;             if ($uri !~ "^/uploads/") {                     fastcgi_pass unix:/var/run/php-fastcgi/php-fastcgi.socket;             }             fastcgi_pass unix:/var/run/php-fastcgi/php-fastcgi.socket;             fastcgi_index index.php;             fastcgi_param SCRIPT_FILENAME /mysite/public_html$fastcgi_script_name;         }     }      Note that WordPress's `index.php` is in `/mysite/public_html/`. I'm also using nginx helper. Since I'm only running a single site, I only used its permalink beautify function. I noticed that my custom scripts (outside of WordPress) are returning 404 headers. For instance, if I put `index.php` into `/mysite/public_html/my/`, and point browser to `http://wp.mysite/my/`, the script will execute okay, even with correct MIME type, but with an HTTP 404 header. Putting `header("Status: 200 OK");` (for fastcgi) won't work. In fact, it seems to ignore other headers such as `Cache-Control` and `Expires` as well. It did pick up `Content-type` header as I mentioned earlier. In fact, its header part is:               $sapi_type = php_sapi_name();     if (substr($sapi_type, 0, 3) == 'cgi')         header("Status: 200 OK");     else         header("HTTP/1.1 200 OK");     header("Cache-Control: no-cache, must-revalidate"); // HTTP/1.1     header("Expires: Sat, 26 Jul 1997 05:00:00 GMT"); // Date in the past     header("Content-type: image/jpeg");     imagejpeg($this->im, null, 80);      I can see the JPEG alright. But no other headers are sent. I'm wondering where do I start to debug this problem? Thank you.


title: Get a list of post titles and links from yootheme master theme

text:
Hi I am using the yootheme master collection and I wish to get a list of 10 permalinks from this custom post catagory but at the moment I can only get 1 to show. How do I do this properly? Cheers
               <?php if (have_posts()) : ?>              <?php if (is_category()) : ?>             <?php /*
Archive for the ‘<?php single_cat_title(); ?>’ Category
 */ ?>         <?php elseif (is_tag()) : ?>
<?php printf(__('Posts Tagged %s', 'warp'), '‘'.single_tag_title('', false).'’'); ?>
         <?php elseif (is_day()) : ?>
<?php printf(__('Archive for %s', 'warp'), get_the_date()); ?>
         <?php elseif (is_month()) : ?>
<?php printf(__('Archive for %s', 'warp'), get_the_date('F, Y')); ?>
         <?php elseif (is_year()) : ?>
<?php printf(__('Archive for %s', 'warp'), get_the_date('Y')); ?>
         <?php elseif (is_author()) : ?>
<?php _e('Author Archive', 'warp'); ?>
         <?php elseif (isset($_GET['paged']) && !empty($_GET['paged'])) : ?>
<?php _e('Blog Archives', 'warp'); ?>
         <?php endif; ?>                   <?php $currentid = get_the_id(); ?>
<a href="<?php the_permalink(); ?>"><?php echo get_the_title($currentid); ?>
                         <?php else : ?>              <?php if (is_category()) : ?>
<?php printf(__("Sorry, but there aren't any posts in the %s category yet.", "warp"), single_cat_title('', false)); ?>
         <?php elseif (is_date()) : ?>
<?php _e("Sorry, but there aren't any posts with this date.", "warp"); ?>
         <?php elseif (is_author()) : ?>             <?php $userdata = get_userdatabylogin(get_query_var('author_name')); ?>
<?php printf(__("Sorry, but there aren't any posts by %s yet.", "warp"), $userdata->display_name); ?>
         <?php else : ?>
<?php _e("No posts found.", "warp"); ?>
         <?php endif; ?>              <?php get_search_form(); ?>          <?php endif; ?>      <?wp_reset_query();             ?>


title: How to add Wrapper Div/container element around Wordpress Widget Content

text:
I want to apply style to widget content of Wordpress but I see widget Content area is not having uniform class. TextWidget are having class "textwidget" and that is uniform but other widgets are having "ul" as element for example and class is also different there. Can I add any wrapper Or a particular Class around content part of every widget in Wordpress? I got this:               function my_widget_content_wrap($content) {         $content = '
'.$content.'
';         return $content;     }     add_filter('widget_text', 'my_widget_content_wrap');       but it only works for textwidget which I do not need.


title: Query current and future events, ordered by begin date

text: Using the Custom Post Type UI extension, I've created a 'Event' custom post- type, which fields are populated using custom fields (created with the extension Advanced Custom Fields) such as 'date-debut' and 'date-fin'. On an archive page dedicated to this post-type, I'm trying to display the 10 next (current or future) events, ordered chronologically by beginning date. The sorting part seems to be OK by itself; but it doesn't work anymore when I add the tests on dates, and anyway those don't work either. Here is my code:                       $current_date = date('ymd');             $my_query = new WP_Query( array (              'post_type'         => 'mna_event',             'posts_per_page'    => 10,             'orderby'           => 'meta_value_num',             'meta_key'          => 'date_debut',             'order'             => 'ASC',             'meta_query'        => array (                 'relation'      => 'OR',                 array (                     'key'       => 'date_debut',                     'value'     => $current_date,                     'compare'   => '>='                     ),                 array (                     'key'       => 'date_fin',                     'value'     => $current_date,                     'compare'   => '>='                     )                 )             )         );      Advice on the matter would be very much appreciated. Thanks


title: Security - Ajax and Nonce use

text: I'm developing a site which posts a number of ajax calls from jquery to PHP and returns data from PhP to jquery. Everything is working, but i'd to know if my approach to handling the calls is ok, in regard to security. To run through my process; **functions.php file**   1. Setup wp_localize_script() & passed it the variables for ajax url and nonce -                wp_localize_script( 'main', 'WP', array(           'AJAX_URL' => admin_url( 'admin-ajax.php'),           'NONCE' => wp_create_nonce( 'ajax_custom_nonce' )       ));       **myscript.js file**   1. In my js file i've sent my post request using jquery;              $.ajax({         type : "post",         url: WP.AJAX_URL,         data: ({action : 'request_handler',              id : 'content_id',                nonce : WP.NONCE }),         success: function(data) {}     })      **ajax.php file**   1. ajax.php file receives ajax post, calls request_handler();              add_action("wp_ajax_nopriv_request_handler", "request_handler");     add_action("wp_ajax_request_handler", "request_handler");        2. request_handler() checks nonce, gets post id & runs switch statement to call required function.               function request_handler() {           // check the nonce          $nonce = $_POST['nonce'];               if ( ! wp_verify_nonce( $nonce, 'ajax_custom_nonce' ) )               die ('busted');              $id = $_POST['id'];               switch ($id) {             case 'vimeo_embed':                 // run vimeo();                break;              case 'popup':                   require_once(TEMPLATEPATH . '/library/popup.php');                  load_popup();             break;                  ....etc         }      }


title: Multiple post categories - single permalink

text: I created a post which is assigned to multiple categories. Eg: I have a post "My Post", and I put it in " _foo_ " and " _bar_ " categories.   Now my article will have two permalinks, " _/foo/my-post_ " and " _/bar/my- post_ ".   Google calls this a duplicate, which it considers to be spam, hence this is not what I want. How can I use multiple categories but have the same permalink?   I want this only for SEO. My current permalink structure is `/%category%/%post_id%-%postname%.html`


title: wp_get_attachment_link filter not working

text: I'm trying to modify all image attachment links to include a rel value thus:               add_filter( 'wp_get_attachment_link', 'my_prettyadd', 100, 6);          function my_prettyadd( $markup, $id, $size, $permalink, $icon, $text ) {         $content = preg_replace("/<a/","<a rel=\"prettyPhoto[slides]\"",$markup,1);         return $content;     }      This has worked fine for me for ages, but recent installation of WP have meant this fails in so far that the function is never called (I placed an exit; line in there and it has no effect. I know that my theme does not use wp_get_attachment_link and so I'm suspecting I'm barking up the wrong tree now. I'm using Canvas by WooThemes - I don't know if they have done anything out of the ordinary with attachments in posts. Anything obviously wrong in what I"m doing?


title: WordPress comments work locally only?

text: Here's my issue:   * on localhost: comments just work for both registered & logged in users AND for guests,   * live (on-line): comments work only for registered & logged in users, comments posted by guests are "disappearing" on the way, they're not being shown under "Comments" in wp-admin, and after posting them browser scrolls all the way top instead focusing on newly added comment to approve. Of course I have "Users must be registered and logged in to comment" unchecked. Is it possible there's some issue with my server configuration? I'm using a custom theme, but the comment system is exactly the same as in other themes from twenty* line.


title: How to add meta description, keywords, custom title to a category template

text: I use custom category templates for a few of my categories. Ex: cat-12.php and so on. I use the Fv Simpler Seo and presently it doesnt seem to support an option to edit category templates. Considering that I use custom category templates, is there a function or a way I include custom meta description and custom title (over riding the default category name that is picked up as the title) without having to use a plugin?


title: Is there a way to add a function that will get run after a blog is created?

text: Is there a way to have a function run after a blog is created in WP MU? I think I would need to add a filter or something but I'm not as familiar with the procedure. Do I set something up like this:               EXAMPLE!!!     add_filter('new_blog_created', 'my_function');               function my_function() {         // do something     }      So far I'm calling `wpmu_create_blog()` to create a new blog successfully if that helps. Here is my code which is inside a function:               function create_site() {         // some code         $meta = apply_filters( 'add_signup_meta', $meta );              $result = wpmu_create_blog( $domain, $path, $blog_title, $current_user->ID, $meta, $wpdb->siteid );          }


title: Wordpress Image Resize fails without Error Message

text: I wonder why resizing a jpeg image fails in Wordpress without throwing a PHP Error with memory_limit error or Filesize Error. The image is 2MB big jpeg with RGB colorspace. Dimensions 4496x4496 (16Megapixel Camera) A user uploaded it in his profile and since then the user doesn't appear in the Users section anymore. The HTML output just stops at the point the user would come next. The server runs only with GD and not Imagick. Server throws a 500 Error Code on upload in Medialibrary, but in the Userprofile the page just goes blank white. Menu still there but Userprofile is unusable. Does anybody have a clue?


title: Taxonomy archive + query attachments = duplicate results

text:
I'm trying to get the attachments of a specific term (in its archive page). But the results are showing the resulting images 5 times instead of one. I have multiple loops in this page - one to show related posts, another to show related products (custom post), and this one to show related images. Custom posts and posts are working nicely, but I can't show the attachments in the right way. :S               <?php $queried_object = get_queried_object();     $term_id = $queried_object->term_id;           $args = array(     'post_status' => 'inherit',     'numberposts' => 0,     'post__not_in' => array_merge($do_not_duplicate,get_option( 'sticky_posts' )),     'post_type' => 'attachment',     );          $args['tax_query'] = array(     array(         'taxonomy' => 't-arte',         'terms' => $term_id,         'field' => 'id',     ),     ); ?>          <?php $t = $data['t-arte'];     $array = explode(" ", $t);     $array = array_unique($array);?>          <?php $media_query = array_unique($array); ?>          <?php $media_query = get_posts($args);     if( !empty( $media_query ) ) :     foreach ($media_query as $media_query) :     global $post; $post = $media_query;     setup_postdata($media_query);     ?>
             <?php $attachments = get_posts( $args );                      if ( $attachments ) {                         foreach ( $attachments as $attachment ) {                            echo '
';                            the_attachment_link( $attachment->ID, true );                            echo '
';                            }                      }?>
          <?php endforeach;else :?>
Ainda não temos nenhuma imagem relacionada :(

          <?php endif; ?>         <?php wp_reset_query();?>


title: Use different post formats on different post types

text: I added post-formats support like below.               add_theme_support( 'post-formats', array( 'gallery', 'link', 'quote', 'audio', 'video' ) );      I also added post-formats support to custom post type like below.               add_post_type_support( 'my-custom-post-type', 'post-formats' );      My question is: Is it possible to use different post formats on regular posts and custom post type? For example, using 'gallery', 'link', 'quote', 'audio', 'video' on regular posts, and only 'gallery', 'video' on custom post type.


title: Problem retriving the post type category

text: I have a small isuue, this code retrive me the parent categories from a post type. The post_type is : serial The taxonomy is : seriale               <?php      $terms = get_terms('seriale','child_of=668');foreach ($terms as $term) {echo ''.$term->name.'';}     ?>      The problem is: after i added another post in my site it my theme it aprear on all duplicate. EX: First post - i select Year 2011 Second post - i select Year 2012 In archive it retrive me for the first and second post... :2011,2012 ... I want to be able to get only wath i select... I want to get categories only for child_of=668 Wath im doing rong. Thanks


title: Multiple, Dynamic, Sidebars Problem - First Sidebar not working properly

text:
This is my function:               function ec_register_sidebars() {      register_sidebars( 3,          array(          'name' => 'Sidebar %d',          'id' => "sidebar-$i",          'before_widget' => '
',          'after_widget' => '
',          'before_title' => '',          'after_title' => ''          )      );       This **does not work** :               <?php if ( is_active_sidebar( 'Sidebar 1' ) ) : ?>      <?php dynamic_sidebar( 'Sidebar 1' ); ?>          <?php else : ?>          No primary sidebar content      <?php endif; ?>      **BUT** if I change the *is_active_sidebar* to 'Sidebar 2' or 'Sidebar 3', it works. For example, **this works** :               <?php if ( is_active_sidebar( 'Sidebar 2' ) ) : ?>      <?php dynamic_sidebar( 'Sidebar 1' ); ?>          <?php else : ?>          No primary sidebar content      <?php endif; ?>      I don't understand why this is. Any ideas?


title: Getting Wordpress custom taxonomy/category?

text: Well, I'm using my own taxonomy for custom post type. It looks like this:               register_taxonomy("our_gallery", array("gallery"), array("hierarchical" => true, "label" => "Types", "singular_label" => "Type", "rewrite" => true));      I have created a few "types"/categories in my admin panel like "Black and white", "Landscapes" and so forth... Anyways I can't figure out how to get these categories out? I mean - display them on my gallery page just next to gallery items? I've tried:                 <?php $cat = get_the_category();         var_dump($cat); ?>      And it displays an empty array - "array(0) { }". How to get access to my own categories? get_the_category('our gallery') and ('gallery') also gives an empty array... Thanks a lot :)


title: Plugin access to average users not only admin

text: I'm new to plugin writing, but intermediate in theme making. I wonder if it is possible to write a plugin, to add addition functionality for users, who don't have admin status. Can I give them permission for upload images and so on? Can I write a plugin, what help no admin users upload and manage their images, and some personal texts?


title: How to automatically generate custom menu item from categories?

text: I would like to display all my category items under a single parent but I failed to do so now I'm creating a new menu link for each category and dragging it into place in the custom menu screen. Is there an easier and automatic way of doing this?


title: Should new posts already have tags?

text: When creating a new post on one of my multi sites post tags have automatically been added. This happens to some users on specific sites only. Has anyone seen this before?


title: Visual / HTML tabs vanished on editor

text: The Visual / HTML tabs have vanished on the editor on posts and pages. I'm not sure when this happened, but I've tried deactivating my plugins with no joy. Any ideas? Thanks, Lucy


title: How to create some sort of word mapping?

text: I would like to know how I could create a file in which I could associate a word in multiple languages. Let's make an example in XML:               <item key="goodMorning>         <copy lang="en">Good morning<copy>         <copy lang="fr">Bon matin<copy>         <copy lang="nl">Goedemorgen<copy>     </item>      Is there such a file, or many files, that would be available for me to output a certain string to the front end according to the language? (It doesn't have to be XML at all, as long as it works in Wordpress). This info (http://wpml.org/documentation/getting-started-guide/language- setup/custom-language-switcher/) allows me to get what is the current language, but I'd like to act accordingly. I already use the WPML (paid) plugin, I asked the question over there as well, to no avail so far. If anyone could help, it'd be appreciated.


title: wp-admin does not redirect to dashboard

text: I have a weird problem, which I could not solve yet. I installed wordpress 3.4.1 and made an own template. I use one plugin - qTranslate. Everything is fine on my local copy and also on my dev copy dev.mysite.cz. When I copied wordpress and log in on the main site, http://www.mysite.cz, the dashboard does not show up. Instead I only get the homesite with the administration panel on top of the page. The only difference I can so far tell is in the wp-config.php file. In production mode I have this two more directives in it:               /** debugging mode */     define('WP_DEBUG', false);          /** Localisation */     define('WPLANG', 'cs_CZ');      Any advice will be very appriciated. Thanks


title: Protecting against malicious code in Wordpress plugin updates

text: One of the most popular Wordpress plugins listed on the Wordpress plugins database got malicious code injected into it recently (April 2013): http://blog.sucuri.net/2013/04/wordpress-plugin-social-media-widget.html A similar thing happened in 2011: http://blog.sucuri.net/2011/06/wordpress- plugins-hacked-understanding-the-backdoor.html How do I protect against updating my Wordpress sites with the latest of the plugins and being done with it? Are there any security bulletins that I could subscribe to that list these latest compromises and when patches come out?


title: Radio button problem using subtitles and mandatory field check

text: I have a problem with a WordPress website using radio buttons. At the moment, there are 6 radio buttons, divided in 3 groups: group of 3, group of 2 and group of 1. The groups have been made like this, because each group required a subtitle in front (in our context, it's a separation between youth, adults and competition playing). Putting all radio buttons in the same group doesn't allow putting the subtitles between the radio buttons. But having the 3 groups doesn't allow us to enforce a control at registration to check if one of the three groups has been selected, as one of the 6 radio buttons should be selected (as in mandatory). Has anyone a workaround to either: enable mandatory field check for the 6 radio buttons separated in 3 groups or a solution to put all radio buttons in one group, so mandatory field check is a breeze.


title: Widgets: Show Recent Posts Only if the Posts Have Both Categories X and Y

text: I've been trying to create a Recent Post widget where it only show/display posts that have both categories X and Y (or more). The categories X and Y is user-defined, so I'm planning to make it look like this: ![enter image description here](http://i.stack.imgur.com/2ruXQ.png) In fact, that picture is an actual screenshot from what I have managed to create. It is working fine if I select only from one category. It would show all posts which have the category of X (or X's children). However, if I add one more category, it would stop working--instead, the widget would show all recent posts regardless of categories. ![enter image description here](http://i.stack.imgur.com/h46yH.png) For creating this code, basically I copied the `widget_recent_posts` class from `default-widget.php` and add a field for ID input. It utilizes `WP_query` to query the posts and `category__and` to select the post:               $r = new WP_Query( apply_filters( 'widget_posts_args', array( 'posts_per_page' => $number, 'no_found_rows' => true, 'post_status' => 'publish', 'category__and' => array($category_name), 'ignore_sticky_posts' => true ) ) );      What I have created so far (the full class) is available here: http://codepad.org/yf1ZFAt5 I'd be really thankful if anyone could hep me, as I have been messing around with this one for hours but haven't managed to tackle it. :s


title: wp_generate_attachment_metadata(), display image content after post, why?

text:
I succeed to upload and attach an image for an article created in frontend in wordpress, otherwise when I used the wp_generate_attachment_metadata() after the generation I have something like that :               �PNG  IHDR��<q� IDATx���w�%�u�����{�}��IA$(QL&iR����)[a%J���^����|����G^�u��ʒ쵨d[�LS��3��D�`��ͼ|�����?���t��$e�m�|���+�:�wN�V�}� ��xB��㝣..      Here is my code :               echo'<form method="post" action="'.bp_displayed_user_domain().'/article/" enctype="multipart/form-data">
Titre         <input type="text" name="title" id="title" value="" />

Article         <textarea name="content" id="content" rows="10" cols="50"></textarea>

Mots clés         <input type="text" name="keywords" id="keywords" value="" />          ( séparez les mots clés par des virgules )

<input type="file" name="image" />

<input type="submit" name="submit" value="Ajouter" />
     </form>';          if(isset($_POST['submit'])){         global $wpdb, $bp;         $err = array();         $err['status'] = true;         $output = "";              if(empty($_POST['title'])){             $err['status'] = false;             $err['msg'][] = 'Le champ "Titre" ne peut être vide.';         }         if(empty($_POST['content'])){                 $err['status'] = false;                 $err['msg'][] = 'Le champ "Article" ne peut être vide.';         }              $author_id = $bp->displayed_user->id;         $insert = array(             'post_status' => 'pending',             'post_title' => htmlentities($_POST['title']),             'post_content' => htmlentities($_POST['content']),             'post_author' => $author_id,         );              $insert_post = wp_insert_post($insert);         $post_id = wp_get_recent_posts($args, $output);         $id_post = $post_id[0]->ID;              if(!function_exists('wp_handle_upload')) {             require_once( ABSPATH . 'wp-admin/includes/file.php' );             $uploadedfile = $_FILES['image'];             $upload_overrides = array('test_form' => false);             $movefile = wp_handle_upload($uploadedfile, $upload_overrides);         }         if($movefile) {             echo "File is valid, and was successfully uploaded.\n";         } else {             echo "Possible file upload attack!\n";         }              $args = array(             'post_title' => $_FILES['image']['name'],             'post_name'  => $_FILES['image']['name'],             'post_type'     => 'revision',             'post_author'   => $author_id,             'post_status'   => 'inherit',             'post_mime_type'=> $_FILES['image']['type']         );              $filename = $movefile['url'];         $parent_post_id = $id_post;         $filetype = wp_check_filetype(basename($filename),null);         $wp_upload_dir = wp_upload_dir();              $attachment = array(             'guid'           => $wp_upload_dir['url'] . '/' . basename($filename),              'post_mime_type' => $filetype['type'],             'post_title'     => preg_replace( '/\.[^.]+$/', '', basename($filename)),             'post_content'   => '',             'post_status'    => 'inherit'         );              $attach_id = wp_insert_attachment($attachment,$filename,$parent_post_id);         require_once( ABSPATH . 'wp-admin/includes/image.php' );         require_once( ABSPATH . 'wp-includes/post.php' );              $attach_data = wp_generate_attachment_metadata($attach_id,$filename);         wp_update_attachment_metadata($attach_id, $attach_data);         set_post_thumbnail($id_post,$attach_id);     }      Can you explain me why, i've such the image content ? displayed ? Please help me. Best regards


title: wp_insert_term - parent & child problem

text: I have a car database that I want to import into Wordpress as taxonomies. The problem is I can't create 2 taxonomies at once (first is parent, last ones are childs of first).               $p = wp_insert_term("Acura", "classified-category", array("description" => "Acura"));     $c = wp_insert_term("Acura CL", "classified-category", array("parent" => $p["term_id"], "description" => "Acura CL"));     print_r($p);     print_r($c);      returns:               Array ( [term_id] => 13 [term_taxonomy_id] => 4720 )      Array ( [term_id] => 2589 [term_taxonomy_id] => 4721 )       But in Dashboard appears just parent category. The problem is similar to this one: Create two categories at once (parent > child) Any idea ?


title: post to subcategory and parent in wp_insert_post

text:
this code works fine. the problem i have is that when i submit it only checks the parent category not the subcategory even though i specified both a parent and a subcategory. please. what am i doing wrong. ohh if you look in the html chunk, the `7` is parent cat and the numbers after the comma are the subcategories.                  <?php      if(isset($_POST['new_post']) == '1') {         $post_title = $_POST['post_title'];         $post_category = $_POST['cat'];         $post_content = $_POST['post_content'];         $new_post = array(               'ID' => '',               'post_author' => $user->ID,                'post_content' => $post_content,               'post_title' => $post_title,               'post_status' => 'publish',               'post_category' => array($post_category)                  );              $post_id = wp_insert_post($new_post);              // This will redirect you to the newly created post         $post = get_post($post_id);         wp_redirect($post->guid);     }           ?>      this is the `html`               <form method="post" action="" name="" onsubmit="return checkformf(this);">               <input type="text" name="post_title" size="45" id="input-title"/>          <textarea rows="5" name="post_content" cols="66" id="text-desc"></textarea>

<select name='cat' id='cat' class='postform' >          <option class="level-0" value="7,95">child cat1</option>          <option class="level-0" value="7,100">child cat2</option>          <option class="level-0" value="7,101">child cat3</option>          <option class="level-0" value="7,94">child cat4</option>      </select>
          <input type="hidden" name="new_post" value="1"/>           <input class="subput" type="submit" name="submitpost" value="Post"/>                </form>      please let me know if you need more information. thanks in advance


title: Fatal error with Ultimate Coupon plugin

text: When I try to activate the plugin Ultimate Coupon I get this error: > Fatal error: Cannot redeclare like_content() (previously declared in > /hermes/bosoraweb056/b557/ipg.ssgirlfriendscom/wordpress/wp- > content/plugins/ultimate-coupon-feed/ucfeed.php:3983) in > /hermes/bosoraweb056/b557/ipg.ssgirlfriendscom/wordpress/wp- > content/plugins/Premium Coupon Plugin/ucfeed.php on line 3993 What can I do?


title: How do I show current post content in the header?

text: I'm trying to add the post content in the header but for some reason it doesn't show anything. However it does retrieve the post content. I wrote this:               <div <?php post_class() ?> id="post-<?php the_ID(); ?>">     <?php the_title(); ?>     <?php the_content(); ?>      I tried and and none showed anything... Is there any way I can archive this? I really need it for the site's navigation. Thanks


title: Understanding how links will work when DNS changed to point to new WordPress site

text: Please can someone help me to clarify what issues i might have when the hosting company changes the DNS settings to point away for the current old site (basic html) and to the new WordPress version of the web site? Both sites are with the same hosting company (I cannot change hosts or hosting names now, my client and the hosting company are long term business partners). I think the server that the current live website is unable to host WordPress. So they set up another server for WordPress and called it something completely different. Old website address _http://www.therealwebsitename.co.uk_ Current Location of new WordPress site on hosting server: _http://test.blahsystems.co.uk_ I think this bit is important!! The new website is on a Windows Server and uses pretty perma links and also the .html pages plugin. There are also some redirects going to 7 pages on the old site. Everything is currently working ok. Next week the hosting company are going to change the DNS settings to point to the new website _http://test.blahsystems.co.uk_ which will then hopefully become the live site with the new address of _http://www.therealwebsitename.co.uk_ The hosting company have also said that I should not have used Permalinks at the moment because once the DNS is pointed to the new site the links will have become permanent (well I had already set up permalinks before they told me). I have not used the full address when making any links within the site. Will the 'Find & Replace' plug-in on the database still work ok to make any required changes? I am confused as to how the DNS change actually works, will this affect what the links are called in the database or can I still change them from: _http://test.blahsystems.co.uk_ to _http://www.therealwebsitename.co.uk_ I presume I will need to change the Word Press address and site address in the settings panel to _http://www.therealwebsitename.co.uk_ once the DNS propagation has finished. Very long winded I know but any help would be much appreciated. Thanks


title: How do I let contributors edit their posts after being approved once?

text: As above Background info   Main problem: users pay to post an ad on the website Solution: they sign up as contributors and I publish their posts once the payment is received, after that they can make any edit to their posts


title: Heterogeneous content on a page

text: I am a newbie but I have experience with other cms systems. Let's say we have a page called Paper Airplane Instrucutions and my client wants to add some text, a picture, some more text, and then a photo gallery on the page. Then we create another page called Paper Hat Instructions and the client wants to add just text and a video. I want both pages to use the same template. But I want my client to easily add these different types of content using either posts with custom post types or some other method. In my cms, I created custom components, a text component, a video component, a gallery component, that clients can add and configure and stack on top of each other like legos to construct a web page with these different content blocks. They can reorder the blocks if they want. Then they can create another page and add blocks to that page but perhaps in a different order. Can someone advise me on a plugin or strategy to accomplish this? Thanks!


title: Plugins won't auto-update on IIS

text: Using IIS 6 on XP Server '03, using WP 3.2.1, when I attempt to use the auto- update for my plugins, I receive this message: > The update process is starting. This process may take a while on some hosts, > so please be patient. > > Enabling Maintenance mode… > > Updating Plugin [Plugin Name] (1/1) Downloading update from > http://downloads.wordpress.org/plugin/polldaddy.2.0.10.zip… > >> Unpacking the update…   >  Installing the latest version…   >  Removing the old version of the plugin…   >  Plugin update failed.   >  An error occurred while updating [Plugin Name]: Could not create directory.   >  C:/Inetpub/wwwroot/wp-content/plugins/polldaddy/ > > Disabling Maintenance mode… > > All updates have been completed. When I go to delete a plugin through the WP interface, it removes the plugin from the " _Installed Plugins_ " list; however, when I navigate to the directory on the server, I still see the plugin folder in the wp-content folder and I can't open it or delete it. Says, " _Access is denied_ ". I don't have any troubles installing new plugins via the WP " _Install Plugins_ " web interface. I've set the `IUSR` & `IIS_WPG` accounts with full control on the wp-content folder and it cascades the permissions down to the other folders. So when I update, it should have the rights to remove/update plugin files. The weirdest thing to me is if I restart IIS (`iisreset`), I'm able to auto- update via the web interface just fine & I am then able to delete the "removed" plugin folder that said "Access is denied". This is frustrating as I don't have time to always stop what I'm doing to reset IIS & wait on it to start back up again. Any ideas?


title: Add Meta Box not showing on New Post - Custom meta box not showing

text:
This issue has plagued me over a couple projects. I used the default Wordpress class-based template provided in the Codex to start, and built outward. The only issue I face is that my custom meta boxes will not show when creating a new post (add post). This is usually in conjunction with custom post types, but as the code from the Wordpress demonstrates, it occurs with just a regular meta box. What needs to be done to ensure this will display when clicking 'Add New Post'?               <?php     /*     Plugin Name: TestPlug     Description: Blank     Author: No One     Version: 1.0     */     function call_someClass() {      return new someClass();     }     if ( is_admin() ) add_action( 'load-post.php', 'call_someClass' );          class someClass {         public function __construct()         {             add_action( 'add_meta_boxes', array( &$this, 'add_some_meta_box' ) );         }              public function add_some_meta_box()         {             add_meta_box(                  'some_meta_box_name'                 ,'Some Meta Box Headline'                 ,array( &$this, 'render_meta_box_content' )                 ,'post'                 ,'advanced'                 ,'high'             );         }              public function render_meta_box_content()         {             echo '
TEST OUTPUT - this gets rendered inside the meta box.
';         }     }     ?>


title: Strange error "You do not have sufficient permissions to access this page"

text: I've tried for days to figure this out, with countless research hours involved. I've exhausted reviews of other threads on here and on Google with no luck.               /wp-admin/update-core.php      Currently at Wordpress v3.6.1, and attempting to upgrade (if it would let me). This file produces the error. I've tried...   * Overwriting the core   * Disabling plugins   * Tweaking values of capabilities columns Nothing works. I've even tried creating new administrator accounts and I still cannot get around this error. Here's what my admin capabilities looks like for one of the admin users:               wp_capabilities      a:1:{s:13:"administrator";b:1;}     wp_user_level        10      That is what a freshly created admin user looks like. The issue is not logging in. The issue is that once logged in, I cannot see any upgrade options for Wordpress core or any plugins. It's like the "upgrade" capability has completely vanished for some reason. This is what shows under "Plugins" in the admin: ![Plugins left nav](http://i.stack.imgur.com/RaL4a.png) This is what I get when manually trying to browse to update the core at `/wp- admin/update-core.php`: ![Attempting to update core](http://i.stack.imgur.com/SfmXL.png) Seriously ready to pull my hair out guys. Never seen this one up close and personal like this. Totally new to me, and I deal almost exclusively with Wordpress.


title: Notification when left menu bar is closed?

text: How to get a notification via Javascript when the left menu bar has been collapsed ? I was looking everywhere in the net but there is zero out there... thanks! update: somebody asked what the left menu bar in Wordpress is : the left menu bar is on the left side. the last button is 'collapse menu'. all i need is a notification when the user changed the collapse state.


title: How to hook in to bulk trash posts

text: I am trying to hook into the trash post function in the bulk menu. I've managed to hook into an item when I trash it by it self by using the `wp_trash_post` hook, but this does not work when doing it in bulk. Does anyone know how I can do this?


title: Remove the Publish metabox for custom post type

text: I have a custom post type for events, and I wish to remove the Publish/Visibility options from the side as they are not relevant to the user. Is there a way to do so?


title: Magazine style frontpage with multiple categories/loops and no duplicate posts

text: I am migrating a static magazine site to wordpress. I would like to have a frontpage displaying multiple categories with a few posts in each, e.g "politics", "environment", "health" and "technology". On top of that I would like to have a "latest news" category. The posts displayed in the "latest news" category will also belong to another category (and child category e.g poltics-->asia-->india) and show up on a page with posts only from the specific category (e.g a "politics" page), but they cannot be duplicate posts on the frontpage as long as they show in the "latest news" category. The categories would be displayed in a grid magazine type design. An example of what I am trying to accomplish is this site, a well-known pirate party blog. Can someone point me in the right direction how I would accomplish this? Basically I would need to be able to have maybe ten loops in the same page, without any duplicate posts. Very grateful for any help.


title: Pagination with custom post types results in 404 issues

text:
I've a very simple `index.php`:
       <? get_template_part('content', get_post_format()) ?>

       <? previous_posts_link() ?>       <? next_posts_link() ?>
      And my `content.php` looks roughly like this:               <?     $paged = get_query_var('paged') ? get_query_var('paged') : 1;     query_posts([       'post_type' => ['articles', 'projects', 'tips'],       'orderby' => 'date',       'posts_per_page' => 7,       'paged' => $paged     ]);     ?>          <? while(have_posts()): the_post() ?>

<? the_title() ?>

<? the_excerpt() ?>

           <? foreach($categories as $cat): ?>
<?= $cat->name ?>
           <? endforeach ?>

     <? endwhile ?>      There are 14 posts in total but the "next" posts is always redirecting to a 404 on `/page/2` instead of showing the remaining 7 posts. **Edit:** If I use a custom `WP_Query` instead of `query_posts` then the next and previous links won't even show. https://gist.github.com/elclanrs/4782705 I've been trying to find a solution to this issue since yesterday. I'm aware of all the other questions similar to this one, but for my particular set-up none of the solutions I found worked, including:   * http://wordpress.org/support/topic/pagination-with-custom-post-type-listing   * http://www.rjust.com/2011/03/22/fix-previous_posts_link-and-next_posts_link-for-custom-post-types/   * Make sure that "Blog pages show at most" matches `posts_per_page` I'm also aware of `pre_get_posts` but I would like to know what's the problem with my current setup. Any ideas?


title: Timetable of Custom Meta Data using Custom Post Type and Custom Taxonomy

text: Scenario: I have a custom post type with custom meta boxes. Each post should represent a row in my table i.e               Activity 1 Jan, Activity 1 Feb and Activity 1 Mar      I have a custom taxonomy of terms for my Activity types:               Activity 1,  Activity 2 and Activity 3.      I am using               archive-custom-post.php      to list my custom taxonomy term links, and               taxonomy-custom.php      to show each Activity time table. Edit: Further clarity. My question is - how do I query the meta data of all posts associated with Activity 1 term type? I am able to query the current post with get_post_custom but that is not enough. Should I be looking at WP_Query? Edit: Activity data example.   * Start and end date.   * Duration   * Cost   * Paypal button Thanks


title: Wordpress Feed Error

text: When you access mysite's feed you get the error message shown below. I've checked my `functions.php` file that no have any extra space on bottom end of file. > error on line 1 at column 6: XML declaration allowed only at the start of > the document Below is a rendering of the page up to the first error.


title: Showing a placeholder/default img, if no featured image is set

text:
I need to modify the following code to show a placeholder if there is no featured image available. I understand that I need to add a `if` statement in the following code but wasn't sure of the exact coding I needed. Obviously in plain english it's going to be along the lines of if there is a thumbnail show it, if not show the placeholder.               <?php $rel = $related->show(get_the_ID(), true);          $count = 1;         foreach ($rel as $r) {          $class= ($count%6 == 0)?"category-related-item-right":"";               echo '
ID).'>'.'
'.$r->post_title.'
'.get_the_post_thumbnail($r->ID, array(50,50)).'
';     $count++;     }?>      I've tried the following but something isn't quite right as it's breaking the page...               <?php $rel = $related->show(get_the_ID(), true);     $count = 1;     foreach ($rel as $r) {     $class= ($count%6 == 0)?"category-related-item-right":"";          echo '
ID).'>'.'
'.$r->post_title.'
';     if (get_the_post_thumnail($r->ID)) :      get_the_post_thumbnail($r->ID, array(50,50));     else :     echo '';     endif;     echo '
';     $count++;     }?>


title: Why is registering a sidebar for each page causing my sidebars to reset?

text: I have the following code in my functions.php               if ( function_exists('register_sidebars') ){              $pages=get_pages();              foreach($pages as $page){                  register_sidebar(array('name'=>$page->post_title, 'sort_column'=>'ID','sort_order'=>'ASC', 'id'=>$page->ID));              }     }      It works beautifully to give me a sidebar for each page. The problem is that the sidebar contest are constantly being reset. Every time I go back to my widgets page, the sidebars are all blank. I can usually still see the contents on the actual site, unless I update something in a different sidebar. If I take out the loop and just use register_sidebar to register a single sidebar, everything seems to work fine. Any ideas why?


title: The next_posts_link() show me a aditional page in blank

text:
**The description** Hi, I am using a custom post type and a loop through the values I show. I'm using a term ($ term) that comes from a previous page in the loop to only show related items. Just for a test run I configured in the administration of wordpress in the reading section, show only two post. I'm also using a custom post type associated taxonomy as follows:               <?php        // Argumentos del loop       $argumentos = array (         'post_type' => 'placas',         'paged' => $paged,         'tax_query' => array(           array(             'taxonomy' => 'firmas',             'field' => 'slug',             'terms' => $term           )         )       );            $query_productos= new WP_Query($argumentos);     ?>      The pagination made this way works well
<?php next_posts_link( 'Older posts' ); ?>

<?php previous_posts_link( 'Newer posts' ); ?>
      **The Problem** But I need to display 4 post, so try this. This shows me 4 post related to the term                <?php        // Argumentos del loop       $argumentos = array (         'post_type' => 'placas',         'posts_per_page' => 4,         'paged' => $paged,         'tax_query' => array(           array(             'taxonomy' => 'firmas',             'field' => 'slug',             'terms' => $term           )         )       );            $query_productos= new WP_Query($argumentos);      ?>      The problem is that the links next returns me an extra one, without content. Only have 6 post published and I should only have 2 pages for paging, but actually get 3 and the last third is empty. How I can fix it so that only the necessary pages have not an extra that is empty?


title: How do I update the formatting of the Mailchimp Subscribe Widget

text: Installed the Mailchimp Widget in the sidebar of my website and the formatting for the widget is askew. I need to shorten the length of the "Submit" button. I want to remove the two radio buttons that appear next to the blank bar where email addresses should be typed. I also can't tell what the radio buttons are for as their labels are not showing up. Help! www.cleanandproper.com


title: WP_Post_List_Table::get_views - Have post counts account for filters?

text: Toward the top of the edit.php screens there is a list that displays post statuses along with the post count. I believe this is generated by WP_Post_List_Table::get_views. For example `All (7) | Published (6) | Draft (1)` Unfortunately, those post counts do not respect filters. I am using `pre_get_posts` to exclude certain posts. Even though only four posts are visible to the user, the numbers still reflect the total post count. I would like to see `All (4) | Published (3) | Draft (1)` I can't seem to find an action/filter to override these numbers (without using JavaScript).


title: Setting different CSS for all pages except home.php

text: I'm creating my first WordPress theme and I'm new to PHP. I've done some looking around but I can't seem to find my specific answer. In my header.php I want to include some conditional logic to set CSS for all pages except the home page. This is my current code but there must be a better way. Couple of other things I'm wondering about... Do I need to make sure the admin doesn't pick up these styles and is my method considered a 'best practice' or is there a better way to go about this?               <!--The Global Styles -->     <link rel="stylesheet" type="text/css" href="<?php bloginfo('stylesheet_url'); ?>" media="screen" />     <!-- Styles specific to the home page -->     <?php if(is_home() || is_front_page()) :?>     <link rel="stylesheet" type="text/css" href="<?php bloginfo('template_directory'); ?>/css/ot_nav_widget.css" media="screen" />         <link rel="stylesheet" type="text/css" href="<?php bloginfo('template_directory'); ?>/css/birdcage.css" media="screen" />     <?php endif;?>      <!-- Set styles for any pages other than the home page -->     <?php if(!is_home() || !is_front_page()) :?>     <link rel="stylesheet" type="text/css" href="<?php bloginfo('template_directory'); ?>/css/ot_internal_nav_widget.css" media="screen" />     <?php endif;?>


title: How to link that "logged in" in "you must be logged in to post a comment" with custom login page on WordPress?

text: How to link that "logged in" in "you must be logged in to post a comment" for a post on WordPress to custom login page. So that when the user clicks on that "logged in" gets redirected to the custom login page not to the wp-login.php. Please help.


title: Receiving uploaded files from Gravity Forms and Embedding + Creating File Content Preview

text: I'm working with Gravity Forms to allow unregistered users to upload various file types: A. Actually files like PPT, PDF, DOC, PNG B. Entering a URL of an existing Youtube video The form we created become a draft waiting to be published. We're now looking for a way to be able to:   * In case it's an actual file like PPT embed a file viewer (a-la slideshare), and automatically add a preview picture of the contents of the file.   * In case it's a video, obtaining a frame from the video for a preview. Any suggestion on how to do this? Thanks,


title: Wordpress query unique post meta - finding all of one value without duplicates for a drop down

text: My wordpress posts have a city/state combo in the post meta. I want to create a list of cities with published posts from the post meta. How would I go about this?


title: How can i know when i can execute what functions of wordpress?

text: I like to do a bunch of stuff only on homepage and archive pages i am working with the genesis framework (not really matters i guess)               if( is_singular() ) {         wp_die('functions.php');     }          add_action( 'init', function() {              if( is_singular() ) {             wp_die('init');         }          });          add_action( 'genesis_before', function() {              if( is_singular() ) {             wp_die('genesis_before');         }          });      only the 3rd get executed, i looking for some reference about that i run into some issues like that before. How do get get to know the wordpress scructure better without digging into the source files?


title: Query custom post type based on post id and custom field value

text: There might be an answer here somewhere, but I'm unable to find it, or recognize it if I did. Here's the situation: I have a custom post type, 'region', that displays on single-region.php. Region names are North, South, East, West. I have another custom post type, 'news'. Associated with it is a custom field named 'news_region'. When a news item is created, the author is required to specify a value for news_region (All, N, S, E, W). What I would like to happen is, when on the North region page, all news items with a news_region value of "All" OR "N" are listed. FINAL VERSION THAT WORKS (thanks to @milo for putting me on the right track):               // get title of region page for comparison with news_region key     $this_region = get_the_title($post->ID);     // query news items with news_region All or $this_region     $args = array(         'post_type' => 'news',         'posts_per_page' => 4,         'meta_query' => array(         'relation' => 'OR',             array(                 'key' => 'news_region',                 'value' => 'All',                 'compare' => 'LIKE'                 ),             array(                 'key' => 'news_region',                 'value' => $this_region,                 'compare' => 'LIKE'                 )             )         );     $newslist = new WP_Query( $args );      NOTE: changed values of news_region to 'All, North Region, East Region, South Region, West Region' to match full region names (same as post title of single- region.php).


title: How to move parent li to end of child ul

text:
I'm working on translating a site from HTML/CSS to Wordpress, and I've come across an issue. In the spirit of keeping the site fully customizable from the dashboard, I've been using Wordpress' default menu system for creating my navigation, but I can't get it to do what it would in hard coded HTML. I need to move the parent list item (parent's a element) below it's child ul as shown below:

About the Festival

History

Sponsors

Contact Us

         General Info
      But by default, Wordpress forces it to do this instead:
         General Info

About the Festival

History

Sponsors

Contact Us

      It is vital for the design that the link come after the unordered list, as it will be a descending banner like this: http://i.imgur.com/oFRJdl7.png The graphic elements are background elements with hover states. This is what they would look like dropped down, the home button on the left is an example of the banner fully raised. This is why it's important to have the parent link element displayed at the end. Ideas?