title: deleting replies on post previews on the homepage

text:
Does anyone know how I can remove the text that says how many Replies there are underneath each post preview on my homepage? I would prefer to see just the title and the date. This is something I expected to find in the lower portion of the code in the content.php file, but I don't see anything there that I can remove which will do the trick. Am I missing something? Thanks so so much to anyone who can reply my site is at: dev.travelwithcastle.com it is a Wordpress child theme, Twentytwelve Kelly I am including the code I have in content.php as well here:               <?php     /**      * The default template for displaying content. Used for both single and index/archive/search.      *      * @package WordPress      * @subpackage Twenty_Twelve      * @since Twenty Twelve 1.0      */     ?>              <article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>             <?php if ( is_sticky() && is_home() && ! is_paged() ) : ?>
                 <?php _e( 'Featured post', 'twentytwelve' ); ?>
             <?php endif; ?>                              <?php the_post_thumbnail(); ?>                 <?php if ( is_single() ) : ?>
<?php the_title(); ?>
                 <?php else : ?>
                     <a href="<?php the_permalink(); ?>" title="<?php echo esc_attr( sprintf( __( 'Permalink to %s', 'twentytwelve' ), the_title_attribute( 'echo=0' ) ) ); ?>" rel="bookmark"><?php the_title(); ?>
<?php the_date(); ?>
                 <?php endif; // is_single() ?>                 <?php if ( comments_open() ) : ?>
                         <?php comments_popup_link( '' . __( 'Leave a reply', 'twentytwelve' ) . '', __( '1 Reply', 'twentytwelve' ), __( '% Replies', 'twentytwelve' ) ); ?>
                 <?php endif; // comments_open() ?>                       <?php if ( is_search() || is_home() ) : // Display Excerpts for Search and Homepage ?>                  <?php else : ?>
                 <?php the_content( __( 'Continue reading →', 'twentytwelve' ) ); ?>                 <?php wp_link_pages( array( 'before' => '
' . __( 'Pages:', 'twentytwelve' ), 'after' => '
' ) ); ?>
             <?php endif; ?>                           <?php if ( is_singular() && get_the_author_meta( 'description' ) && is_multi_author() ) : // If a user has filled out their description and this is a multi-author blog, show a bio on their entries. ?>

                             <?php echo get_avatar( get_the_author_meta( 'user_email' ), apply_filters( 'twentytwelve_author_bio_avatar_size', 68 ) ); ?>

<?php printf( __( 'About %s', 'twentytwelve' ), get_the_author() ); ?>

<?php the_author_meta( 'description' ); ?>

                                 <a href="<?php echo esc_url( get_author_posts_url( get_the_author_meta( 'ID' ) ) ); ?>" rel="author">                                     <?php printf( __( 'View all posts by %s →', 'twentytwelve' ), get_the_author() ); ?>

                 <?php endif; ?>


title: How do I extend auto logout on idle OR redirect inline popup

text: Since the upgrade of WP to v.3.6 I've started getting regularly logged out. This is NOT after a couple of days (without 'REMEMBER ME' checked) or a couple of weeks, and NOT when I've closed the browser then opened a new one later. This is when a browser tab has been open on the Dashboard (or other Admin page) but idle ... to be honest, not exactly sure how long for, but minutes and maybe hours, not days or weeks. Wouldn't be too bad except that the system then redirects to a 'popup' window sized for the standard WP login form, except that I use a plugin ('Theme My Login') and have customised the login page that it uses. Result is that the popup window shows a portion of this page only ... and unfortunately not a part that includes the 'LOGIN' button. It also doesn't let me scroll left | right only up | down, so I can't actually get at the button. It's therefore necessary to close the popup, navigate back to my 'normal' sign in screen, and log on there. It isn't earth shattering, or a show stopper, but it is annoying. Can anyone tell me how / where I can change the auto-logout time / behaviour or if not, at least if / where I can redirect the popup so that instead of the WP form it steers me back to my 'normal' login page? (Of course, it's entirely possible that this shouldn't be happening, and I've erred somewhere and caused it myself! In which case ... any ideas what I might have done?)


title: Custom menu with different behavior for every item

text: I'm working on a custom menu that is particularly complex and I like to know which is the right way to build it. This is the structure of my menu:               - Home (is a PAGE)          - Information (Is a PAGE with a second level menu)             |_________Items are the post for the category "information"          - Data (It hasn't a PAGE, only a second level menu)             |_________Items are the posts for the category "data"      In your opinion which is the best way to build a menu like this? is it possible to build it from the WP backend or is better to create it just from code in the template?


title: add_rewrite_rule to remove /category/ from permalink

text: Hi I have many permalinks across my site that looks like this: http://www.mysite.com.com/market/category/slug/slug/slug/ http://www.mysite.com.com/market/category/slug/slug/ and would like to hide /category/ for all permalinks that contain it. I tried to use the following rule but did not find success. Anyone know why?               add_rewrite_rule('market/(.*)', 'market/$matches[1]', 'top');      I've verified that the htaccess is being added. No redirect occurs though.


title: how to show content of latest blog post with read more link?

text: I want to show the latest blog post content in my side bar with a read more link. So how will I do this?


title: Dynamic Wordpress Admin Panel

text: I would like to create a customized Wordpress admin panel that changes based on the user's log in credentials. For example, if the site administrator logs in from the WP-Admin page, they would be directed to a full suite of administrative options in their admin view. If User Type A logs in from the WP-Admin page, they would see a limited set of custom options in their admin panel. User Type B would see a different set of admin option from Type A, and so on... How can I create a dynamic WP-admin panel using Wordpress? Thanks,


title: How to make plugin required in a wp theme without using php conditional statements when calling an individual function from that plugin?

text: One of my Wordpress themes requires a few third party plugins to run correctly. Most of the times I used to call functions from third party plugins using conditional statements like                   if(function_exist('plugin_function')) {                  plugin_function() // do something         }      suppose though I need to use extensively one plugin through many files of my theme... I would like to avoid using many IF conditions... is there a proper way to require certain specific plugin to be installed in WP or even better install them if they're missing before activating the theme? thanks


title: Auto login after wordpress installation

text: I am creating a product in wordpress and here i am installing the custom theme and plugins during wp installation. No problem until here. But the admin wants to login automatically during the installation ends without prompting for log in and want to redirect to the page what i wish to give. Any help? I tried to put this code after the wp_install() in wp-admin/install.php                       $creds = array();                  $creds['user_login'] = $_POST['user_name'];                  $creds['user_password'] = $_POST['admin_password'];                  $creds['remember'] = true;                            $user = wp_signon( $creds, false );                  if ( is_wp_error($user) )                 echo $user->get_error_message();                             wp_redirect(home_url('products'));exit;


title: Metabox Data not being saved

text: My meta box won't save data. It's a select form field and when I select and update the post, there's nothing selected on refresh. So here it is on PasteBin. http://pastebin.com/tfrgasQC Can anyone tell why my code won't get wordpress to save the post with the data? Thanks


title: Query_post($args)

text: it is possible to use a array by the this query? * * * ### This Version doesnt work: $args = array( 'order' => 'ASC',   **'meta_key => array('city_1','city_2),   'meta_value' => array('NY','LA')**   );      query_posts($args);   --------------         ### And this Version works:    $args = array(   'order' => 'ASC',   **'meta_key => 'city_1',   'meta_value' => 'LA'**   );      query_posts($args);   --------------      have somebody a idea?   Thanks


title: Keep parent page active

text: I have a parent page on my main menu. When you click on that page, you are presented a sidebar with another menu listing of all of its child pages. When you click on one of the child pages, the parent page is no longer active in the top menu. How do I make both the parent page active on top and the active child page active in my left menu? Thanks


title: Custom "Publish" / "Update" button &

text: I'm trying to implement a "publish" button from a custom post type metabox. Everything actually works fine if I either create a new button and manually call submit() or duplicate the regular submit buttons, except for one thing: if i change the title of the post, I always get the "Confirm Navigation" popup asking me if I want tstay or leave the page. It doesn't do this when using the regular "Update" button though, so there's gotta be a way to stop it, I just can't seem to get a handle on it. Custom save button using a link:               Save          // in ready()     $('#saveChangesButton').live('click', function() {             $('#saveChangesButton').addClass('button-primary-disabled');             $('#post').submit();             return false;                });      Custom save buttons trying to mimic the submitdiv's buttons:               <?php if ($_GET['action'] == 'edit') : ?>         <input name="original_publish" type="hidden" id="original_publish" value="<?php esc_attr_e('Save') ?>" />         <input name="save" type="submit" class="button-primary" id="publish" tabindex="5" accesskey="p" value="Update">          <?php else: ?>         <input name="original_publish" type="hidden" id="original_publish" value="<?php esc_attr_e('Publish') ?>" />              <input name="publish" type="submit" id="publish" class="button-primary" value="Publish" tabindex="5" accesskey="p">     <?php endif; ?>


title: Conflict between Capabilities and Menu Visibility with Custom Post Types

text: I hope this isn't just the result of typo on my end, but if it is, I'm not seeing it. I'm adding a custom post type to my site. Actually I'm adding three. Two of them I'm trying to set custom capabilities for a new class of users. In my admin panel I cannot get this to register when adding the function block of code below to my theme's functions.php file. However, I comment out all of the capabilities related variables, the new CPT shows just fine in the admin interface. If I uncomment any of the capability related variables, the CPT doesn't show in my admin menu. There's one other little bit of information. I've got a test page that I'm running a var dump on the custom post type's properties to see if it registers. When I register the CPT with capabilities set, while it doesn't show up as a menu item or doesn't allows me to access the editor for that specific CPT (so it appears to not be set), it DOES however still show up in my var dump AND the capabilities are being set for that specific CPT. Here's my code:               function nb_register_assignment_CPT() {          /*         Assignment CPT     */            $nb_assignment_labels = array(         'name' => _x('Assignments', 'post type general name', 'doula'),         'singular_name' => _x('Assignment', 'post type singular name', 'doula'),         'add_new' => _x('Add New', 'assignment', 'doula'),         'add_new_item' => __('Add New Assignment', 'doula'),         'edit_item' => __('Edit Assignment', 'doula'),         'new_item' => __('New Assignment', 'doula'),         'all_items' => __('All Assignments', 'doula'),         'view_item' => __('View Assignment', 'doula'),         'search_items' => __('Search Assignments', 'doula'),         'not_found' =>  __('No assignments found', 'doula'),         'not_found_in_trash' => __('No assignments found in Trash', 'doula'),          'parent_item_colon' => '',         'menu_name' => __('Assignments', 'doula')       );            $nb_assignment_args = array(         'labels' => $nb_assignment_labels,         'public' => true,         'publicly_queryable' => true,         'query_var' => true,         'rewrite' => array( 'slug' => _x( 'assignment', 'URL slug', 'doula' ) ),         'has_archive' => true,          'hierarchical' => false,         'menu_position' => 52,         'supports' => array( 'title', 'editor', 'thumbnail', 'excerpt' ),          'capability_type' => array( 'assignment', 'assignments' ),          'capabilities' => array(                 'publish_posts' => 'publish_assignments',                 'edit_posts' => 'edit_assignments',                 'edit_others_posts' => 'edit_others_assignments',                 'delete_posts' => 'delete_assignments',                 'delete_others_posts' => 'delete_others_assignments',                 'read_private_posts' => 'read_private_assignments',                 'edit_post' => 'edit_assignment',                 'delete_post' => 'delete_assignment',                 'read_post' => 'read_assignment'             ),         'map_meta_cap'=> true        );             register_post_type('assignment', $nb_assignment_args);           }      Thanks for looking.


title: Help with MySQL to $WPDB query

text: Here's my issue. I have three tables I'd like to query - states, points, and state_points. States contains stateid, and name. Points: pointid, pointlat, pointlng. State_points: Stateid, Pointid. I need to build an array which displays the States, and then the corresponding points. To do this I figured the best way would be something like this tutorial: http://www.bitsofphp.com/avoid-executing-mysql-queries-within-loops/ Query all the states, make an array using the stateids as the arrayids.   Then select the lat, lng, and stateid from the points and state_points table. Add the points (lat and lng) to the array, using the stateid selected in the 2nd query as the array id               global $wpdb;     $states = $wpdb->query("SELECT * from wp_states");     echo $states;     while ($state = mysql_fetch_array($states)) {         $arrayState[$state['stateid']]=$state;     }     $points = $wpdb->query("SELECT wp_state_points.statepointid, wp_state_points.stateid, wp_state_points.pointid, wp_points.pointid, wp_points.lat, wp_points.lng FROM wp_state_points, wp_points WHERE wp_state_points.pointid = wp_points.pointid");     while ($point = mysql_fetch_array($points)) {         $arrayState[$point['stateid']]['points'][]=$point;     }                                                           foreach ($arrayState as $astate) {                                       echo $astate['name'];                                                                foreach ($astate['points'] as $apoint) {             echo $apoint['lat'];                                                                       }                                                                }      Something like this however I receive "Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in..." I know that my query is returning data (at least the first one). I think that wordpress query simply doesn't support this. I could use get_results to return an array. But to make this work the arrayids have to be the same as the stateids What can I do to make this work? Thanks


title: Disable a function from executing in post.php

text: I have a function that seems to execute on saving a post (post.php) and I would to disable it from executing then. I don't know how to specify that? I could check if is_admin, but that would disable the function from working at all when I'm logged in. I'd like to only disable it when I'm in the dashboard saving/updating the post.


title: Date is wrong on 'all posts' page

text:
The website i'm working on has a homepage with posts and at the end of the page a button with view more posts. When I click that button it sends me to 'all posts'. On this page I have a problem, the date for the post is wrong. If you visit: http://www.solarboatleeuwarden.nl/test/berichten/ You can see that every date is set to 30 november. This is either for 2013 and for 2014. What could be the problem? it's not a problem with my database because the dates on the frontpage are right. The code for the homepage looks like this:

Nieuws

     <?php query_posts('post_type=' . $post_types . '&posts_per_page=3&orderby=date'); ?>     <?php if (have_posts()) : while (have_posts()) : the_post();?>
         <?php echo do_shortcode( '[hupso]' );?>
             <?php the_date(); ?>

<?php the_title(); ?>

                 <?php the_post_thumbnail();?>

<?php the_excerpt(); ?>

             <?php endwhile; endif; wp_reset_postdata(); ?>
                 <input type="button" class="meer_berichten" onClick="parent.location='<?php echo $link."berichten";?>'" value="Meer berichten">

      The code for the 'all posts' page looks like this:

Alle berichten

             <?php              $years = $wpdb->get_results( "SELECT YEAR(post_date) AS year FROM wp_posts WHERE post_type = 'post' AND post_status = 'publish' GROUP BY year DESC" );             foreach ( $years as $year ) {                 $posts_this_year = $wpdb->get_results( "SELECT ID, post_title FROM wp_posts WHERE post_type = 'post' AND post_status = 'publish' AND YEAR(post_date) = '" . $year->year . "'" );                 echo '
' . $year->year . '
';                 echo '
';                     foreach ( $posts_this_year as $post ) {                     // Display the title as a hyperlinked list item                     echo '
ID) . '">' . $post->post_title . ''.the_time('d F').'
';                     }                 echo '
';             }             ?>


title: Adding a custom field to do_shortcode

text: I think this will be pretty easy to answer...My php knowledge isn't great! I have used the Advanced Custom Fields plugin to create an 'add Slideshare shortcode' custom field in my page. The user would add shortcode generated from Slideshare enabling them to display their slideshare presentation, see below...               [slideshare id=7901921&doc=embed-slideshare-110509200429-phpapp01]      My issue is that I cannot add the call for the custom field to the "echo do_shortcode" command in my page.php. I have..               <?php   $slides = the_sub_field('slideshare');                     echo do_shortcode('" .$slides. "'); ?>      I know this is incorrect but don't know how to amend it. Any pointers would be gratefully met!


title: How Can I Safely Remove WP-Super Cache without messing my site up?

text: So apparently some people cannot view my site because they said it only loads the sidebar. This only happens to some people and it only started happening after I installed the w3 super cache. I've read about people's website getting messed up after removing it. What's the best way to safely remove it?


title: Add HTML to Page Content

text: I'm accessing a page content from outside WordPress, in a different webpage. Everything runs fine, I'm using this:               require("wp-load.php");     $page_id = 300;     $data = get_page($page_id);         echo $data->the_content;      However, the content is different from what WordPress would output normally. For example, paragraphs which are separated by blank lines in source come just like that, without `<p>` tags. How can I get the content from a page in the same way that WordPress would print it? Should I apply some other filter or use another function to process the text?


title: Wordpress Multilingual Theme using Multisite

text: I have a site that needs to be billingual, English and French. I've created two sites in WPMU, and set the language settings of the second to fr_FR. Under the directory: /wp-content/languages/ I have **fr_FR.po** and **fr_FR.mo** files for the Wordpress backend translations, and it is working well. I've also created a theme called "oak" that is used by both the English and French site, with a folder called "languages". In the folder I have **fr_FR.po** and **fr_FR.mo** files with translations for all of the text in the theme (properly formatted). The french site is not loading the translations from those files, and I'm not sure why. All text on the site that needs to be translated is wrapped in               __('text', 'oak');       or               _e('text', 'oak');      Where 'oak' is the name of the theme folder. The .po and .mo files are properly formatted, generated using poedit. Is there something I am missing to get the translations on the french site to work?


title: add_rewrite_rule() for an unknown parent page

text: I am trying to get this rewrite rule to work right. What I have is a plugin that creates a page after the user inserts a page name in the settings that I created for the plugin. The users custom page name is put into a constant "CES_SCHEDULE_SLUG" as seen below. The issue I have is that I want the user to add the page to a parent if they choose to. I need to replace the "parentpage" below with a wild card or find the parent slug name of the page and convert that to a constant and insert that into the parent page spot below. However, if I go with finding the parent page and make that a constant then if the page is more then one level deep it will not work. Any ideas on how to make this work and be flexible by the custom page being a top level page or a sub child to one or more pages.               add_rewrite_rule(         '^parentpage/'. CES_SCHEDULE_SLUG . '/([^/]*)/([^/]*)/([^/]*)/?',          'index.php?pagename=parentpage/' . CES_SCHEDULE_SLUG . '&days=$matches[1]&month=$matches[2]&years=$matches[3]',          'top'     );


title: how to display all images from their siblings/ from same parent?

text:
I need to know how to display all images from the current page siblings. for eg. I got two parents (Hockey and football) with children. In all this children I got one or several images attached (I've simply uploaded them through wordpress deafult uploader). Now I want a page (called "All images from all teams" ) that display all images that are attached to their siblings / has the same parent as current. AND if you click on let say a images taken from the "New York Rangers" page, you will be sent to that page. **Hockey**   * Detroit Red Wings   * Toronto Maple Leafs   * New York Rangers   * _All images from all hockey teams_ **Football**   * Liverpool   * Arsenal   * Manchester United   * _All images from all football teams_ Help! Please! My code:               <?php get_header(); ?>   <?php if (have_posts()) : ?>   <?php while (have_posts()) : the_post(); ?>
 <?php echo do_shortcode('[portfolio_slideshow size=full navpos=disable trans=scrollHorz pagerstyle=bullets autoplay=true]'); ?>

  <?php include "left-sidebar.php";?>

<?php the_title(); ?>

  <?php the_content('read the entry »'); ?> <?php the_tags( '
 Tags: ', ', ', '
'); ?> <?php echo do_shortcode('[portfolio_slideshow size=thumbnail carousel=false navpos=disable ]'); ?>

   <?php endwhile; ?>  <?php next_posts_link('« old Posts') ?> <?php previous_posts_link('new Posts »') ?>  <?php else : ?>  Not Found  <?php include (TEMPLATEPATH . "/searchform.php"); ?>   <?php endif; ?>

  <?php include "right-sidebar.php";?>
  <?php include "footer.php";?>


title: A field with dashes in the slug

text: How do I reach a specific userdata in the database, when that field has a dash (hyphen) `-` in the slug? I use the plugin WP-Members. I have created a new userdata field with the plugin with the name `date-of- birth` - by mistake I used these dashes `-` instead of underscores `_`. In the database (the `usermeta` table) it now looks like: ![Database screenshot](http://i.stack.imgur.com/3Nu53.png) I get the userdata with these two lines:               $user_data = get_userdata( $user_id );     $user_data->user_email;      which works for all fields - exept those with dashes in them! I have tried this:               $user_data = get_userdata( $user_id );     $user_data->date-of-birth;      which just returns `0`. And this:               $user_data = get_userdata( $user_id );     $user_data->date_of_birth;      which of course doesn't work (it gives `null`), since that is not the correct name. Is there a method to reach this field with dashes in the slug? **Note** I can't change the slug. That is not allowed by this plugin after the field is created.


title: Remove the <ul> Tag from wp_nav_menu

text:
I want to remove the `<ul>` tags from the `wp_nav_menu`. I already found different posts about it here but they don´t seem to work for me. Here is what I did: First I registered the menu in functions.php:               add_action('init', 'register_custom_menu');          function register_custom_menu() {         register_nav_menu('main-navi', __('Main-Navi'));     }      Then I created the menu in the Wordpress backend. After that I put following code into my `header.php` :               <?php $args = array(         'menu' => 'main-navi',         'items_wrap' => '%3$s',         'container' => false );     ?>     <?php wp_nav_menu($args); ?>      But the output is still the following:

            Blog

            Leistungen


title: $post in wp_query?

text: How do I get the $post Variable in a WP_Query started loop? I have to get the excerpt, raw $post->post_content and further things. This is why I have to get Access to the Variable itself. How am I able to do this? Thank you in advance!


title: Completely remove WP_Admin_Bar for specific user roles

text: How do I hide/remove the admin bar that is displayed when a user with specific role is logged in? I figured I have to do something with `remove_menu()`, but not exactly what and how. Codex


title: User ability to favorite or 'like' content

text: I have a few different custom content types and would like to give my users the ability to favorite or 'like' (like Facebook, but not for Facebook) pieces of content so that they can later view a list of their favorited content. I've searched everywhere but haven't come up with a clean solution. I'm pretty comfortable with SQL and PHP but want to make sure I'm doing this in the most efficient, clean way possible. Any ideas?


title: Are seven additional image sizes are too many?

text: I am developing a theme which uses different image sizes. So I will be adding 7 image sizes, are they too many? Could that break anything like the image size selector, other parts of the interface or upload performance? Also, is it a bad practice to remove the default image sizes from the theme for example adding following to the theme?               unset( $sizes['thumbnail']);     unset( $sizes['medium']);


title: Speed up Wordpress

text: I don't have the feeling that my blog is particularly slow, but that's because I haven't really started out yet. I'm very worried that it will get slow soon, especially because I will have blog posts with (optimized/compressed) 40-50 photos. This can't be changed, but other things can. I already read a lot about it, went through various tutorials, but yet I feel there's some more I could do. First of all, my blog seems to be doing well at the moment. At least according to Webpagetest.org. Here's my blog, so you can try yourself. I'm trying to figure out what all the results REALLY mean, but I don't get all of them. **Images:** I already compressed most of my images. CSS sprites take a loooooooooot of time and so I'll skip this for now and work on that much later when I actually get a bit higher traffic. To compress my images I use Photoshop (save for web) and Yahoo's SmushIt. **Javascript:** The scripts I'm using seem to cause some problems in terms of speed as I get the following suggestions from the Webpagetest.org site: > "380.5KiB of JavaScript is parsed during initial page load. Defer parsing > JavaScript to reduce blocking of page rendering." I have absolutely no clue what that means. Could anybody tell me more about that? (I know that this is not particularly related to Wordpress, but it's part of speeding it up anyways, so I hope you're willing to help me out here) Another warning concerning Javascript: > >     The following external resources have small response bodies. Inlining > the response in HTML can reduce blocking of page rendering. >     http://zoomingjapan.com/travel/mount-koya-travel-report/ should inline > the following small resources: >         http://zoomingjapan.com/wp-content/plugins/gravatar- > box/gravbox.js?ver=1.0 >         http://zoomingjapan.com/wp- > content/plugins/jetpack/modules/wpgroho.js?ver=3.2.1 >         http://zoomingjapan.com/wp-content/themes/alltuts/js/contact- > form.js?ver=3.2.1 >         http://zoomingjapan.com/wp-content/themes/alltuts/js/my- > slider.js?ver=3.2.1 >         http://zoomingjapan.com/wp- > content/themes/alltuts/js/scrollable.js?ver=3.2.1 >         http://zoomingjapan.com/wp- > content/themes/alltuts/js/sliding_tabs.js?ver=3.2.1 >         http://zoomingjapan.com/wp- > content/themes/alltuts/js/sprinkle.js?ver=3.2.1 >         http://zoomingjapan.com/wp-content/themes/alltuts/js/tab- > renamer.js?ver=3.2.1 >         http://zoomingjapan.com/wp- > content/themes/alltuts/js/welcome_back.js?ver=3.2.1 >         http://zoomingjapan.com/wp-includes/js/l10n.js?ver=20101110 >   So, it was recommended not to have any script calls in your template files, I put ALL of it in a js folder in my theme instead and that's what you get. Thousands of tiny scripts. Of course I'm using `wp_enqueue_script`! Does that mean it's better to put it back into my header.php? Or create a custom.js and throw in all the code that possibly can work together well?! Or put all the Javascript in the footer.php?! I just don't understand what would be the best environment for WP here! **Redirects:** > Remove the following redirect chain if possible: >   >   >     http://0.gravatar.com/avatar/2b7d7f6b4622da443cc8081ca78db661... >     http://zoomingjapan.com/wp- > content/themes/alltuts/images/usericon.png?s=30 >   > > Remove the following redirect chain if possible: >   >   >     http://1.gravatar.com/avatar/35991606c4e61d2d3a4ba61a9e03ab79... >     http://zoomingjapan.com/wp- > content/themes/alltuts/images/usericon.png?s=30 >   > > Remove the following redirect chain if possible: >   >   >     http://www.zoomingjapan.com/wp-content/themes/proton- > child/images/toplight.png >     http://zoomingjapan.com/wp-content/themes/proton- > child/images/toplight.png >   This is coming from the following code in my function.php:               add_filter( 'avatar_defaults', 'newgravatar' );          function newgravatar ($avatar_defaults) {     $myavatar = get_bloginfo('template_directory') . '/images/usericon.png';     $avatar_defaults[$myavatar] = "ZoomingJapan";     return $avatar_defaults;     }      Can I get rid of the redirect, but keeping the function alive? **Other steps:**   * Disable revisions (done)   * Empty trash every 2 days (done)   * Optimize dabatase once a week (not yet)   * Use a cache plugin (done: W3 Total Cache)   * Flush early (not yet: `<?php flush(); ?>` not sure if that's a good   idea to use??!)   * Use CloudFlare as CDN (not yet: what do you think about that? does it work well with WP?) Do you have any other suggestions that are relatively easy to implement? I know, quite a lot of questions, but if you can give me just a little suggestion for any of the points, I'd be really grateful. Thanks a lot in advance.


title: How to create subdomain for custom post type and associated custom taxonomies

text: I creating shopping cart, based on **custom post types**. And for this cart I have two related custom taxonomies.   * I need to create **shop.mysite.com** instead of **mysyte.com/shop** only for **this one** custom post type.    * I **dont need multisite** solution.    * All **posts** of current post types will be opened as shop.mysite.com/some-post/.   * Related custom **taxonomies** will be opened as shop.mysite.com/customtax/some-tax-value/.   * Additionally also would like to redirect a **few pages** related to shop as shop.mysite.com/some-static-page/ Thank You for help!


title: Rewrite rules for custom posts types

text: So I created a new post type 'quote'.   Basically I want to change all quotes URLs to domain.com/quotes/ID since as it as right now (`/?quote={xxx}`) could get pretty long, and since this post type is user-input-based, I don't want to take any risks. So I tried looking for answers... I found a really good tutorial that seemed to partially work. The urls did change, but I ever since I get a `404 page not found` error.   Then, I tried looking for solutions. I tried some like adding `flush_rewrite_rules()`, opening the permalinks page in wordpress admin and press "save", changed my code and changed the slug in the `rewrite` attribute of the post type. As you can guess, nothing worked.               function my_custom_post_type() {         $labels = array(                   // too long         );         $args = array(             'labels'        => $labels,             'description'   => 'Holds our quotes and quotes specific data',             'public'        => true,             'menu_position' => 5,             'capability_type' => 'post',             'publicly_queryable' => true,             'supports'      => array( 'editor', 'comments' ),             'has_archive'   => true,             'rewrite'   => false,             'query_var'     => true,         );              register_post_type( 'quote', $args );         flush_rewrite_rules();  //one of the solutions I found              global $wp_rewrite;         $projects_structure = '/quotes/%post_id%';         $wp_rewrite->add_rewrite_tag("%quote%", '([^/]+)', "quote=");         $wp_rewrite->add_permastruct('quote', $projects_structure, false);              add_filter('post_type_link', 'quote_permalink', 10, 3); //translate the structure variables.     }          add_action( 'init', 'my_custom_post_type' );      In short, I do get forwarded to `/quotes/ID/`, but the page results in a 404 error.   I did try to look up answers but nothing really worked for me.   Hopefully someone could pinpoint the problem.


title: wp_nav_menu does not take arguments?

text:
I am sorry for this nooby question, but I just don't get it : I was working with the function reference for wp_nav_menu and this is my line of code:               <?php wp_nav_menu( array('theme_location' => 'header-menu','items_wrap' => '%3$s') ); ?>      But the menu is displayed in `<ul><li>` anyway. (I want to remove that and make the menu horizontal). I can put anything in the `items_wrap`, it will always be the default `<ul>` The theme_location is maybe not working too, but since I have only one menu yet, it displays the right one. I want to say sorry again if this is very stupid, which I guess it is, but I ask for your patience and help, just a beginner here. Full index.php:               <?php get_header(); ?>     <?php if(isset($_GET['nav'])) {     $nav = $_GET['nav']; } ?>

             <a href="<?php echo home_url(); ?>"><img id="logo" src="<?php bloginfo('template_directory'); ?>/img/logo.png" />
     <?php     remove_all_actions( 'wp_nav_menu_args' );     remove_all_actions( 'wp_nav_menu' );          echo "\n\n\n";     wp_nav_menu( array( 'theme_location' => 'header-menu', 'items_wrap' => 'j' ) );     echo "\n\n\n";     ?>

<img id="shade" src="<?php bloginfo('template_directory'); ?>/img/shade.png" />

                  <img id="fbbutton" src="    <?php bloginfo('template_directory'); ?>/img/buttons/fb.gif" />             <img id="twitbutton" src="<?php bloginfo('template_directory'); ?>/img/buttons/twitter.gif" />
                 <?php if (!( isset($nav) ) ) { include('startpage.php');} else { include($nav+'.php');} ?>

     <?php get_footer(); ?>      functions.php:               <?php add_action( 'init', 'register_my_menu' );          function register_my_menu() {         register_nav_menu( 'header-menu', __( 'Header Menu' ) );     }          ?>      Ok, please try to get over unstandardized naming and strange ways of achieving stuff, this is one-third learning, one-third testing and one-third development..


title: How to display number of page views on a post?

text: Is there any currently supported plugin to display the number of page views on a post? wp-postviews seems to be the most commonly used, but it requires modifying the theme (which would require creating a child theme to avoid being overwritten by theme updates), and does not seem to work with caching plug- ins. It seems like this should be straight-forward to extend the wp-statistics / jetpack API to display this information, but I haven't found a plugin that will do so. Seems like a common feature, surely this has been done somewhere?


title: How to extend media gallery WP 3.5

text: I'm trying to extent in a theme the media gallery. basically what I'd like to do is to have another button next to 'Insert gallery' that will say something like 'use this images'. And when clicking on that button, the attachent IDs will go in a custom box. Bellow some screenshots. The custom button: http://i.imgur.com/h0l441z.png The field where the IDs are inserted: http://i.imgur.com/Knzamz1.png Any hints how to achieve this will be appreciated.


title: Sort taxonomies in select dropdown with topmost parents as optgroups

text: I have an array of objects with custom taxonomy terms. This taxonomy represents a list of countries/states/cities which are being used by a certain post type and other parameters (I'm not using a standard wp function to retrieve these). The terms are already ordered alphabetically by term name key using `usort`. I'm printing each term as an `option` within a `select` dropdown. What I'd like to do is to further organise the list by printing topmost terms as well as `optgroup` and put all child taxonomies inside as optgroup elements. **The parent itself should be listed as a selectable option too**. Only topmost parents should wrap children as options within optgroups. Currently I'm just looping the terms as options without optgroups:               $locations = my_function(); // returns an array of alphabetically sorted wp term objects     echo '<select /*...mystuff...*/>';          foreach ( $locations as $location ) :         echo '<option value="' . $location->slug . '">' . $location->name .  '</option>';     endforeach;          echo '</select>';


title: Select page/template from the permalink url

text: I use permalinks like `example.com/projects/project1` for my project pages. They use all the same template. I want to access another template with more details on the project by adding `/details` to the URL. I don't want to nest/create more pages though. I want to keep my single project page in the admin area to maintain all the info. Is this possible? Maybe with `.htaccess` or something in the `functions.php`?


title: Changing Multisite themes on mass

text: I want to start a new theme for my Multsite install instead of simply modifying the current theme. The problem is I have a lot of sites running on Multsite so it would be a little painful to change all my sites to the new theme one by one. Is there a way to change the theme of sites by more then one at a time? In sites in network admin I can see a bulk actions option but when I select my sites and click apply, it does nothing (should it!?)


title: Can I use WP to create a multisite importing the posts of 3 old WP website?

text: I am pretty new in WP and I have the following doubts about work that I have to do. I have to create a multisite (3 sites related together) starting from 3 separated old WP websites. I know that some years ago there was WordPress MU that performed this task but reading the online documentation it seems to me that now WordPress MU is a closed project and that the multisite functions is natively implemented by the standard WordPress version, is it true? So, if the previous assertion is true, can I do the following?   1. Use WP to create a multisite that implement 3 different sites (each one with a unique theme, widgets and configuration)   2. Take the posts of the previous old WP website and import it in the related new single site of my new multisite. Can I do this things?


title: get_post_types is not showing all registered posts

text: When I call get_post_types() in a plugin the output is registering only the basic set of post types. Here is the output:               array(5) { ["post"]=> string(4) "post" ["page"]=> string(4) "page" ["attachment"]=> string(10) "attachment" ["revision"]=> string(8) "revision" ["nav_menu_item"]=> string(13) "nav_menu_item" }      In this wordpress theme, however, I have registered a custom post type called 'artist', but it is not showing up. If, however, I call get_post_types() in the index.php file it does how the registered posts:               array(8) { ["post"]=> string(4) "post" ["page"]=> string(4) "page" ["attachment"]=> string(10) "attachment" ["revision"]=> string(8) "revision" ["nav_menu_item"]=> string(13) "nav_menu_item" ["acf"]=> string(3) "acf" ["artist"]=> string(6) "artist" ["release"]=> string(7) "release" }      Does anyone know why this is happening and how to get around the problem?


title: What does Wordpress mean by they have full rights to content

text: I am pondering publishing my blog. I'm leaning more towards WordPress however, I don't want to worry about WordPress doing whatever they want whenever they want withmy blog because I have signed up for the basic plan (I'm new to blogging so I'm assuming I should start with the basics) depending on how well my blog does I intend to upgrade to one of the more advanced accounts. In the meantime I read in this forum that Wordpress has full rights to content..how so? Full rights meaning no legal action can be taken against them for the reproduction or even stealing of blog posts, pictures, etc? Can they just use content as they wish? How does this work? If I have posted this in the wrong section or if this question has been asked before please don't get upset like I stated I am new to blogging and I'm trying to gain insight on the best route I should take. Thank you all in advance


title: How to get override the WP Admin Syndication feed limit for a custom feed?

text: I need to override the setting in the WP Admin for the number of recent posts in the Syndication settings under General -> Admin. I'm using the following code, which gets all posts, but I don't need that many. Can someone tell me how to retrieve 50 posts?               function no_limits_for_feed( $limits ) {         return '';     }          add_filter( 'post_limits', 'no_limits_for_feed' );


title: How to use Wordpress Conditional Tags in get_posts foreach loop

text:
I have a page which has a jquery tab function to output the list of pages that are the children of this page (Bio, Archives, Contact). However I am trying to make a conditional in the foreach loop to no avail.               <?php // get_posts function: http://codex.wordpress.org/Template_Tags/get_posts#Examples     $args = array(          'paged' => $paged,         'post_type' => 'page',         'post__in' => array( 3, 4, 5, 6 ), /* Bio, Client, Archives, Contact */         'order' => 'ASC'     );     $myposts = get_posts( $args ); ?>
              <?php foreach ( $myposts as $post ) : setup_postdata( $post ); ?>                 <li id="page-<?php global $post; echo $post->post_name; ?>">                     <a href="#<?php global $post; echo $post->post_name; ?>"><?php the_title(); ?>
              <?php endforeach;  ?>
              <?php foreach ( $myposts as $post ) : setup_postdata( $post ); ?>             <div class="tabcontents" id="<?php global $post; echo $post_slug=$post->post_name; ?>">                 <?php the_content(); ?>                                  <?php edit_post_link("Edit"); ?>
         <?php endforeach;  ?>          <?php wp_reset_postdata();?>      Basically, I would like to output the featured image of the children pages under Archives for when user views the Archives tab. I tried using this inside the foreach loop but it didn't work:               <?php if ( is_page( 5 ) || is_page('Archives') ) {         echo 'Show me!';     } ?>      Can anyone help?


title: Wordpress : To load all asset files coming from HTTP to HTTPS?

text: _(I'm using`Wordpress HTTPS` plugin to force `Admin` mode to run under `HTTPS`.   Its fine for Admin Panel.)_ But still, once i'm under `HTTPS` mode, every front pages are broken because of, it is saying some front-pages `Asset Files` **are coming as normal`HTTP`** (without 'S') which are then getting blocked to load onto page. Than resulted in rendering the page looking messy. So to be more clear again,   * When i call the site in `HTTPS / SSL` mode .. some asset files, like:      * `http://www.my-another-site.com/something.js`     * `http://www.my-another-site.com/something.css`     * `http://www.my-another-site.com/something.jpg`     * ... etc .. are BROKEN. **_(Because i'm in`https` mode and those above files are coming as `http`)_** So how to make Wordpress to FORCE LOAD those whatever files?    _(I DON'T CARE WHETHER IT IS SECURE OR NOT. Just want the site under`https://...` to be rendering properly.)_


title: Get post ID's from one query and exclude from another

text: I have 2 instances of `wp_query`, one showing 4 "Featured" posts and another showing "basic" posts. What I want to do is exclude those 4 latest "Featured" posts from the basic query. I assume it's just a case of adding a `post__not_in` variable but how can I get the ID's from the first query and exclude them from the second?


title: Opinions and recommendations on the best barebones base theme

text: **Preamble** I'm finding myself building more and more WP sites "from scratch" as it were (ie: ignoring any theme designs out there and just creating a design wireframe purely on the needs of the client. Then I go out and either shop around a theme that has the right basic structure, or I start with TwentyTen and fork a child theme from there. Recently I've been getting the advice that maybe TwentyTen is not the best place to start as a base / parent theme because it's been stuffed with every technique possible in order to be a good learning platform. But maybe it's not the easiest or most efficient to customize (it has individual template.php pages for almost every part of the template hierarchy AND it has every template-part.php imaginable. And using existing themes (whether free themes, or themes from services like ThemeForest) is a bit of a crap-shoot - in terms of coding standards, usage of templates, template-parts or hooks, incompatibilities, etc etc. So that's not ideal either. Ideally, I'd like to whittle my starting choices to a small handful of really well-built, highly versatile, extremely barebones (light on design) themes that I could fork child themes from and adapt to my wireframe and design specs. **Getting to the question** What are your favourite **barebones themes** for forking off child themes? Why do you like them? thanks so much for your advice!


title: Are there action hooks for comments?

text: This is for a personal-use plugin I'm trying to make. I want to submit a comment from site A to my blog (sort of like sending trackbacks/pingbacks but a full comment). For instance, on site A I have a form with a name, url, and comment field. The data I enter in site A, I want to submit to site B (my blog) via URL parameters or the POST method. I assume that I'll need an action hook on my blog to retrieve data sent from site A and insert it in the wp comment table. Is this possible?


title: Contact Form 7 Failed on WordPress Amazon EC2 Instance

text: I installed WordPress 3.5.2 on an Amazon EC2 micro instance. After installing and activating the Contact Form 7 plugin, I configured this plugin by putting my gmail address in the `Mail To` settings of the plugin, then tested the form by pasting `[contact-form-7 id="17" title="Contact form 1"]` in my page and submitting my comment, but I got the following error: > Failed to send your message. Please try later or contact the administrator > by another method. Is this error caused by my EC2 security group? (please see below)               Ports           Protocol    Source     20-21           tcp         0.0.0.0/0        22              tcp         0.0.0.0/0        80              tcp         0.0.0.0/0        13000-13050     tcp         0.0.0.0/0      Or is this error related to this default restriction on sending email from an instance? I read that one possible solution is to install WP-Mail-SMTP. I was looking at the WP-Mail-SMTP plugin screenshot and it appears to require a port number. I did not initially configure a port for this during the setup of my EC2 instance and I'm thinking this plugin would not work unless I create another instance with a new security policy (since I cannot edit my current security policy). My Akismet is disabled. Any assistance with helping me understand the cause of this error will be greatly appreciated. Thanks in advance.


title: Using wordpress template tags within an array

text: A bit of a noob PHP question coming up. I am trying to create a generic archive style view for my custom post types. Ideally I want to create one generic template that can be used for all post- types. Currently I use this as my have_posts query to bring in all posts of 'custom- post-type'               <?php      $args=array(        'post_type' => 'custom-post-type.',        'post_status' => 'publish',        'posts_per_page' => -1,        'caller_get_posts'=> 1      );      $my_query = null;      $my_query = new WP_Query($args);      if( $my_query->have_posts() ) {      while ($my_query->have_posts()) : $my_query->the_post();      ?>      What I want to do is swap out custom-post-type with the slug of the page so that whenever this template is assigned to a page, it will look for a custom- post-type of that name & list them. Alternatively if you know of a better way of doing it - great! Cheers, George


title: How do I set up a custom URL shortener for my posts?

text: I have several different sites running off WordPress, and the URLs tend to get fairly long and cumbersome (particularly when I try to publish them via Twitter). I recently purchased a very short domain name, and I'd like to use it as the root of a personal URL shortening service. So ...   * `http://www.eamann.com/portfolio` would become `http://eam.me/portfolio`   * `http://www.mindsharestrategy.com/wp-xmlrpc-movabletype/` would become `http://eam.me/df3DF`   * `http://www.prosepainting.com/coffee-shop-part-1/` would become `http://eam.me/csp1`   * And custom things like `http://wordpress.stackexchange.com/questions/3076/feature-survey-what-would-you-want-in-a-resume-theme` would become `http://eam.me/wpa3076` Basically, I want to set up and manage my own TinyURL-like server ... but with some specific requirements:   1. It should integrate fully with WordPress so I can dynamically create new short URLs whenever I create a page or a post (every piece of content I create on each site should have its own short URL).   2. I can specify if I want the URL to be random (like `/df3Df`) or I can choose a unique string instead (like `/wpa3076`) at the time of URL creation   3. I should be able to view/edit/manage the URLs I have in the database from within WordPress At the moment, I'm leaning towards a standalone system like YOURLS that lives in its own database. The problem I'm facing (and I'll confess now that I haven't attempted it yet) is integrating the system fully with WordPress. I want each post to automatically suggest a short URL before I hit "publish" and then automatically create the URL when I finally do "publish" the post. I'd also like to administer _all_ of my links from within _each_ of the sites using the service. Is this even possible? Is there already a solution around to do this? If not, where do I start? _(Cross-posted toStackOverflow)_


title: How can I add a URL field to the attachments window?

text: For example...               add_action('init', 'reg_tax');     function reg_tax() {        register_taxonomy_for_object_type('category', 'attachment');     }      Adds a "Category" input field to the media manager and attachments editor. I'd like to know if its possible to alter this function to capture a "link destination" URL instead. The URL would be executed when the image is clicked. Also need to know how to retrieve the value for this new field. UPDATE: Thanks to Thomas Answer below, here is my final solution...               function my_image_attachment_fields_to_edit($form_fields, $post) {           $form_fields["custom1"] = array(               "label" => __("Image Links To"),               "input" => "text",             "value" => get_post_meta($post->ID, "_custom1", true)           );                 return $form_fields;       }            function my_image_attachment_fields_to_save($post, $attachment) {             if( isset($attachment['custom1']) ){               update_post_meta($post['ID'], '_custom1', $attachment['custom1']);           }           return $post;       }            add_filter("attachment_fields_to_edit", "my_image_attachment_fields_to_edit", null, 2);      add_filter("attachment_fields_to_save", "my_image_attachment_fields_to_save", null, 2);


title: What is a good wordpress 3.0+ plugin that supports automatic publishing to Twitter/Facebook?

text: I've tried Socialite and a couple others but they all appear to be reported as broken. When I tried them out, they were in fact broken. Can anyone suggest some that automatically publish to these services and work on WP 3.0+? This is not for a wordpress.com blog, but an installed instance of wordpress. Thanks.


title: How to create Parent-Child relation for custom fields?

text: I am new in here. Hope that you guys can help me. Few days ago, I posted the same question on Wordpress.org support forum, however till now no one answer me, not even 1 reply. Maybe my issues is too complex, or too stupid. So be gentle. Here is my questions: For the custom fields, can we defined Parent and Child value option? The child value options are depend on the Parent input. For example when we adding an address: Country : [US, CN] If the user choose US then the next custom field is State and the value options would be The states in US . Country -> [us] State : [Alabama,Alaska,American Samoa,Arizona,Arkansas...etc] However if user choose CN, then the next custom field would be Province and the value options would be the provinces in China Country -> [CN] State : [Anhui,Beijing,Chongqing,Guangdong,Shang Hai...etc] Hope you guys know what I tried to express.. The plugin that I use for create the dropdown custom fields is Custom Content Type Manager. I wonder if I able to hook jquery to custom fields area to make it happens? If it is possible to do so, how? Any guides to help me solve this would be appreciated.


title: saving the widgets position after drag and drop

text: I have created a web application in which I have 3 columns, or i would say left sidebar, right sidebar and a middle widget area, I have few widgets in the left sidebar, few in the right sidebar and few in the middle widget area to give it a look of igoogle. Each user will have his widgets and then will also be able to drag and drop those widgets.I have added the drag and drop functionality of the widgets. What I want now is to save the dropped widgets position in the database and retrieve it for the user when he/she logs in again. Any sugestions as to how this can be done?


title: How to add some custom HTML to the edit posts page

text:
On the wordpress admin edit posts page, I want to display some custom content and script, underneath the meta box. I want to hand code this as the various plugins I could use (advanced custom fields for instance) take too much control away, and I don't need an actual field to be saved. So for example, I want to add this to the edit posts page:

      That's pretty much it. Nothing fancy or that contains any editable content. What hook or function do I need to use to achieve this? Any help greatly appreciated


title: wp-editor is empty on first submit

text: I'm using wp-editor in a simple plugin, but I'm having an issue where the first time I hit the submit button the content from it is blank in the database.               <?php      $editor_id = 'mycontent';            wp_editor($content, $editor_id );                    ?>      So I tried alerting the content using this:               if (j(".wp-content-wrap").hasClass("tmce-active")){        alert( tinyMCE.activeEditor.getContent());     }else{        alert( j('#mycontent').val());     }      and the first submit comes up empty. If I switch to the text version before I submit, it works. What am I doing wrong here that prevents the submit from working? Edit: Interestingly, if I do this:               wp_editor('test', $editor_id );      It works. If I do this:               wp_editor('', $editor_id );      It doesn't work again. How do I get it to work if the `$content` is initially blank?


title: WP_UnitTestCase missing?

text: I was looking at tests for wordpress and some, if not all the classes have WP_UnitTestCase but I cannot find the class, why do I care? I have downloaded The most up to date version of this from github which is the same set of tests. Why does this matter so much? Because when ever I run one of the tests via phpunit filename.php I get the error from php unit stating that its missing WP_UnitTestCase. So my question is: Where is this class, why is it missing if it works for the WordPress developers?


title: How to insert category list into post creation page, and retrieve chosen categories?

text: I would like to display the full list of categories on the Page creation page, so that the user can pick using checkboxes which category posts should appear on that page. ![where I would like to display it](http://s9.postimage.org/biwlbzvrj/box.jpg) I then need to retrieve the chosen categories for that specific page in my custom page templates, so that I can modify my loop to filter for only those chosen categories.


title: Attribution when using other plugin's code

text: What's the proper way to show attribution when using code taken from another open source WordPress plugin? I'd like to know both in the case of just a particular function, and even for a whole file containing many functions.


title: Append custom parameter to taxonomy/term URI

text: I have a **Custom Post Type** named " **Cars** " and **2 Custom Taxonomies** " **Ferrari** " and " **Lamborghini** ". Each taxonomy has **2 Terms** : " **New** " and " **Used** ". These URIs work as expected:               http://myhost/ferrari/new     http://myhost/ferrari/used      The problem is, of course, when I append the car ID at the end I get a **404** :               http://myhost/ferrari/new/123      I've been playing a lot with **add_rewrite_rule/add_rewrite_tag** and read many discussions here on **StackExchange** but I couldn't find a solution. I also tried WP Router and it actually works, but it almost entirely overrides the default routing so that it feels like a hack. **Question:** All I need is being able to route the URI with the appended ID to the same template as it would without, so from there I can make a custom query using the ID segment. Thank you!


title: Delete/replace img tags in post content for auto published posts

text: In my blog I have set up auto-publish for posts and I get 5 thousands new posts every day, in this moment I have more than 150 thousand posts. I need a script, or a plugin, or a function to connect to my database and strip out all `img` tags from post content. I know the regular expression to match the img tags, but I can't find a script for using this regular expression               <img[^>]+\>        to replace imgs in already published posts and to prevent new posts to contain image tags. I found this class and I think that it will achieve my goal but I am not sure how to edit this               $wpdb->query(       "UPDATE $wpdb->posts SET post_parent = 7       WHERE ID = 15       AND post_status = 'static'"     );      to fit my needs. **please note:** my site is using some auto publish posts feature Any ideas!


title: Getting Post details when post is published

text: I would like to collect main info about post like Title etc. **in moment when post was written and it's going to be published** and perform some actions on this data. What's the hook for that? Thanks!


title: System audit plugin?

text: Is there a plugin that tracks wordpress admin settings and actions? eg when plugins are activated/deactivated, plugin settings are changed, user settings and permissions changed?


title: Searching with Multiple (Parallel) Criteria on Custom Fields?

text: I'm just an basic Wordpress user. I need to make search box with **multiple criteria** inputs (multiple conditions) to search **inside various Custom Fields**. For example including following **Custom Fields** : Color: **___ ___ _**   Size: **___ ___ _**   Price: **___ __ _**   Condition: **___ ___**   Discount %: **___ __ _**   Hit Count: **___ ___**   User may input **1 or more** fileds.   **Result should be filtered for multiple input also.**   For example: `Price: ____100___` and `Condition: ____Fair____`   So, how can i handle this multiple conditions in Query? It is **ok for every single inputs**.   But, problem with more then 1.   I'm confusing how to write query **for multiple criteria** (in former way).   A simple sample please.


title: Any tools for quickly grabbing comments / comment count?

text: I am working on an aggregator at the moment for an opt-in blog service. Essential a handful of people submit their WP blogs to the aggregator for, well, aggregation. I am currently using a slightly hacked version of http://feedwordpress.radgeek.com/ What I want to be able to do is for each bit of syndicated content shoot off to the post in question and grab the latest comments and comment count. Anyone have any opinions on the best way to do this?


title: Showing Thumbnail from Previous and Next Posts

text: Is there a simple way to use the post thumbnail when calling `previous_post_link()` and `next_post_link()`?


title: How to correctly make admin pages for custom tables which don't show in the menu?

text: I have to create a custom table to store data for a client because they want a very precise search capability. I already have this working with custom post types and using custom fields, but with 800+ records it now takes 90+ seconds to search. (I know of no way to simplify this answer.) I'm taking the same idea and turning it into a custom table now. So I've got the start of my plugin, the table definitions, and some basic pages by the add_object_page / add_submenu_page functions. However, I need the ability to edit a page so I found a function that lets me create a hidden page.               function add_admin_page($hook) {       global $_registered_pages;            $hookname = get_plugin_page_hookname($hook, 'admin.php');            if(!empty($hookname)) {         add_action($hookname, $hook);         $_registered_pages[$hookname] = true;       }     }      This works like a charm until I look at the header and notice that **there's no page title defined for this callback**. I've looked at `plugin.php` for the `add_menu_item` to see how it defines a title... and see no way for this custom page to display a title correctly. **So I thought about finding a hook and using a switch statement to override the title.** Possible? Bad idea? Another problem I have is that I'd like to use some of the scripts by `wp_enqueue_script` from within my callback, like "post" or "editor", and validate my form too, but **the scripts I'm enqueuing aren't included in the payload.** Should I include them in the footer of my callback?


title: connect (relate) content of different types in WordPress

text: I´m just starting with WordPress and looking for an approach to this problem. I have to setup a site which displays:   * library [1]   * exhibitions [2]   * shop [3]   * some static pages like contact … All items of those categories can be related to items of other categories. In detail a book in "library" can be related to several posts in "exhibitions" and to items in "shop", if a user views this book the related items from all other categories should be shown also. Reading Tutorials about related item posts and looking at plugins   * http://wp-types.com/documentation/user-guides/creating-post-type-relationships   * http://wordpress.org/plugins/yet-another-related-posts-plugin/ I still having problems finding a proper solution for this. My Questions:   * Is there a native WordPress of way solving these issues? F.e. the ability to add to every administration form a new input field to choose relations   * If not is there a plugin which could handle this job?    * What would you do? Looking at WordPress code, I think my question is more regarding the backend. If the relation is written to the database I could surely write something to output the related items at frontend page (template) (having PHP knowledge). [1] https://wordpress.org/plugins/weblibrarian/ [2] setup as native wordpress "posts" [3] http://wordpress.org/plugins/wp-e-commerce/


title: Button Shortcode

text: I am trying to create a custom button shortcode, with multiple color and size options. However, when I try to use the shortcode in my post it isn't showing up. My Function               function btn($atts, $content = null) {        extract(shortcode_atts(array('link' => '#', 'color' => 'teal' , 'size' => 'large'), $atts));        return '' . do_shortcode($content) . '';     }      How I am using the shortcode               [btn color="blue" size="large"]Button Text[/btn]      My CSS               /* Buttons */     .btn {background:#222 url(img/alert-overlay.png) repeat-x; display:inline-block; padding:5px 10px 6px; color:#fff!important; text-decoration:none; font-weight:bold; line-height:1; -moz-border-radius:5px; -webkit-border-radius:5px; position:relative; cursor:pointer; -moz-box-shadow:0 1px 3px rgba(0,0,0,0.5); -webkit-box-shadow:0 1px 3px rgba(0,0,0,0.5); text-shadow:0 -1px 1px rgba(0,0,0,0.25); border-bottom:1px solid rgba(0,0,0,0.25)}     .btn:active{-webkit-transform:translateY(1px); -moz-transform:translateY(1px)}          /* Sizes ---------- */     .small { font-size: 11px; margin:10px 0 }     .medium { font-size: 13px; margin:10px 0 }     .large { font-size: 14px; padding: 8px 14px 9px; margin:10px 0 }          /* Colors ---------- */     .blue { background-color: #2daebf }     .red { background-color: #e33100 }     .magenta { background-color: #a9014b }     .orange { background-color: #ff5c00 }     .yellow { background-color:#ffb515 }


title: Cloning the last few posts & comments only

text: I cloned an entire WP site to a different location a few weeks ago. The new site is being redesigned (but keeping the same content). In the meantime my client posted new posts with comments from her readers. What's the easiest way to clone those last few posts and comments? If the solution involves PhpMyAdmin, which tables will I be working with?


title: TinyMCE Styles Dropdown not adding html tags other than span

text: I am trying to add h1,h2 .. in the TinyMCE Styles Dropdown with my other html elements. I have tried the following code, but the problem is it only adds styles if I use `span` as 'block' value. If I use div, h3, h4, the code doesn't add anything I have searched a lot for the solution but haven't found anything helpful. Could you please tell me how to fix this problem? FYI: I am using wordpress 3.5.1               function my_mce_buttons_2( $buttons ) {     array_unshift( $buttons, 'styleselect' );     return $buttons;     }     // Register our callback to the appropriate filter     add_filter('mce_buttons_2', 'my_mce_buttons_2');               // Callback function to filter the MCE settings     function my_mce_before_init_insert_formats( $init_array ) {       // Define the style_formats array     $style_formats = array(           // Each array child is a format with it's own settings         array(               'title' => 'Head',               'block' => 'h4',               'classes' => 'headings',             'wrapper' => true,              ),           array(               'title' => 'Sub Heading',               'block' => 'span',               'classes' => 'subheadlines2',             'wrapper' => true,         ),          );       // Insert the array, JSON ENCODED, into 'style_formats'     $init_array['style_formats'] = json_encode( $style_formats );            return $init_array;             }           // Attach callback to 'tiny_mce_before_init'      add_filter( 'tiny_mce_before_init', 'my_mce_before_init_insert_formats' );


title: Recent posts in current category?

text:
On my category page (not single.php) I'd like to have the recent posts from that category in the sidebar, it also needs to be dynamic. I'm already doing something similar on single.php, but I can't think how to do it on the category.php page.
                   <?php                   $related = get_posts( array( 'category__in' => wp_get_post_categories($post->ID), 'numberposts' => 5, 'post__not_in' => array($post->ID) ) );              if( $related ) {              echo '
Related Articles

';              }         if( $related ) foreach( $related as $post ) {         setup_postdata($post); ?>
                                     <?php the_time('F jS, Y') ?>                                  <?php the_post_thumbnail('sidethumb'); ?>
<a href="<?php the_permalink() ?>"><?php the_title (); ?>

<?php echo excerpt(25); ?>

                   <?php }              wp_reset_postdata(); ?>

        Is it possible to have say the 20 recent posts from on the currently selected category? Uh, so I can't get your code to work.                               <?php         $max_posts = 20;         $cat_ID = get_cat_ID ( single_cat_title( '', false ) );         $args = array(             'category' => $cat_ID,             'numberposts' => $max_posts,         );         $myposts = get_posts( $args );         foreach( $myposts as $post ) {             setup_postdata( $post );             // display your posts with the_title(), the_excerpt(), etc           <php the_title (); ?>               }     ?>      If I put the `<php the_title (); ?>` etc in where you've written display your posts with title etc, it gives me a blank page. My category.php looks like this               <?php get_header(); ?>               <?php get_sidebar('catbar'); ?>

                       <?php if (have_posts()) : while (have_posts()) : the_post(); ?>                      <article <?php post_class('item') ?> id="post-<?php the_ID(); ?>">

By <a href="<?php echo get_author_posts_url(get_the_author_meta( 'ID' )); ?>"><?php the_author_meta('display_name'); ?>

                                                                            <?php comments_popup_link ('0', '1', '%'); ?>

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

                             <?php the_time('F jS, Y') ?>
                                              <?php                         if(has_post_thumbnail()) :?>
                                  <?php the_post_thumbnail(''); ?>                             <?php if( !empty( get_post( get_post_thumbnail_id() )->post_excerpt ) ) { ?>
                                     <?php echo get_post( get_post_thumbnail_id() )->post_excerpt ?>
                             <?php } ?>
                      <?php else :?>                     <?php endif;?>
                         <?php the_content('Read Full Article'); ?>

                            Share this Article:                      <input type="text" value="<?php the_permalink (); ?>">                          Show Sharing Options

                         <a  class="social-email" rel="nofollow" title="Email this page" href="mailto:?Subject=<?php the_title(); ?>&body=<?php the_permalink(); ?>">

                         <a class="social-twitter" rel="nofollow" href="http://twitter.com/home?status=Currently reading <?php the_permalink(); ?>" title="Share page via Twitter" target="_blank">

                     <a class="social-facebook" title="Share page via Facebook" rel="nofollow" href="http://www.facebook.com/sharer.php?u=<?php the_permalink();?>&t=<?php the_title(); ?>" target="blank">

                         <a class="social-goo" title="Share page via Google+"  href="http://plus.google.com/share?url=<?php the_permalink (); ?>" rel="nofollow" target="_blank">

                         <a class="social-linked" title="Share page via LinkedIn" rel="nofollow" href="http://www.linkedin.com/shareArticle?mini=true&url=<?php the_permalink (); ?>" target="_blank">

                             <?php endwhile; ?>                       <?php endif; ?>

                          <?php if(function_exists('wp_pagenavi')) { ?>                          <?php wp_pagenavi(); ?>                          <?php } else { ?>
<?php next_posts_link(__('Load More Articles')) ?>

<?php previous_posts_link(__('Newer posts')) ?>
                          <?php } ?>

                          <?php get_footer(); ?>


title: Custom template support for custom post type?

text: I know I can use `single-{posttype}.php` but can I use something like `single-{custom-post-type-slug}.php` to target a specific custom post type post? Or is there another way like a custom template which I can select from the admin? It doesn't seem to work on custom post type edit sreen.


title: Dropdown: Display terms from B only if has relationship with a term A selected

text: I've googling for a solution for this issue and found nothing: I have some posts from a Custom Post Type (Restaurants) and its taxonomies ('city' and 'cuisine'). Whenever I create a restaurant post, I can set many 'cuisine' terms as I want, but 'city' is single selected. I've also made a custom search using a html dropdown which I can search from 'restaurants' posts by filtering from its taxonomy terms. The search works well but what I really want is populate the second taxonomy (cuisine) only with terms that has some relationship based on the first taxonomy chosen (city). In the first dropdown, if someone choose the city 'New York' the second dropdown must display only cuisine terms that has relationship with 'New York' city term on restaurant posts. If there's not a post with 'brazilian' cuisine and 'New York' city registered, the 'brazilian' term must not appear on second dropdown. Of course, the cuisine dropdown doesn't have to display duplicated terms. Is that possible? Thanks in advance!


title: Expanding / Collapsing Modules in Wordpress Panel

text: I'm using WordPress 3.3.2. version. I can't able to expand / collapse modules in wordpress panel. I have deactivated all plugins and checked. But no result. If i disable Java Script, it is working well. Can any one please give me a solution?


title: How to add multiple chat rooms in a WordPress website

text: I am building a sports chat website and I cannot seem to find a good method to add multiple chat rooms. What I mean, for example - I want to create a chat room for each NFL team, but each chat room should be on its own page.


title: Transferring data to the end of a transaction with the Shopp Plugin

text: I'm using the Shopp Plugin, and basically, I need to send an email to a unique email address field that I've created on the front end. The transaction has to complete fully before sending it. I mean, money has to have been transferred successfully, etc. I've attached the fields to a particular set of products, and I can move the data between pages (via $_POST of course), ie; Product -> Cart -> Checkout... It's after this that's the problem. Landing on the Thank you page or whatever, I don't have access to the finalized list of items that were bought, via the $_POST method. Could someone point me in the right direction? Thanks


title: How to get the custom post type from an archive page?

text: In my website I have three custom post types: scripts, scenes and plugins. When visiting the archive page of a single post type (i.e. by going to mysite.com/plugins) you correctly see all the posts of that type. **In archive.php, how can I find out which custom post type the user is looking at right now?** I tried the following:               <?php          global $post;          $postTypeLabels = get_post_type_labels(get_post_type_object($post));          echo var_export($postTypeLabels);      ?>      But I'm getting the this:               Post name is stdClass::__set_state(       array( 'name' => 'Posts',          'singular_name' => 'Post',          'add_new' => 'Add New',          'add_new_item' => 'Add New Post',          'edit_item' => 'Edit Post',          'new_item' => 'New Post',          'view_item' => 'View Post',          'search_items' => 'Search Posts',          'not_found' => 'No posts found.',          'not_found_in_trash' => 'No posts found in Trash.',          'parent_item_colon' => NULL,          'all_items' => 'All Posts',          'menu_name' => 'Posts',          'name_admin_bar' => NULL,        )     )      I'm guessing that, since I am in an archive page, the $post is not correct. P.S. I know that I can create archive-plugins.php for the plugins archive. Unfortunately, I have installed a theme that, as far as I know, kinda prevents that. So this is not an option.


title: site_url and $current_user producing undesired results

text: I am trying to make the link like this: `site.com/forums/user/userid` using the code below. I think I messed it up though because it keeps producing an error on this line. `$buttons['Edit My Profile'] = site_url('/forums/user/')$current_user->user_login;` Here is more of the surrounding code:                   <?php              if ( is_user_logged_in() ) {                  global $current_user;             get_currentuserinfo();             $buttons    = array();                  if ( $sl_options['show_dashboard'] )                 $buttons['Dashboard']   = admin_url();                  if ( $sl_options['show_profile'] )                 $buttons['Edit My Profile'] =  site_url('/forums/user/')$current_user->user_login;                   $buttons['Log Out'] = ( $sl_options['redirect_logout'] == 'custom' && $sl_options['redirect_logout_url'] != '' ) ? wp_logout_url( $sl_options['redirect_logout_url'] ) : wp_logout_url( $this->current_url() );                           ?>       Can somebody please take a look and let me know where I went wrong on that line?


title: Get post type from taxonomy or category page

text: This might be somewhat backward, but how can one get the post type being displayed on an archive page? Alternatively, how can one get the post type associated with a given taxonomy?


title: Alternating post layout

text:
I am trying to create a layout with two different divs alternating vertically. For example the even has to be: picture + content; and the odd has to be: content + picture. Here is my code, at the moment it prints every post doubled, once per div:
     <?php if (have_posts()) : while(have_posts()) : $i++; if(($i % 2) == 0) : the_post(); ?>
         <a href="<?php the_permalink(); ?>"><img src="<?php echo $image ?>"/>

<a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link: <?php the_title(); ?>"><?php the_title(); ?>
              <?php the_content(); ?>

          <?php else : ?>
         <a href="<?php the_permalink(); ?>"><img src="<?php echo $image ?>"/>

<a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link: <?php the_title(); ?>"><?php the_title(); ?>
              <?php the_content(); ?>

          <?php endif; endwhile; endif; ?>
      Any hint on how can I fix it? Thank you in advance.


title: Using get_terms for custom taxonomy in functions.php

text: I`m trying to retrieve the names of taxonomy items and include them into a theme admin panel.               function retrieve_my_terms() {              global $terms;              $terms = get_terms('taxonomy');              foreach ($terms as $term) {             $option = $term->name;             return $option;         }     }      The function is added after the functions which created the custom post type and taxonomy. From what I've found out, it seems that the `init` action occurs after the theme's functions.php file has been included, so if I'm looking for terms directly in the functions file, I`m doing so before they've actually been registered. In other words, init action doesn't fire until after the theme functions file is included, therefore any term retrieval must occur after init. My problem is that I don`t know how to retrieve the terms after the init. Any answer will be much appreciated! Thank you! Madalin


title: Plugin to display weekly schedule that can be edited via admin panel

text: I am working on a simple wordpress site for a fitness club. They require a simple wordpress plugin that displays a static weekly schedule for their theater. They need to be able to specify what plays on what day of the week and what time. A full blown calender/event scheduler plugin is probably overkill for this as it just needs to display Day of Week, Event Title, Event time. Any ideas on what plugin I can use for this?


title: How to give "author" user role appropriate capabilities to add PollDaddy polls? WordPress multisite

text: At the moment, users with role "Author" can only view but not add or edit polls. "Editor" and "Administrator" (site administrator) can add and edit polls however. This is despite the fact that I have explicitly assigned "manage_polls" capability to "Author". I've tried both Advanced Access Manager 1.6.8 and User Role Editor 3.8.1 plugins which claim that they support WordPress multisite. Still, "Author" can't add or edit polls. I'm using WordPress 3.3.1 multisite. I strongly believe this has to do with multisite because "edit_users" capability does not work as it appears - How to enable a site administrator to edit users in a WordPress network/ multisite setup? Is this a PollDaddy's plugin bug or WordPress multisite's bug or is there any way I can enable "Author" to add/ edit polls with PollDaddy plugin?


title: Issues with Wordpress permalinks

text: I am new to wordpress but have experience in Drupal. I am developing wordpress site which I access as `localhost/site1`. I created another copy of it to experiment a few things. I can access another site as `localhost/site2`. The strange thing I see now is whenever I click on a post from `localhost/site2` it takes me to `localhost/site1`. For example I am taken to `localhost/site1/my-post` from site2 when expected is `localhost/site2/my- post`. Then I checked the database and saw the links were stored in posts table in guid column. I was expecting only relative URLs to be saved in tables(as in drupal) but here the full URL is saved in database. How can I make all URLs as `localhost/site2/my-post`? Also how can I make this work when I move it online to a particular domain ?


title: How to resize images in wordpress without adding any compression or changing the color profile of the images, possible?

text: As you can guess from the title, Im looking for a solution that allows me to alter the way Wordpress processes/saves its newly created images according to the media settings in the dashboard. This is very important since I primarily use Wordpress as a way to present portfolio images so they need to maintain the same color profile, etc. as they had when they were first uploaded. The problem is, once an image is resized by wordpress it tends to become desaturated because it changes the color profile, this needs to be altered somehow so that it stays the same as the original and only the pixel dimensions are changed. The easiest solution to this is to prepare your images to the exact size to be used prior to upload and then use the images actual size setting in wordpress' dialog while placing an image into a post, however this is not very convenient, nor is it exactly a very nice solution for clients that dont understand how to do such a thing before uploading.... Ultimately, Id like to avoid the use of a plugin and just alter the existing script that wordpress uses to process its photos/images, or possibly create a special function for the functions.php template if thats possible.... Thanks for the help in advance.


title: Wordpress get_categories & listing recent post thumbnail

text:
I'm trying to get a page to list all the child categories and then display their name and a thumbnail from the most recent post in that category. This is the following code I've got, it appears to be fetching some thumbnails from other posts that aren't in the category and also repeating the categories. Any help would greatly be appreciated.               <?php get_header(); ?>
                  <?php     $args = array(       'orderby' => 'name',       'order' => 'ASC',       'child_of' => '3592'       );     $categories = get_categories($args);       foreach($categories as $category) {             query_posts( $category->name . 'posts_per_page=1' );             while ( have_posts() ) : the_post();         echo '
';         echo '
'; the_post_thumbnail('interview-thumb'); echo '
';              echo '
term_id ) . '" title="' . sprintf( __( "View all posts in %s" ), $category->name ) . '" ' . '>' . $category->name.'
 ';         echo '
';         endwhile;         wp_reset_query();         }     ?>

          <?php get_footer(); ?>


title: Have WP Theme update from Git Repository

text: I have a client's theme currently hosted on github. Instead of doing a git deploy or using a service like Beanstalk's deployments. I will be pushing the same theme across many sites (79 to be exact) and want them to be able to update themselves just like a WP repo hosted theme. A good example is how the Genesis framework has it's updates work. I've seen things where you have another plugin installed to do this, but i'm looking for a more minimalist solution (if there is anyway to keep this functionality within the theme itself)?


title: How can I find all internal links that are pointing to post/page?

text: I have deleted a page and now I want to find all internal links that are pointing to this deleted page. So I need to know which posts/pages have a link to the deleted page. Is there a faster way to do this than just manually checking all your pages and posts? Please advise me.


title: Orderby comment_count ignored if multiple orderby values

text: I'm trying to order my archive page by comment_count then title.               add_action( 'pre_get_posts', 'my_change_sort_order');     function my_change_sort_order($query)     {         if (is_archive()) {            $query->set( 'orderby', 'comment_count title' );         }     }      However, comment_count is ignored and I just get my posts in descending order of title. It works fine if I just order by comment_count alone:               add_action( 'pre_get_posts', 'my_change_sort_order');     function my_change_sort_order($query)     {         if (is_archive()) {            $query->set( 'orderby', 'comment_count' );         }     }      Any ideas what I'm doing wrong? Or have I found a bug?


title: Cforms II conditional processing

text: I have a form with 2 email fields. When the form is submitted I need to check whether the emails entered in the form already exist in the database, if any one of the emails entered on the form exist I need to stop the form processing and send an error message back to the user. I am using `my_custom_filter` function inside my-functions.php but don't know how to stop further processing of the form Having read the code, I see a variable called `$all_valid` being used to check if the validation of the form fields passed. Can that variable be used inside `my_custom_filter` method?               function my_cforms_filter($POSTdata) {         ### triggers on your 2nd form         if ( isset($POSTdata['sendbutton2']) ) {             //query to check if the emails entered in the form already exist in the database             /* if emails_exist                    //may be set $all_valid to false so that further processing doesn't happen                else                    return $POSTdata;         }         /* return $POSTdata; */     }      Help is appreciated, thanks.


title: Custom Menu not functioning properly

text: I register 2 menus in my functions.php file:               register_nav_menus(array(         'main_menu' => 'Main Menu',         'bottom_menu' => 'Bottom Menu'     ));      I populate a menu in the admin and assign the theme location: ![Assigning menu location](http://i.stack.imgur.com/4bloQ.jpg) I call the menu in my theme:               <?php         wp_nav_menu('menu', 'main_menu');     ?>      After doing all this, `bottom_menu` is the menu showing up in my theme instead. Can anyone tell me what I'm doing wrong? Either I'm missing something really silly here or Wordpress is giving me the finger.


title: Recent posts widget

text: I use the normal 'recent posts' widget on a website. But it is also including my custom post type, I don't want this. I only want to show the posts from the real posts post type. I think it has something to do with my cpt code, just don't know what part. Does anyone know how to exclude my cpt from the recent posts widget ? **EDIT:** I did adjust my functions.php a few days ago so that my CPT would be shown also on archives.php, could this has something to do with it ? I do want to keep my CPT in archives


title: How to get current post id of a custom post type in a loop using template singel-{custom type}.php?

text: I have a custom post type template where am looping through all post. what i am trying is when i go to my custom post page i want to get the current post id in the loop. So i tried to check if the permalink is same for the post inside the loop if it is same i'll get the post id of the current post in the loop. Here is the code i tried First trying to get the permalink in outside to check it inside the loop               $permalink = get_permalink();      Now i got the current post permalink now i want to get the current post id               if($query->have_posts()) : while ($query->have_posts()) : $query->the_post();          if(the_permalink()==$permalink)                            {                              echo get_the_ID();                            }else                             {                              echo "not found";                               }                  endwhile;                       wp_reset_postdata();                   endif;      I tried this things in `single-{custom-post-name}.php` am getting `not found`. can anyone give me a way to get the current post id in this template?


title: Comments - Ensure the correct field is highlighted for nested replies

text: I've got my comments working great, well.... Just about Great!!!! I'm a passionate UX guy doing my blog. I've got the comments form to beautifully reposition its self under neath a comment so that it does nested comments. But I have one annoyance! When someone hits the reply button the comment field is highlighted / focussed. From a user's point of view this is wrong as it should be the first field that should be highlighted or none at all! Do you guys have any thoughts on how one could fix it so that when a user does reply that the comment field isn't the one that gets highlighted?   * Solution 1 would be just show the form - Don't highlight / focus on any fields   * Solution 2 would be highlight the first field in the form Would love to know your thoughts, on how I can achieve either.


title: How can I show my post under a certain content name?

text: I want to know how can I show my detail post under that post name. When I post something under a category it shows up with the description of that post in the category, there is no problem with it, when I posted my second post it shows up also with the description of my second post but I have to scroll down to my page to see the posts i made because both of the post shows up with their descriptions. I want to know how can I hyperlink my post name so that visitors can see my posts name sequentially as hyper-linked and my all descriptions and post content which is under the post name will appear after clicking my post name. **As example:** Suppose I made three post which titled are "A", "B" and "C", in my page I want to show only the title sequentially as "A", "B" and "C" and after clicking on any of the title name it will show its description. I hope you will understand what I am trying to say.


title: Custom Field select list is truncated

text: The site I'm working on has many custom fields being used in it's pages. For some reason though, the list of custom fields that you can pick from the dropdown only displays the first 30 field names. If I want to use an existing custom field that isn't, alphabetically, in the first 30, I have to manually type it in each time. Any idea why?


title: add_post_meta Adds post meta but the value is blank

text: My plugin uses a metabox to save post meta. I have three option in the metabox. Everything is saving/updating/deleting correctly except for this:               add_post_meta( $post_id, $meta_key_duration, $new_meta_value_duration, true );      If I echo out the values right before this call:               echo $post_id.' '.$meta_key_duration.' '.$new_meta_value_duration;      I get:               52 expDuration 10      this is correct since I chose "10" as the value to be saved. The database is showing the post_id and meta_id correctly but the value isn't being saved.


title: Saving Plugin settings to the database

text:
1. I'm not a complete novice with php or wordpress but am wanting to approach this problem the most efficient way so believe asking here will help.   2. I've got a plugin that randomly generates a quote - I've got to the point where I need to save the quote to the mysql DB.   3. I want to know the best way to save the data whether its using the settings api or simply saving it to an array.    4. I'm also wanting to implement the option of deleting a quote.   5. Using the input text field, I want to know how I can add new quotes in the textbox and pass the data to the array holding the quotes. My code far (The quotes are stored in an array at the moment)               <?php          /*idea to develop further would be, add a text box that the user can input the quote in     this then gets added to the DB and passed to the $quotes array. From here the results get     output the same way*/     /*     Plugin Name: Random Quotes     Plugin URI: xxx      Description: This Plugin randomly generates Quotes input by the user.     Version: 0.0.1     Author: xxx     Author URI: xxx     License: GPL2     */          add_action('admin_menu', 'dw_quotes_create_menu');          function dw_quotes_create_menu() {         //create custom top-level menu         add_menu_page('Quotes Settings', 'Quotes Styling', 'manage_options', __FILE__, 'dw_styling_quotes_settings');     }          function dw_styling_quotes_settings() { ?>
             <?php screen_icon( 'plugins' ); ?>
Quotes Page

                 Input Quotes in the textbox	                     <input type="textarea" name="random_quote" value="" />

     <?php }           // add quotes to this list     $quotes = array(                 "one" => "The weak can never forgive. Forgiveness is the attribute of the strong",                 "two" => "Be strong when you are weak, Be brave when you are scared, Be humble when you are victorious",                 "three" => "Our success is achieved by uniting our strength, not by gathering our weaknesses",                 "four" => "One of the most common causes of failure is the habit of of quitting when one is overtaken by temporary defeat",                 "five" => "The struggles make you stronger and the changes make you wise! Happiness has its own way of taking its sweet time"                 );          // uses array_rand to randomly pick a quote     $rand_quotes = array_rand( $quotes);          // pass's the result of $array_rand to $result_quotes     $result_quote = $quotes[$rand_quotes];          // outputs the result     //echo $result_quote;          ?>


title: Check if custom thumnail size image has been cropped to the correct dimensions

text: I'm looking for a way to check if an image has properly created a custom thumbnail size that has been hard cropped.               add_image_size( 'homepage-thumb', 1676, 828, true );          $size = "homepage-thumb";      echo wp_get_attachment_image( $attachment_id, $size );      This works well if the uploaded image is large enough but if it's smaller than the dimensions defined in add_image_size the aspect will be out which invariably breaks a layout. Is there a way to check the thumbnail before echoing the image?