in_category() works in single.php but not in page.php?

I'm using `in_category(array)` inside The Loop to detect whether a post is categorised into the Discussion category (or has one of a couple of slugs). This works beautifully on `single.php` but doesn't even seem to be evaluated when used inside `page.php`? FWIW, here's my code:               <?php if ( in_category( array( 'Discussions', 'discussion', 'discussion-article' ) )) :?>
This is an article from our Discussions series - read more in the Discussions section.
     <?php endif;?>      On the borked page.php instance, I've also tried               <?php elseif:?>
This post does not meet the category criteria.
     <?php endif;?>      but that doesn't show either leading me to believe the code's not being evaluated. This code snippet was, in both instances, inserted directly before `<?php the_content(''); ?>` (`the_content()` in single.php); it just doesn't eval or show up in page.php. Intentional behaviour or am I doing it wrong?


Add ASC / DESC to custom post columns

Im using the following code to create custom columns in the backend of the posts menu.               add_filter('manage_edit-post_columns', 'post_edit_columns');         function post_edit_columns( $columns )         {             $columns = array(                 'cb'            => '<input type="checkbox" />',                 'title'         => 'Module Title',                 'categories'    => 'Section',                 'menu_order'    => 'Order',                 'unlock'        => 'Unlock',                 'date'          => 'Date'             );             return $columns;         }      The `title` column outputs an ASC / DESC link. How can i add this ordering link to the other columns?


Global variable set in the template's header.php is unable to echo in footer.php

E.g. I set this in header.php in my template:               <?php $postidextra = get_the_ID(); ?>      <?php $sidebar_state = get_post_meta($postidextra , 'rw_sidebar_state', true); ?>      And I can echo $sidebar_state in header.php, it's working. However, when I try to echo this variable from footer.php or page.php it's not working and I need to repeat my code to get the post id and post meta etc. which is repeating and a bad practice. **Why it's not available if it is just include?** How to make the variable available in all files across WP template files? **UPDATE:** After suggestion to use global variables I am still unable to `echo $sidebar_state;` in footer.php. My code in header.php looks like this:                <?php global $postidextra; ?>       <?php $postidextra = get_the_ID(); ?>      <?php global $sidebar_state; ?>      <?php $sidebar_state = get_post_meta($postidextra , 'rw_sidebar_state', true); ?>      Footer.php looks like this:               <?php     /**      * The template for displaying the footer.      *      * Contains footer content and the closing of the      * #main and #page div elements.      *      * @package WordPress      * @subpackage Twenty_Twelve      * @since Twenty Twelve 1.0      */     ?>         </div><!-- #main .wrapper -->         <footer id="colophon" role="contentinfo">             <div class="site-info">                 <?php echo $sidebar_state; ?>             </div><!-- .site-info -->         </footer><!-- #colophon -->     </div><!-- #page -->          <?php wp_footer(); ?>     </body>     </html>      `<?php echo $sidebar_state; ?>` is wokring only in header.php . Any idea what should I change in my code?


Native "playlist" shortcode random playing... How?

I'm using the beautiful shortcode "playlist" in my site but I want the random playing of my audio files. What I use is this: > [playlist tracklist="false" images="false" artists="false" > ids="7691,7690,7688,7687,7686,7685,7684,7683,7682,7681,7680,7679,7678,7677,7676,7674,3978,3647,3408,1395,1217,1216,1214,1213,1211,1210,1209,1208,1207,1206,1181,975,899,668,663,642,641"] How to make random playing, maybe also with dad jQuery?


Conditional category & tag statement

I'm just working on a "quick" change to the blog-entry-subtitle of specific posts in a category on my wordpress website. I'm hoping to have "Published in Orchard and Vine Magazine on:" instead of "Posted on:". You'll see that the page I'm trying to customize is here               <?php if ( is_category('Legal Libation Columns') ) : ?>
Published in Orchard and Vine Magazine on: <?php the_time('F j, Y'); ?>
     <?php  else: ?>
Posted on: <?php the_time('F j, Y'); ?>
     <?php endif; ?>      GREAT! I love it. However once you click on one of those posts to read more it converts the blog-entry-subtitle back to the "Posted on:" as now you aren't in the specific category anymore. I would like the "Published in Orchard and Vine Magazine on:" instead of "Posted on:" for all posts with a category and tag of Legal Libation Columns. So then I try this.               <?php if (is_category('Legal Libation Columns') && has_tag('Legal Libation Columns')); ?>
Published in Orchard and Vine Magazine on: <?php the_time('F j, Y'); ?>
     <?php  else: ?>
Posted on: <?php the_time('F j, Y'); ?>
     <?php endif; ?>      However I get a weird white screen of nothing? ![enter image description here](http://i.stack.imgur.com/aT7Aq.png) How do I have it so that any post with the tag Legal Libation Columns always has that specific blog-entry-subtitle without giving me an error?


How to add a field to live preview in post editor?

WordPress 4.0 allows live previewing of certain shortcodes while editing a post. How can I customise the options that appear when I edit my embedded video? I want to add a custom field below the already existing "title" field. That field shall contain data that is assigned to that specific embedded video. The screenshot should make it clear: ![Add field to embedURL options](http://i.stack.imgur.com/KnqTQ.png) Maybe those pages help you to solve my issue: wp_editor or wp-views. Any help will be appreciated! Best regards, Kevin


Drop Up Menu with a twist

I am trying to make menu tabs slide up like a bookmark on hover so that the main menu item is still on top and the submenu slides up with it. I am using TwentyTwelve WordPress theme. Is this possible with CSS? Thanks


How to select widgets top bottom?

i'm add widgets in functions.php:               register_sidebar(array('name'=>'sidebar1'));     register_sidebar(array('name'=>'sidebar2'));      in index.php how to code: set options sidebar1 or sidebar2 to top index. i'm add index.php               <?php if (!function_exists('dynamic_sidebar') || !dynamic_sidebar('sidebar1')) : ?><?php endif;?>     <?php if (!function_exists('dynamic_sidebar') || !dynamic_sidebar('sidebar2')) : ?><?php endif;?>      but not setlect sidebar2 to top sidebar1 Thanks!


Count posts by type including drafts and pending posts

I had this function that counts posts number by type (taken from wordpress codex)               function count_user_posts_by_type($userid, $post_type) {         global $wpdb;         $where = get_posts_by_author_sql($post_type, TRUE, $userid);         $count = $wpdb->get_var( "SELECT COUNT(*) FROM {$wpdb->posts} $where" );         return apply_filters('get_usernumposts', $count, $userid);     }      and I changed it in order to display even posts with "draft" and "pending" status.               function count_user_posts_by_type($userid, $post_type) {         global $wpdb;         $where = get_posts_by_author_sql($post_type, TRUE, $userid);         $count = $wpdb->get_var( "SELECT COUNT(*)                                  FROM {$wpdb->posts} $where                                  AND (post_status = 'publish' OR post_status = 'draft' OR post_status = 'pending')");         return apply_filters('get_usernumposts', $count, $userid);     }      but it doesn't work. If I echo the function like this               echo count_user_posts_by_type(wp_get_current_user()->ID, 'percorso');      I can see it counts just published posts. What's wrong with what I wrote? Thanks! EDIT: as suggested, I performed a var_dump for SELECT COUNT etc. here's what I got               string(216)          "SELECT COUNT(*) FROM mi_posts          WHERE post_author = 1          AND post_type = 'percorso'          AND (post_status = 'publish' OR post_status = 'private')          AND (post_status = 'publish' OR post_status = 'draft' OR post_status = 'pending')"


Pretty URLs with Categories and Tags

How do I create pretty permalinks for a query page that includes results from both categories and tags. For instance, if the category is Country (America) and the tag name is city (New York), can I have a permalink like wordpressblog.com/america/new-york for a page that shows all posts belonging to Amercia category and NY tag? Thanks much!


How do I adjust/remove img widths when embedding posts in a narrower external site?

I have a blog on a PHP site i.e. http://mywebsite.com/blog/ and want to embed complete posts in a page on http://mywebsite.com/               include('blog/wp-load.php');     $post=get_post($postid);     $content=apply_filters( 'the_content', $post->post_content );     $title=apply_filters( 'the_title', $post->post_title );      My site is responsive and narrower than the Wordpress theme, so some of the wider images and YouTube embeds in the posts are breaking the layout. I could do some regex stuff to find images etc in the content and replace the widths/heights but I wondered if there was a better way to do this? Cheers


How to activate the child theme in Wordpress?

I create a new style.css and use it in child theme. And I create a new folder in wp-content and name it as themename-child and upload the style.css that I created. Now, I go to wp dashboard -> Appearance -> Themes and I look the child theme that I create. And I found this error:               Broken Themes          The following themes are installed but incomplete. Themes must have a stylesheet and a     template.          Name    Description     Accesspress Lite    The parent theme is missing. Please install the "AccesspressLite" parent theme.      Here's the css child theme format:               /*     Theme Name:   Accesspress Lite     Theme URI:    http://access-keys.com/accesspresslite/     Description:  Accesspress Lite Child Theme     Author:       Yang     Author URI:   http://www.example.com     Template:     accesspress-lite     Version:      2     Tags:         blue, white, light, custom-menu, one-column, two-columns, three-columns,   left-sidebar, right-sidebar, fixed-layout, fluid-layout, custom-background, featured-image-header, sticky-post, theme-options, threaded-comments, featured-images, full-width-template, custom-header, flexible-header, responsive-layout     Text Domain:  accesspress-lite-child     */          @import url("../accesspress-lite/style.css");


How do I hide Wordpress users from security scanning?

We are about to launch a Wordpress site hosted internally. As a standard practice, our IT security team does their check for any vulnerabilities. And sadly, they are able to retrieve the list of Wordpress users/accounts. Is there a way to hide them? I am envisioning this made involved changes to Wordpress PHP files so I asked here in stackoverflow. Thanks a lot


Grab all Custom Posts by multiple taxonomies and terms

I have 4 custom taxonomies with multiple terms for a "Members" page. I have a taxonomy of "location" and "organize" that I'm trying to separate into a list. I need to grab all posts by the "aba-therapists" term in the "organize" taxonomy and separate those by their "locations." If that makes sense to anyone. Something like this: ## ABA Therapist Term of Organize Taxonomy ### Term 1 of Location Taxonomy Post Post Post Post ### Term 2 of Location Taxonomy Post Post Post Post ### Term 3 of Location Taxonomy Post Post Post Post This is the code I have, which just pulls in every post within the "members" CPT and organizes by every term:                   foreach ($taxonomies as $taxonomy){             $terms = get_terms($taxonomy, array('orderby' => 'date', 'order' => 'ASC'));                  if ( !empty( $terms ) && !is_wp_error( $terms ) ){                 foreach ( $terms as $term ) {                     $args = array(                         'post_type'           => $post_type,                         'orderby'             => 'date',                         'order'               => 'ASC',                         'ignore_sticky_posts' => 1,                         'post_status'         => 'publish',                         'posts_per_page'      => - 1,                         'tax_query'           => array(                             array(                                 'taxonomy'    => $taxonomy,                                 'field'       => 'slug',                                 'terms'       => $term->slug                             )                         )                     );                     $my_query = null;                     $my_query = new WP_Query($args);                     if ($my_query->have_posts()) {                         echo '

' . $term->name . '

';                                  while ($my_query->have_posts()) : $my_query->the_post(); ?>                                      <a href="<?php the_permalink(); ?>">                                     <?php if ( has_post_thumbnail() ) : ?>                                         <?php the_post_thumbnail('cac-small'); ?>                                     <?php else : ?>                                         <img src="<?php echo get_template_directory_uri(); ?>/img/profile-placeholder.png" alt="Default Image">                                     <?php endif; ?>

<?php the_title(); ?>

                                                                   <?php                             endwhile;                      } // END if have_posts loop                         echo '

'; // Close 'details', 'wrap', & 'members' DIVs                     wp_reset_query();                  } // END foreach $terms             }         }     ?>      I'm lost on where to start. Anyone have any clues?


jQuery undefined function error with WP jQuery, but works with Google CDN

I've been reading several articles dissuading WP developers from replacing the enqueued jQuery with the Google CDN version of jQuery. I'm sold. I am now enqueueing the WP jQuery version which uses jQuery.noConflict(). However, I am getting the 'undefined is not a function' error in a home-grown .js file that uses $ selectors. Even when I change the selector to 'jQuery' I still get the error. I made sure that jquery is loaded prior to the .js file. For testing, if I switch out the WP jQuery enqueue with Google CDN's version, I get no errors at all. I want to be able to use WP's jQuery, but I can't seem to get it to work with the home-grown jquery code. Any thoughts on other debugging ideas? EDIT: Here's a slice of the home-grown .js file that is failing:               var brk = {         start: function($){              $("#navigation ul li a").css("color", "#FFF").css("text-decoration", "none");         $("#topButtons a.clearbtn").css("color", "#FFF").css("background", "transparent").css("border", "1px solid #FFF");         }     }          jQuery(document).ready(brk.start($));      The 'undefined is not a function' error is on the first $ line: $("#navigation ul li a")...


how to Specifies an author / editor to edit one category only?

let me say i have a news website and it have many categories like sports ,politics and art . so i want to specify or select one of my authors "Bob" to be an editor for sports only for example .... how this could be ?? i found a level choice to select for editing over multi user something like :               administrators == administrator roles     editors == editor level .....etc       ...in this link http://codex.wordpress.org/Function_Reference/add_role But i want like this :               Bob == admin of political category posts     Maria == admin of Sports category posts     Dr.Adam == admin of health category posts      i want to select one (admin)user by name or password for every category


Theme Check gives: Required: This theme doesn't seem to display tags?

I am testing my theme with _Theme Check plugin_ and it shows this message: > Required: This theme doesn't seem to display tags? Picture: ![enter image description here](http://i.stack.imgur.com/NJC9T.png) How can i fix this?


Custom registration field to SQL database

I have created new columns in a SQL table called `wp_users`. Those fields are "giodo", "handel" and "regulamin". What I want to do is to add '1' to each column when a user registers and selects corresponding checkboxes. I added checkboxes to the form using form_register and then I added those checkboxes to user data with this (here is an example for only one of them):               add_action('user_register', 'myplugin_user_register');     function myplugin_user_register ($user_id) {         if ( isset( $_POST['giodo'] ) )             update_user_meta($user_id, 'giodo', $_POST['giodo']);     }      Can I somehow add their values to the database?


How to hook into user registration process Before user registers

I need to add a field to the user registration form and then validate it before I add a new user to my WordPress I know how to hook into the registration form via `add_filter('register_form', 'my_function');` But how do I hook into the registration process before the user registers? Hence I do not want `add_action('user_register','my_other_function');`.


How to stop form resubmission on page refresh

Hi I have a form that adds attachments to a post, however when the form posts it obviously doesn't show the post with the new attachment echoing "your file has been uploaded". When the user refreshes the page (to try and show their new attachment) the form posts again! Is it possible to either (1) stop the form posting again on refresh, (2) automatically refresh the page to display the post with its new attachment?? (2 is way better)               <?php $post_id = $post->ID;     if ( isset( $_POST['html-upload'] ) && !empty( $_FILES ) ) {     require_once(ABSPATH . 'wp-admin/includes/admin.php');     $id = media_handle_upload('async-upload', $post_id); //post id of Client Files page     unset($_FILES);     if ( is_wp_error($id) ) {         $errors['upload_error'] = $id;         $id = false;     }          if ($errors) {         echo "
There was an error uploading your file.
";     } else {         echo "
Your file has been uploaded.
";     }     }          ?>     <form id="file-form" enctype="multipart/form-data" action="<?php echo $_SERVER['REQUEST_URI']; ?>" method="POST">
upload     <input type="file" id="async-upload" name="async-upload"> <input type="submit" value="Upload" name="html-upload">

<input type="hidden" name="post_id" id="post_id" value="<?php echo $post_id ?>" />     <?php wp_nonce_field('client-file-upload'); ?>     <input type="hidden" name="redirect_to" value="<?php echo $_SERVER['REQUEST_URI']; ?>" />

<input type="submit" value="Save all changes" name="save" style="display: none;">
     </form>      Thanks! :)


Resort get_categories

I have a get_categories array               $args=array(         'orderby' => 'id',         'order' => 'ASC',         'taxonomy' => 'wpsc-variation',         'hierarchical' => 1,         'hide_empty' => 0     );     $variationCategories=get_categories($args);      I display those categories as a checkbox.               foreach($variationCategories as $category) {              if (in_array($category->term_id, $parentArray)) {             if ($category->parent == 0) {                 echo "

<input type='checkbox' checked name='variationParent[]' autocomplete='off' value='". $category->term_id ."'>" . $category->name . "";             } else {                 echo "

<input type='checkbox' checked name='". $category->parent ."-". $category->term_id ."' autocomplete='off' value='1'>" . $category->name . "

";             }         } else {             if ($category->parent == 0) {                 echo "

<input type='checkbox' name='variationParent[]' autocomplete='off' value='". $category->term_id ."'>" . $category->name . "";             } else {                 echo "

<input type='checkbox' name='". $category->parent ."-". $category->term_id ."' autocomplete='off' value='1'>" . $category->name . "

";             }         }          }      the problem is order, I want to order this by parent value of `$variationCategories[]` This is a dumped version of $VariationCategories it's not problem order it by parent with usort:               function cmp($a, $b) {         return strcmp($a->parent, $b->parent);     }     usort($variationCategories, "cmp");      but that's only works for child categories. but there are also parents which have parent value "0". The order I want is: 0 (parent:0) 1 (parent:3) 2 (parent:3) 3 (parent:3) 4 (parent:0) 5 (parent:4) 6 (parent:4) 7 (parent:4) like this ![screenshot](http://i.stack.imgur.com/6n8C8.png) where color,size and CPU arrays has ->(parent:0) and others are sorted by ID, but when I add new category it appends in the end, because it sorted by id by now Can I resort/recreate such array?


Excluding certain post status's from pagination

If a user is logged in and browsing through archives, the current pagination function factors in posts that aren't yet published which can result in page numbers leading to 404 pages. How can I get the pagination function to only factor in published posts? This is the pagination function I'm using currently:               // Pagination     function ta_page_navi() {         global $wp_query;         $bignum = 999999999;         if ( $wp_query->max_num_pages <= 1 )             return;         echo '<nav class="pagination">';                  echo paginate_links( array(                 'base'          => str_replace( $bignum, '%#%', esc_url( get_pagenum_link($bignum) ) ),                 'format'        => '',                 'current'       => max( 1, get_query_var('paged') ),                 'total'         => $wp_query->max_num_pages,                 'prev_text'     => '←',                 'next_text'     => '→',                 'type'          => 'list',                 'end_size'      => 3,                 'mid_size'      => 3             ) );              echo '</nav>';     } /* end pagination */


Is there some way to put a theme's header.php and footer.php in a subdir

and still call them with get_header() / get_footer()? For example {themedir}/templates/headers/header.php of {themedir}/templates/footers/footer.php With templates this is easy, but I can't get it to work with get_header() and get_footer(). Thanks in advance!!


New install of wordpress, my url goes to index of/

After my Wordpress installation (database hooked up and wp-config done and wp- login created). I just get Index of/ page when I go to my URL. I uploaded all the contents of the Wordpress folder to the document-root of my Apache VirtualHost, after downloading it and unzipping. Im taken to index of/ page for everything unless I specifically navigate to the page.. . I can get to the admin menu/dashboard (all admin stuff I can access). But there is nothing at my home URL. The site is labelleviemodesto.com. If i go there I get the index of/. If I try and go to labelleviemodesto.com/sample-page I get a 404 not found. What did I miss while installing? I made sure index.php is the first to be accessed in apache's dir.conf. I also noticed if I create a new page it cant be accessed either.


Inserting code to HTML view from a pop up initiated from visual view

I am trying to insert html into the HTML view.What i have done is to have tinymce advanced(a wordpress plugin) button that throws a popup and in it is all the necessary things to insert the html.The tinymce buttons are however only visible on the visual view. Question 1: Is it a plugin or hack that can allow one to parse html inside the visual view Question 2: Is it possible to insert html code to the html view from a popup initiated from the visual view


How to configure comments evolved for wordpress for pages?

I have installed Comments Evolved for WordPress to enable comments in my sites. there are so many pages and posts in my sites. i have activate this plugin succesfully. this plugin works fine with pages. but in posts whole reply section is not displayed. so is there any configuration for pages? please guide me to overcome this error. Please help


How to sort the admin area of a WordPress custom post type by a custom field

When editing one of my custom post types I want to be able to list all entries by a custom field instead of the date they are published (which, for a custom post type probably isn't relevant). I got a lead from the comments of a blog post about custom post types and the author said it was possible and that he even made it so you could click on the column names for a custom sort. He mentioned the `posts_orderby` function which I noted in my own comments but now I can find the blog post anymore. Any suggestions? I saw one solution that used               add_action('wp', 'check_page');      And the `check_page` function used `add_filter` to change the query but I'm pretty sure it would only work in the theme files, not in the admin area.


Editing default WP Comment Form

I am creating a new WP theme which is built on Bootstrap Framework. For making the comment for responsive certain class to be added to the element for the form. In the comments.php file I used the $fields = array(); and modified the Name, Email Id and Website fields. I now want to modify the Comment label and it associated textarea and also the allowed tag section. Can anyone help me out? Here is what I have written in comments.php:               <?php      //Fields in Comment Form     $fields =  array(              'author' => '
             ' . __( 'Name' ) . ( $req ? '*' : '' ) . '
                 <input id="author" name="author" type="text" value="' . esc_attr( $commenter['comment_author'] ) . '" size="30"' . $aria_req . ' />

',              'email' => '
             ' . __( 'Email' ) . ( $req ? '*' : '' ) . '
                 <input id="email" name="email" type="text" value="' . esc_attr(  $commenter['comment_author_email'] ) .'" size="30"' . $aria_req . ' />

',              'url' => '
             ' . __( 'Website', 'domainreference' ) . ( $req ? '*' : '' ) . '
                 <input id="url" name="url" type="text" value="' . esc_attr(  $commenter['comment_author_url'] ) . '" size="30" />

',          );          $comments_args = array(         'label_submit'=>'Submit Comment',         'title_reply'=>'Leave A Comment',         'fields' =>  $fields,                );          comment_form($comments_args);?>


More flexible sidebar and widget management

I’d like to have a plugin for a flexible sidebar/widget management. In fact, I want to give a user the possibility to choose which sidebar should be displayed per page/post. I know there are many sidebar plugins out there. Unfortunately, I haven’t found one which cover all my wishes. So I’d like to code this on my own. Which of the following possibilities do you find is the best and most flexible? Or do you have other approaches? ## Posibilities   1. Hardcode the register_sidebar calls in a plugin/functions.php and add a metabox for the `post_edit.php`, `post_new.php` screens.     * Not that flexible. If a user has 100 pages and every page should have a different sidebar, the user has to register additional sidebars manually.   2. Same as Nr.1 but use a generic sidebar template with conditional tags to display the widgets. We could also use the plugin Widget Logic for a more granular filtering in the backend.     * Good for a programmer or experienced WordPress user, but not for a normal user. The conditional tags must be mapped in a friendly manner. Also `is_page(id)` could create problems on multilingual sites, where posts of a different language are stored with another id.   3. A **_flexible-sidebars_** Custom Post Type. Every post in this CPT is used in a generic sidebar-template to display the given content. The sidebar is also selected within a custom metabox. The user can add content to the sidebar with the default WYSIWYG editor which is a big plus.     * Not a „real“ sidebar. Therefore widgets couldn’t longer be added on the widgets-subpage in the admin panel. We have to create an own metabox for widget-assignments.   4. Modify the widgets-subpage in the admin panel to create/register your own sidebars in WordPress. Also create a generic widget with a default WYSIWYG editor. Content with attachments could easily be added to the widget and draged to the new created sidebar. The user could then choose this sidebar with a drop-down field in a custom metabox in the post/page admin screens. To display the sidebar, we need also a generic sidebar-template. ## Conclusion From my point of view, Nr.4 should do the trick. Are there any other possibilities? Or does this already exists in a plugin? Thanks for your reply


functions.php conditional tag - only show in single.php?

//Geo Map     add_action( 'woo_post_inside_after', 'my_geo_mashup' );     function my_geo_mashup() {         global $post;     if ( in_category('listings') ) {             echo GeoMashup::map();            }     }      Works to embed my map tag only on my single posts categorized as "listings" But, the embedded tag is also showing within the index of posts (thumb, title, meta, excerpt) and I need to remove it from the loop of posts and have it only show on the single.php thoughts?


How do I write into a file (css)

I'm writing my first wp plugin and I have many problems, most of those I got to solve by just reading the codex, but I don't know how to write into a css file within my plugin's options. Maybe there's a better way of doing it, but what I had in mind was using a text field and saving that into an empty custom.css file that would be packed with the plugin. I don't want having to save css info into the wp_options table. Is there a standardized way of having custom css for your plugins which could be changed by the user without having to open the css file themselves?? Thanks in advance


hard code shortcode only on specific category

I am looking to embed several shortcodes into my post template, but I want the tags to be conditional to a specific category (and subcats). I've looked through the codex, but I'm unsure where to start.


Disable Admin account being emailed for comment notification

I am using the code below to send Comment notification and moderation emails to multiple email addresses for a client site. I have a custom admin panel for this particular site. In my admin panel I have a field that holds a comma separated list of emails that should be notified anytime a comment is posted and needs approval or notified. It works great however my client has 1 issue. As my client is also the Admin of the site, they are receiving a comment notification email to the email address that is under there account settings. So in addition to emailing my comma separated list of emails, it also em,ails the Admin account email. I am looking for help on how I can disable it emailing the Admin account and ONLY sending an email to the emails in my custom setting which this code below is doing already. Any ideas on how to do this please?               /**      * Email Multiple people when a Comment is Posted      */     add_action('comment_post', 'wp_notify_allmods');     function wp_notify_allmods($comment_id) {         global $wpdb;              $cn_recipients = get_option('custom_comment_emails');         //$cn_recipients = 'jason.davis@gmail.com,David@email.com,Tracey@custom.com';         //$moderated_only_option = get_option("cn_moderated_only");         //         $comment = $wpdb->get_row("SELECT * FROM $wpdb->comments WHERE comment_ID='$comment_id' LIMIT 1");         $post = $wpdb->get_row("SELECT * FROM $wpdb->posts WHERE ID='$comment->comment_post_ID' LIMIT 1");         $blogname = get_option('blogname');         $blogurl = get_option('siteurl');         $comment_author_domain = @gethostbyaddr($comment->comment_author_IP);              if (get_option('comment_moderation') == 1) {  //if we need to send comment moderation email             $comments_waiting = $wpdb->get_var("SELECT count(comment_ID) FROM $wpdb->comments WHERE comment_approved = '0'");             $notify_message  = sprintf( __('A new comment on the post #%1$s "%2$s" is waiting for your approval'), $post->ID, $post->post_title ) . "\r\n";             $notify_message .= get_permalink($comment->comment_post_ID) . "\r\n\r\n";             $notify_message .= sprintf( __('Author : %1$s (IP: %2$s , %3$s)'), $comment->comment_author, $comment->comment_author_IP, $comment_author_domain ) . "\r\n";             $notify_message .= sprintf( __('E-mail : %s'), $comment->comment_author_email ) . "\r\n";             //$notify_message .= sprintf( __('URL    : %s'), $comment->comment_author_url ) . "\r\n";             $notify_message .= sprintf( __('Whois  : http://ws.arin.net/cgi-bin/whois.pl?queryinput=%s'), $comment->comment_author_IP ) . "\r\n";             $notify_message .= __('Comment: ') . "\r\n" . $comment->comment_content . "\r\n\r\n";             $notify_message .= sprintf( __('Approve it: %s'),  $blogurl."/wp-admin/comment.php?action=mac&c=$comment_id" ) . "\r\n";             $notify_message .= sprintf( __('Delete it: %s'), $blogurl."/wp-admin/comment.php?action=cdc&c=$comment_id" ) . "\r\n";             $notify_message .= sprintf( __('Spam it: %s'), $blogurl."/wp-admin/comment.php?action=cdc&dt=spam&c=$comment_id" ) . "\r\n";             $notify_message .= sprintf( __('Currently %s comments are waiting for approval. Please visit the moderation panel:'), $comments_waiting ) . "\r\n";             $notify_message .= get_option('siteurl') . "/wp-admin/moderation.php\r\n";             $subject = sprintf( __('[%1$s] Please moderate: "%2$s"'), $blogname, $post->post_title );             $notify_message = apply_filters('comment_moderation_text', $notify_message, $comment_id);             $subject = apply_filters('comment_moderation_subject', $subject, $comment_id);             $message_headers = "";                  $cn_recipients_array = explode(",", $cn_recipients);                  foreach ($cn_recipients_array as $email) {                 @wp_mail($email, $subject, $notify_message, $message_headers);             }         } else {  //or just a regular "you've got a new comment" email             if ($moderated_only_option != 1) { //if comments are not modded but update notifications are set to moderated only don't send                 $notify_message  = sprintf( __('New comment on your post #%1$s "%2$s"'), $comment->comment_post_ID, $post->post_title ) . "\r\n";                 $notify_message .= sprintf( __('Author : %1$s (IP: %2$s , %3$s)'), $comment->comment_author, $comment->comment_author_IP, $comment_author_domain ) . "\r\n";                 $notify_message .= sprintf( __('E-mail : %s'), $comment->comment_author_email ) . "\r\n";                 $notify_message .= sprintf( __('URL    : %s'), $comment->comment_author_url ) . "\r\n";                 $notify_message .= sprintf( __('Whois  : http://ws.arin.net/cgi-bin/whois.pl?queryinput=%s'), $comment->comment_author_IP ) . "\r\n";                 $notify_message .= __('Comment: ') . "\r\n" . $comment->comment_content . "\r\n\r\n";                 $notify_message .= __('You can see all comments on this post here: ') . "\r\n";                 $subject = sprintf( __('[%1$s] Comment: "%2$s"'), $blogname, $post->post_title );                 $notify_message .= get_permalink($comment->comment_post_ID) . "#comments\r\n\r\n";                 $notify_message .= sprintf( __('Delete it: %s'), get_option('siteurl')."/wp-admin/comment.php?action=cdc&c=$comment_id" ) . "\r\n";                 $notify_message .= sprintf( __('Spam it: %s'), get_option('siteurl')."/wp-admin/comment.php?action=cdc&dt=spam&c=$comment_id" ) . "\r\n";                 $notify_message = apply_filters('comment_notification_text', $notify_message, $comment_id);                 $subject = apply_filters('comment_notification_subject', $subject, $comment_id);                 $message_headers = "MIME-Version: 1.0\n"                     . "$from\n"                     . "Content-Type: text/plain; charset=\"" . get_option('blog_charset') . "\"\n";                 $message_headers = apply_filters('comment_notification_headers', $message_headers, $comment_id);                      $cn_recipients_array = explode(",", $cn_recipients);                      foreach ($cn_recipients_array as $email) {                     @wp_mail($email, $subject, $notify_message, $message_headers);                 }             }         }              return true;     }


Featured image in admin on custom post type

I followed this tutorial to getting featured images to show in the admin menu on posts. I wanted to be able to see what article had a featured image and what it looked like without having to actually edit the article. The article worked, but I noticed that it didn't work on my custom post type. So I went looking for the filter that would make it work and found manage_edit-post_type_columns I have a custom post type for "Events". The slug for this is "events". I figured from the codex that if I did this               add_filter('manage_events_custom_columns', 'ST4_columns_content', 10, 2);      It would work but it has not. I can see the column for the featured image in the admin menu but I do not see the image in the column next to the post.


Theme Option is not allowing two advertising for home only and rest of site

My Wordpress Theme(Themforest Hottopix) comes with a "theme options" section that allows you to add an ad on the header 970x90 however I was given two ads that are placed on the same spot one is suppose to show on the homepage and the second one is to be showed on the rest of the site. I tried to add this on the special section in the themes option and it does not work it shows both codes plus < ?php } ?> :               <?php if (is_home()) {     ?>     Iframe Advertisement code which is displayed on homepage only     <?php     }     ?>          <?php if (!is_home()) {     ?>     Iframe Advertisement code which is displayed everywhere else <?php     }     ?>      I would appreciate any assistance. Thank you eeb


Workflow for working with git and WordPress

As my site becomes more important to my business, I want to have better version control so I can look up past changes and backup my code. I keep seeing people talking about having their entire site in git and I want to know how that works. I currently have my custom theme in my git repo. The only person who will edit the theme is me. After committing my edits, I deploy by FTP-ing the new files to my site. How would you have an entire site in git? WordPress, themes, and plugins (I have lots of them!) are updated frequently and would create lots of commits. Do I ignore them? Or do I only commit them when I deploy? How would I keep track of changes to my own theme and custom plugins among all the other commits from updated plugins? I would love for someone to share some insight into this with me. P.S. As you might guess I'm fairly new to git, hence the wrong terminology etc. Appreciate it if you explain it like I'm 5 with your answers :)


[SOLVED]Get terms cross-taxonomy query

I'm creating a product list with two custom taxonomies: the producer and the category. I've managed to display all of the producers and make the products display in a collapsible tab accordingly, but I want to exclude from display those producers, who don't have any products in the currently displayed category. The 'display all producers' code looks like this:               $terms = get_terms("producers");     if ( !empty( $terms ) && !is_wp_error( $terms ) ){                         $i=1;                         foreach ( $terms as $term ) {
producer's name, etc.
                         }                     }      How do I exclude producers that don't have any products assigned in the CURRENT category? 'hide_empty' argument doesn't work, as they have products in other categories. Edit: to be more clear, the category itself is shown basing on the current post, '/categories/trucks/' will show only trucks (but still all of producers, even those who do not have any trucks assigned)


How can I pass the ID of a post to a page template by clicking a url?

I have a post gallery and I'm displaying the thumbnails in example.com/gallery. Now this thumbnails are created via posts and when you click on on eof the thumbnails, it will direct you to single.php template. It goes to display a gallery room which mimics a Gallery Exhibit created with HTML5 and CSS3. Its quite heavy to load and doesn't really have the standard web gallery feel and I want an option for users to click weather to view it in Gallery Room or the standard grid which the native WordPress Gallery has. Now I want, in my example.com/gallery, to have two links. One on the Gallery Room and one on the standard grid. But how can I do this? I have already created a template for the standard gallery but how can I dynamically get the ID of the post whenever the user click on the 1st link in the example.com/gallery page. I have this in my template:               $post_id = 527;     $queried_post = get_post($post_id);      527 being the post ID. But of course this is not dynamic. I want to pass that ID to a url by clicking a link and will be stored to a variable which will be the value of the $post_id. Can anyone help? thanks!


Undefined variable error in theme option after updating theme

I have built a theme.. Now i have updated the theme and my theme consist of two new fields in the theme option panel               <input id="welcome_post_char" type="text" name="abc_options[welcome_post_char]" value="<?php echo esc_attr($settings['welcome_post_char'],'abc'); ?>">      But when i install this theme with old abc_options in my database table, gives an error > Undefined index: welcome_post_char in D:\wamp\www\wptest2\wp- > content\themes\accesspress-lite\inc\admin-panel\theme-options.php on line > 394 If i do               <input id="welcome_post_char" type="text" name="abc_options[welcome_post_char]" value="<?php if (isset($settings['welcome_post_char'])){echo esc_attr($settings['welcome_post_char'],'abc')}; ?>">      it doesn't give errors.. But i didn't see this approach in other Themes.. So can anyone please suggest me what is the best approach


Add custom dynamic string to permalink structure wordpress

I am adding dynamic string to permalink but the problem is all the pages which runs from `page.php` goes to **404** whereas the detail page of the post is working fine. ## Code:               add_filter('post_link', 'rating_permalink', 10, 3);     function rating_permalink($permalink, $post, $leavename) {         if (strpos($permalink, '%community%') === FALSE) return $permalink;              global $wpdb;         $Community=$wpdb->get_row(sprintf("SELECT `Community` FROM `tbl_custom` WHERE post_id = %d ",$post->ID));         return str_replace('%community%', $Community->Community, $permalink);     }          global $wp_rewrite;     $wp_rewrite->add_rewrite_tag("%community%", '([^/]+)', "post_type=post&name=");      My custom Permalink structure in `wp-admin`               /%community%/%postname%


Removing Fields From the Profile Page of Theme My Login Plugin

I would like to remove fields from the profile in Theme My Login. I want to remove everything except email and password field. I am able to hide fields using a little jQuery. But un fortunately I'm not good with it. Can someone help me how to make this? step by step? **Update:**   I found this but i dont know how to use it: > "This may not be the ideal approach, but I was able to hide fields (and > their associated labels and the parent p/div/tr element) using a little > jQuery, if you're familiar with that. Just target the input to hide, climb > up to its parent element, and hide it. This assumes that the element is > nested 3 levels down from the element i actually need to hide.. a in my > case. And i use a wp conditional to run this code only on the 'edit-profile' > page."               <?php     // this code goes in header.php, in the <head> section.     if(is_page('edit-profile') ) { ?>         <script type="text/javascript">             jQuery(document).ready(function() {                 // hide fields (the entire <tr>)                 jQuery('#id-of-field').parent().parent().parent().hide();             });         </script>     <?php }


Removing rules from .htaccess

I'm writing a small plugin that needs to write to .htaccess a simple non_wp_rule and i am doing it like this:               function ci_flush_rules()     {         global $wp_rewrite;         $wp_rewrite->flush_rules();     }     register_activation_hook(__FILE__, 'ci_flush_rules');               function ci_add_rules()     {         global $wp_rewrite;         $proxy = plugin_dir_path(__FILE__) . 'proxy.php';         $non_wp_rules = array('(.*)\.(jpe?g|gif|png)$' => $proxy);         $wp_rewrite->non_wp_rules = $non_wp_rules + $wp_rewrite->non_wp_rules;     }     add_action('generate_rewrite_rules', 'ci_add_rules');      The rule is written in the .htaccess file as expected. Now i have 2 problems. **Problem 1** When i try to remove this rule during plugin deactivation like this:               function ci_remove_rules()     {         global $wp_rewrite;         $wp_rewrite->non_wp_rules = array();         $wp_rewrite->flush_rules();          }      register_deactivation_hook( __FILE__, 'ci_remove_rules' );      The rule doesn't get removed. If i deactivate the plugin and then visit Settings > Permalinks it removes the rule. **Problem 2** WordPress is installed in a subdirectory `( http://localhost/wordpress )` and when the rule is written in the .htaccess it appears like that:               # BEGIN WordPress     <IfModule mod_rewrite.c>     RewriteEngine On     RewriteBase /wordpress/     RewriteRule ^index\.php$ - [L]     RewriteRule ^(.*)\.(jpe?g|gif|png)$ /wordpress/Applications/MAMP/htdocs/wordpress/wp-content/plugins/myplugin/proxy.php [QSA,L]     RewriteCond %{REQUEST_FILENAME} !-f     RewriteCond %{REQUEST_FILENAME} !-d     RewriteRule . /wordpress/index.php [L]     </IfModule>     # END WordPress      As you can see instead of a path like /Applications/MAMP.... it's /wordpress/Applications/MAMP.... Bare with me as this is the first time dealing with wp_rewrite stuff :)


Use image url with add_image_size

I am looking for a way to use an image url with the WordPress function `add_image_size`, I have already setup an image size called `'custom-thumb'` For example, instead of...               the_post_thumbnail( 'custom-thumb' );      Which would output the posts thumbnail at the custom size I specified, I want to do something like...               www.mydomain.com/image.jpg('custom-thumb');


How can I avoid re-inventing the Custom Fields wheel in my Plugin's Metabox?

Here's the scenario: In my plugin, I want to have a metabox show up on the post / page editor. I want the metabox to be -exactly- like WordPress' 'Custom Fields' metabox, ( Add another, delete, update, auto-populated dropdown, Enter new link, AJAX magic, etc ); with a couple minor differences:   * Instead of just 'Name' and 'Value', I want 'Target', 'Name' and 'Value'   * Instead of saving them all as 'public' custom fields that automatically appear inside the WP Custom Fields metabox, I want them all stored as a single multidimensional array inside a 'private', namespaced, field...i.e., `_myplugin_custom_fields = array( 1 => array( 'target' => 'mytarget1', 'name' => 'myname1', 'value' => 'myvalue1' ), 2 => array( 'target' => 'mytarget2', 'name' => 'myname2', 'value' => 'myvalue2' ) )` I've spent all day digging through the tangled web of WP Core, and have not been able to find a straightforward way to pull this off. If I move forward based on my current understanding, I'll end up duplicating hundreds of lines of core code from numerous php and js files. Can anyone here in WordPress Answers-land help point me in the right direction? I have plenty of experience in adding and leveraging metaboxes within themes and plugins, but this one has me totally stumped. Please speak up if I'm being unclear. Thanks in advance to all who reply!


Include different loop templates in search query

I have differnet Custom Post Types in my blog.   I also have custom templates for each of them like **loop-{$cpt-name}.php**   I would like to include different cpt templates dynamically in search results based on what custom post type is post at the moment in the loop. I am trying to do it like this ( search.php ):               <?php                 while ( have_posts() ) : the_post();                      if ( get_post_type ( $post->ID ) == 'teams' ) {                         get_template_part( 'loop', 'teams' );                     } elseif ( get_post_type ( $post->ID ) == 'players' )  {                         get_template_part( 'loop', 'players' );                     } else {                         get_template_part( 'loop', 'search' );                     }                 endwhile;                 ?>      However, the problem is that when I am trying to do it like so, I have infinitive loop in a query. Because in **search.php** file I check the post type in the **while loop** and include the template where I also have while statement ( I need to have it there ). Example of my CPT template ( beginning ):               <?php      /**      * The loop that displays teams      *      */     if ( have_posts() ) while ( have_posts() ) : the_post();       I came up with the idea to make additional query for each found post in the loop, like so:               while ( have_posts() ) : the_post();          if ( get_post_type ( $post->ID ) == 'teams' ) {                 query_posts('p='.$post->ID);                 get_template_part( 'loop', 'teams' );                 wp_reset_query();      But I suppose that would slow down the search in times. ( have not tested yet)   Any suggestions will be appreciated.


How can i show Cubepoints ranks/points in bbpress replies

i've been searching for a while now on how to show Cubepoints Points and Ranks in bbPress replies right below the user avatar and name... Found the template file where to show the info, tho not sure this would be the correct one to grab the reply-author info, the "loop-single-reply.php" and just bellow bbp_reply_author_link(); i'm placing the output (correct me if i'm wrong), and i discovered the functions to calculate and display Cubepoints and Ranks (cp_displayPoints($user->ID); & cp_module_ranks_getRank($user->ID)), correct me if i'm wrong again ^^ The question is, since working with bbpress is way more harder then wordpress due to the lack of easy to reach documentation (like wordpress codex), how can I get the reply-author ID and display the Cubepoints and Ranks, am I in the right way? what am I missing? thank you in advance!


New WP_Customize API - how does it work under the hood?

I noticed that if you make changes trough the new "customize" feature, when you navigate on a different page within the iframe preview document, your changes still apply, even if they are unsaved. It looks like WP is storing the temporary changes somewhere, and it applies them on the site if the site is viewed in "customize" mode. But how does the site know it's in customize mode? Because I don't see any query arguments appended to the links or anything like that.


Load plugin scripts and styles only on plugin page

Hello wordpress users, I'm stuck with a problem while running 2 self made Wordpress plugins. I'll use the following code :               define('PLUGIN_URL', plugin_dir_url( __FILE__ ));     add_action( 'admin_enqueue_scripts', 'plugin_load_js_and_css' );          function plugin_load_js_and_css() {             wp_register_style( 'plugin.css', PLUGIN_URL . 'plugin.css', array());             wp_enqueue_style( 'plugin.css');                  wp_register_script( 'plugin.js', PLUGIN_URL . 'plugin.js', array('jquery'));             wp_enqueue_script( 'plugin.js' );         }     }      But it's loading this stylesheet everywhere in the admin panel. Now I found this in the codex:               function my_enqueue($hook) {         if( 'edit.php' != $hook )             return;         wp_enqueue_script( 'my_custom_script', plugins_url('/myscript.js', __FILE__) );     }     add_action( 'admin_enqueue_scripts', 'my_enqueue' );      But this code is not working for my.. Does anyone have a another option? Or maybe know why it's not working for me?


Importing Tweets with certain hashtags into Wordpress

I'm looking for a way to import tweets into Wordpress as posts. In fact, I want to display tweets about a certain topic on a page in Wordpress. So page A would contain tweets about hashtag x, and page B would contain tweets hashtag y. There is at least one plugin that imports tweets (Tweet-Import), but it can only import tweets by a certain user, not by hashtag. Is there any way that this can be done? Cheers!


Problem with a query in custom posts

I'm making a search form to select available rooms.   I have a custom post for the rooms called "Products" and a post meta value called "availability" (format: Y-m-d).   And I want to find all rooms available from a certain date in my form: MyDate_a.   This is the code I use:               SELECT wposts.*     FROM $wpdb->posts wposts, $wpdb->postmeta wpostmeta     WHERE wposts.ID = wpostmeta.post_id     AND wpostmeta.meta_key = 'availability'     AND wpostmeta.meta_value >= $MyDate_a     AND wposts.post_status = 'publish'     AND wposts.post_type = 'products'     ORDER BY wpostmeta.meta_value DESC      But it seems that it select all the rooms, even if `$MyDate_a` is, lets say, 2013-03-30 and availability is 2013-04-01.


"Rendering of admin template [path to template] failed"

I've got a php script that is called when the user is editing the category. However, although the page renders fine for the most part, at the point where the image upload button should appear, I'm seeing this message: > Rendering of admin template /home/site/public_html/wp- > content/themes/mytheme/folder/subfolfer/admin/file.php failed What are the likely causes for this error in this one site? Other sites are processing this fine? THe site has PHP version 5.2.16 THe site has WP version 3.0.5


Add Admin Menu Inside Construct or Init

I thought I was making headway in my WordPress Development education until I ran across the Boilerplate for WordPress plugins and it uses a class object. I'm fine with that and understand those concepts and I am a .Net developer. But, for some reason, I cannot get any callback to function properly. All I want at this point is an admin menu and when you click on that menu item, it display something like "PLEASE HELP ME!!!". Check out what I have below and can anyone please explain what I have wrong?               class school_manager {         function __construct() {             add_action( 'init', array( $this, 'init' ) );         }              public function init(){                 add_action('admin_menu', array(&$this, 'add_admin_menu'));             }              public function add_admin_menu(){             add_menu_page( 'School Manager Settings', 'School Manager', 'administrator', 'school-manager-settings', 'show_admin_settings_page', null );          }              public function show_admin_settings_page(){             echo '
This is a test for the admin settings page.  Please work!
';         }     }      My new menu item does appear (as it did when I was not using a class object in my plugin architecture. But, when I click on the menu item, I get the following error: > Warning: call_user_func_array() [function.call-user-func-array]: First > argument is expected to be a valid callback, > 'school_manager::create_admin_page' was given in H:\root\home\xxxxx\wp- > includes\plugin.php on line 406 I am trying to create a plugin that has not only an admin menu and submenu items, but also want to utilize the Settings API by trying to follow this series. So, this is one of the crucial points to get something as simple as a menu item to function before I can continue.


Getting rid of the blog page entirely

My goal is to not use a separate blog page but end up with a structure like this... http://domain.tld/page/comments/ I believe I can do this with the Cornerstone plugin ~ [ http://wordpress.org/extend/plugins/cornerstone/ ] ~ but I can’t figure out the alternative loop code and how I replace the loop in Genesis with a loop that loads post URLs rather than categories. I can see how this Projects template displays posts by category in the loop. // GENESIS LOOP               <?php     /**     *     * Template Name: Projects     * This file handles blog posts with the category Projects within a page.     *     */     remove_action('genesis_loop', 'genesis_do_loop');     add_action('genesis_loop', 'custom_do_cat_loop');     function custom_do_cat_loop() {     global $query_args; // any wp_query() args     $args= array('cat' => '30');     genesis_custom_loop(wp_parse_args($query_args, $args));     }          genesis();      // CORNERSTONE LOOP               <?php if ( cnr_have_children() ) : while ( cnr_have_children() ) : cnr_next_child(); ?>
<?php the_title(); ?>

<?php the_excerpt(); ?>
     <?php endwhile; endif; ?>      The Cornerstone loop displays the title and an excerpt with a link for each post in a section (a page) in Cornerstone. How do I replace the loop in Genesis with a loop that loads post URLs rather than categories? I am a designer, not a developer, so any help you can give me would be much appreciated. Terence.


How to sort by custom field value?

I am using these code to sort most Commented, Most viewed Posts               <?php $params = $_GET;     unset($params['orderby']);     unset($params['order']);     unset($params['v_orderby']);     unset($params['v_sortby']);     $url = $_SERVER["HTTP_HOST"].$_SERVER["REQUEST_URI"];     $url = strtok($url, '?');     $url =$url.'?'.http_build_query($params);     ?>
     <li <?php if($active == "date"): ?> class="active"<? endif ?>><a href="http://<?php echo        $url ?>">Most Rated
     <li <?php if($active == "comment"): ?> class="active"<? endif ?>><a  href="http://<?php   echo $url ?>&orderby=comment_count&order=desc">Most commented
     <li <?php if($active == "views"): ?> class="active"<? endif ?>><a href="http://<?php echo $url ?>&v_sortby=views&v_orderby=desc">Most viewed

      Now I want to sort Custom Field "Rating" as Most Rated here is the code of custom field.                <?php     //grab the rating value     $rating = get_post_meta($post->ID, 'rating', true);          //prints star image     for ($i=1; $i<=$rating; $i++){         echo '';       }          //prints unstar image     for ($i=$rating; $i<10; $i++){         echo '';     }     ?>      For this I used this code, but it's not working.               <a href="http://<?php echo $url ?>&orderby=rating&order=desc">Most Rated


Mass Permalink Changer

I recently converted a site from Moveable Type to WordPress and noticed that the permalinks for each post are short, cut off and have underscores in them. What I am looking to do is if there is a script or SQL command I can run to mass change each posts permalink to the default permalink it would have normally generated based on the post title. Thanks in advance!


Get Drupal user into WordPress

I have a Drupal site, and into it, a WordPress site. I would like to know how to get user info of drupal site in WordPress site ? in fact if your a user of wwww.mydrupalsite.com, how can I pass user info to www.mydrupalinfo.com/wordpress. ? Thank for answer !


Getting thumbnails of a custom posts featured images in a page-templates metabox

I guess I need to know how to call meta data into metaboxes for beginners. I'm using               $posts = get_posts(array(             'post_type'   => 'slidertype',             'post_status' => 'publish',             'posts_per_page' => -1,             'fields' => 'ids'             )         );         //loop over each post         foreach($posts as $p){             //get the meta you need form each post             $thumb = get_post_meta($p,"_thumbnail_id",true);                  echo $thumb;      To try to get thumbnails of my custom post type 'slidertype' to show up in a page's metabox. Right now it's displaying a number which doesn't make sense to me. No advice is bad advice guys! Thanks.


Displaying Latest Posts on a Page

I am trying to create a loop to display the title and excerpt of each blog post onto a page that isn't my index page. The in-progress demo site is here: http://thewestharbour.com/mypakage/ On the news page I need to display the latest 3 blog posts. Simply changing the settings won't work and every loop I have tried doesn't work either. I have also tried creating a separate template and assigning it to the news page but had no luck. Thanks, Wade


Multiple image uploader under editor?

I need a plugin for custom post type. I need something like this: ![Mockup with image uploader under edit screen](http://i.stack.imgur.com/crrY1.jpg) Can anyone suggest a plugin which has this feature, especially image upload and "Add another" button option.


Opendir and Wordpress Path

I wrote a simple function to get the contents in a folder (called templates) in my wordpress plugin, but am having problems getting the path to work (thus the function always dies). My question is: Is there a wordpress function or something that will give me the path to my plugin as required for the opendir function to work?                function get_templates(){              $path =   '[path to my plugin]/templates';          $dir_handle = @opendir($path) or die("Cannot open the damn file $path");           while ($file = readdir($dir_handle)) {            if(substr($file,-3) == "php" )             continue;            $TheLinkedFile = $path."/".$file;      if(file_exists($TheLinkedFile)) {          echo $TheLinkedFile.'<br>';      } else {     echo "nothing";      }      }          closedir($dir_handle);            }


Howto disable comment moderation emails for admins, but not for authors

I'm the admin of a WordPress multisite installation, and in most of the blogs I'm the person who created the blog in the first place, and therefore my email is the admin email address. Because of this, I get all the comment moderation emails, which I'm able to filter with some email rules. But I wanted to disable this mails in WordPress itself – with no success. I'm aware of the option in `Settings -> Discussion -> Email me whenever [x] Anyone posts a comment`. So I tried to disable this option, but then the regular authors of posts do not get notified, which is a _no go_. Does anyone have any suggestions? Is it even possible in WordPress to **disable** admin email notifications while still sending notifications to post authors?


How do I get my custom query to work with search results after the first page?

I am using a custom query in order to ajax load/append additional posts instead of paginating them out like WP defaults. However, when I click the button I've made to load more posts, it loads all posts rather than the ones that match the search result (while the first set matches the search result). How do I maintain this format of loading posts while retaining the search query? I successfully did this for my category pages with something like `query_posts(array('cat' => $category));` but am unsure how to do it for search. Button:               var pager = 1;     var search_load_posts = function(){           $.ajax({               type       : "GET",               data       : {pageNumber: pager, offset: 12},               dataType   : "html",               url        : "http://tay.is/designing/belmontvision/wp-content/themes/yamidoo/search-more-loop.php",               beforeSend : function(){},               success    : function(data){                   var $data = $(data);                   $container.append( $data ) .packery( 'appended', $data );                 heightcalc();                 $container.packery();             }         });     };          $('.search-load-more').click( function() {         search_load_posts();         pager++;     });      Original Loop Query:               <?php if (have_posts()) : get_template_part('loop-search'); ?>      Top Loop Search (loop-search.php):               <?php   $count = 1; while (have_posts()) : the_post();?>      Additional Post Query (search-more-loop.php):               <?php   require_once('../../../wp-load.php');                $page = (isset($_GET['pageNumber'])) ? $_GET['pageNumber'] : 0;             $offset = (isset($_GET['offset'])) ? $_GET['offset'] : 0;                  $args = array ( 'posts_per_page' => 12,);                  $last_twelve = get_posts($args);             $last_twelve_ids = array();             if( $last_twelve ) foreach( $last_twelve as $last_post ) { $last_twelve_ids[] = $last_post->ID; }                  query_posts(array(                   'paged' => $page,                 'post__not_in' => $last_twelve_ids             ));                    while (have_posts()) : the_post(); ?>


Custom post type & taxonomy just like WP defaults

I've spent days attempting to do a single thing: create a custom post type/taxonomy (cat)/taxonomy(tag) trio that replicates the stock standard WP category/post/tag structure with permalinks of /%category%/%postname%/ for example:               /category-name/ (category page)     /category-name/post-name-1/ (individual post)     /category-name/subcategory-name/ (category page)     /category-name/subcategory-name/post-name-2/  (individual post)     /category-name/subcategory-name/sub-sub-category-name/ (category page)     /category-name/subcategory-name/sub-sub-category-name/post-name-3/  (individual post)      I can get the categories working, but not the individual post pages, or vice versa. I've searched far and wide on this and cannot get all the pieces operative. With slugs, without slugs, with/without re-write plugins, etc. It seems very straight forward to get the category structure working - with or without a slug, but getting the posts to work _and inherit the category URL structure_ seems outright insane! What am I missing? UPDATE #1 7 days later... It seems that the frustration/lack of progress I'm experiencing is common as hell and I still cannot find anyone who has successfully replicated the default WordPress category/post system with permalinks of /%category%/%postname%/. Surely someone out there must know how to make the WordPress "CMS" (yes, in quotes) actually ouptut properly structured URLs that make sense? It would be insane if the _only_ way to do it was via the pages system OR via the default cats & posts!


Determine which template-{slug}.php is being loaded

I am trying to make a personal plugin that does specific things based on what is loaded. In this example, in my action method I want to perform one function if the currently loading page is using the `template-blog.php` template, if it's a single blog post (loading `single.php` do a second function, anything else do a 3rd function I am not quite sure what method I need to use, and so far Google is not pulling up the right methods. I have been trying get_current_template(), get_template() get_page_template(), but none of them pull the stuff I am looking for above.


Custom search for custom post type, custom meta and search fields

Id like to build a search form for a specific custom post type (vehicle) and have filters for that custom posts type's custom meta fields (price, age) and custom taxonomies (make). This will totally replace the sites search and be the only search available so I was going to use search.php within my custom template. I've like the search to look something like: **Search our vehicles** **Make** (select box full of all the custom taxonomies - Audi, BMW etc). **Model** (normal input field for people to type whatever in). **Prices over** (select box with prices starting at 1000) **Age** (select box with options such as under 1 year, under 3 years, under 5 years, under 10 years). I'm new to custom fields and dont really know where to start (I've found a few examples on Google but none do exactly what I'm aiming for). I didnt really want to use a plugin either. I'm guessing within search.php I grab the data passed from the form and use it to build $args up to pass to WP_Query? Could someone point me in the right direction please? Thanks in advance


Showing certain page without redirection

I need to get any url that starts with "booking" to lead to certain post without redirection. That means all of these URL would lead to post Booking, but the URL would stay the way it is:               example.com/booking     example.com/booking/rooms     example.com/booking/rooms/show/kabana-3      This is because in the page template of the post Booking I have a PHP script that needs full URL.


Positioning the “Lost your password?” and “← Back to Site”

I'd like to customize the log-in page for my WordPress theme and although I can play around with the CSS, I would love to re-position the "Lost your password?" and "← Back to Site" links to be inside of the foreground box, rather than below it / or, in other words...so these links are placed inside of the form-field. How would I be able to achieve this so that I am not modifying any files outside of the _Themes_ directory or would I need to re-create the entire log- in page and link to the new one for this? Thank you.


Modify "View" in admin panel for custom taxonomy

Fristly, sorry for my bad english.   Secondly, I can't find a solution for my problem since 2 weeks. It's a simple things but I can't find how to do it.   I explain my problem :   I got 2 custom taxonomies call in a function "my_custom_init" :               register_taxonomy( 'directors', 'video', array( 'hierarchical' => true, 'label' => 'Directors', 'query_var' => true, 'rewrite' => true ) );     register_taxonomy( 'clients', 'video', array( 'hierarchical' => true, 'label' => 'Clients', 'query_var' => true, 'rewrite' => true ) );        I would like to edit the link "View" like on the print screen :   http://nsa32.casimages.com/img/2012/10/18/121018025542594841.png I think I have to use the post_row_actions to edit it but I can't get the taxonomy.   If you know how to solve my problem, thanks in advance for your help. **Edit** I made this for my categories "post" and "video" and it works ! But I can't do the same for my custom taxonomies :/   I don't really understand I tried but doesn't work :S               add_filter( 'post_row_actions', 'remove_row_actions', 10, 1);     function remove_row_actions( $actions )     {         if( get_post_type() === 'post' )             unset( $actions['view'] );              if( get_post_type() === 'page' )             unset( $actions['view'] ); //doesn't work ?              if( get_post_type() === 'video' )             unset( $actions['view'] );              // Adding a custom link and passing the post id with it         $permalink = get_permalink();         $permalink = explode(".tv", $permalink);         $actions['customedit'] = "View & Get Url";              return $actions;     }


Adding option to Gallery shortcode

just starting out in WP dev, and I'm looking for any guidance I can get. What I'd like to do is use a hook or filter to add my own option to the core WP gallery shortcode. I would want it to work just like the standard 'exclude' option, but still show those images for Administrators. So it would look something like this: `[gallery exclude="1" hide="2,3,4,5,6" link="file"]` So, basically I'm looking for guidance on how to create a function that would add the "hide" function to individual image id's within the gallery shortcode which would work exactly like the exclude, but those images would still show up in the frontend for administrators. Thank you for your time, and expertise.


Using wp_mail in functions.php

I have set up a simple mailer before I get the full implementation sorted. I've tried a few email addresses but am not receiving them even though it returns 'true'. I'm using wp_ajax as well if that makes a difference. functions.php                        //  Check for email return in share folders         add_action( 'wp_ajax_share_email', 'share_email' );         add_action( 'wp_ajax_nopriv_share_email', 'share_email' );         function share_email(){             $email = $_POST['email'];             // Return a boolean!             $to = $email;             $subject = "Test mail";             $message = "Hello! This is a simple email message.";             $from = "no-reply@website.com";             $headers = "From:" . $from;             if(wp_mail($to,$subject,$message,$headers)) {                 return true;             } else {                 return false;                }         }           Can anyone let me know why this isn't sending? Am I not allowed to use wp_mail and wp_ajax together perhaps? Thanks **EDIT** Jquery part                        $('#share-pop .btn').click(function(){             var email = check.val();             jQuery.ajax({                 type: 'POST',                 url: ajaxurl,                 data: {"action" : "share_email", 'email': email},                 success: function(data){                     if (data) {                         alert('sent');                     } else {                         alert('An error occured');                     }                 }             });         });


How to display the current subcategory in product overlay?

I want to display the category with the subcategory of the product by mouseover. Here is an example of what I want: https://www.dropbox.com/s/zvddx7nwpyxva0t/example.png. Right now I was able to show the parent category. Here is my code (archive- product.php):                                   <?php                         $parent = is_shop() ? 0 : $cat->term_id;                              $terms = get_terms( 'product_cat', array(                             'parent' => $parent,                              ) );                              ?>      Please help! Thx!


get_category_children/ the new get_term_children not work

I have a custom Walker for a Advanced Search, that outputs the categories for multiple search by categories in checkbox. The Problem here is, that i use the get_category_children for the children Categories, but its old, and the new code is get_term_children, but when i replace it with it, then comes a error message, like               Warning: substr() expects parameter 1 to be string, object given in /..../search-fields.php on line 269      But the Search Functionality works. The Code for the Walker Class is:               class Multiple_Walker_Category extends Walker      {          var $tree_type = 'category';     var $db_fields = array ('parent' => 'parent', 'id' => 'term_id');          function start_lvl(&$output, $depth, $args) {          $indent = str_repeat("\t", $depth);     $output .= "$indent
\n";          }          function end_lvl(&$output, $depth, $args) {     $indent = str_repeat("\t", $depth);     $output .= "$indent
\n";          }          function start_el($output, $category, $depth, $args)         {             extract($args);             $cat_name =  esc_attr($category->name);                  $cat_name = apply_filters( 'list_cats', $cat_name, $category );             $cat_children = substr(**get_category_children**( $category->term_id, '', ', '), 0, -2 );                  $output .= "
<input type='checkbox' onchange='toggle( {$category->term_id}, Array( $cat_children, 999 ) )' class='cb-element'  checked='checked' name='cat_{$category->term_id}' id='cat_{$category->term_id}' /> ";                  $output .= "term_id}'>$category->name";          }          function end_el(&$output, $category, $depth, $args) {     $output .= "
\n";     }     }      How can i replace the old with the new term_children. Thanks everyone for the help.                   function adv_form_cats($args = '')         {             $defaults = array(                 'show_option_all' => '',                 'orderby' => 'name',                 'order' => 'ASC',                              'show_last_update' => 0,                 'style' => 'list',                              'show_count' => 0,                 'hide_empty' => 1,                              'use_desc_for_title' => 1,                 'child_of' => 0,                              'feed' => '',                 'feed_image' => '',                               'exclude' => '',                 'hierarchical' => true,                              'title_li' => '',                 'echo' => 0             );                  $r = wp_parse_args( $args, $defaults );                  if ( !isset( $r['pad_counts'] ) && $r['show_count'] && $r['hierarchical'] ) {                 $r['pad_counts'] = true;             }                  if ( isset( $r['show_date'] ) ) {                 $r['include_last_update_time'] = $r['show_date'];             }                  extract( $r );                  $categories = get_categories($r);                  $output = '';             if ( $title_li && 'list' == $style )                     $output = '
' . $r['title_li'] . '
';                  if ( empty($categories) ) {                 if ( 'list' == $style )                     $output .= '
' . __("No categories","WPL") . '
';                 else                     $output .= __("No categories","WPL");             } else {                 global $wp_query;                      if( !empty($show_option_all) )                     if ('list' == $style )                  $output .= "
<input type='checkbox' id='checkAll' checked='checked' name='checkall'  /> ";                  $output .= "".__('Check All', 'WPL').'';                      if ( is_category() )                     $r['current_category'] = $wp_query->get_queried_object_id();                      if ( $hierarchical )                     $depth = 0;  // Walk the full depth.                 else                     $depth = -1; // Flat.                      $output .= walk_category_new_tree($categories, $depth, $r);             }                  if ( $title_li && 'list' == $style )                 $output .= '

';                  $output = apply_filters('wp_list_categories', $output);                             return $output;         }               function walk_category_new_tree()         {             $walker = new Multiple_Walker_Category;             $args = func_get_args();             return call_user_func_array(array(&$walker, 'walk'), $args);         }


Need to setup grid like thumbnail of recent posts on sidebar

Something like this, no excerpts or anything else. I couldn't find any plugin that can do it: ![enter image description here](http://i.stack.imgur.com/HbGRS.png)


Can't open scheduled posts

On the homepage of my website I'm retrieving published and scheduled posts this way:               <?php      global $post;     $args = array('numberposts' => '3', 'category' => $category, 'post_status' => array('publish', 'future' ));     $myposts = get_posts($args);      It works fine, but if I'm not logged in as admin I can't access the whole post. It gives me a 404 error.


After changing wp from subdirectory to root I can't preview any changes to a page or post

I followed the guideline from WP Codex.   * Changed the site url in general settings   * Copied the .haccess and the index.php files from the subdirectory to the root   * Edited the root index.php (new copied file in root) from: '/wp-blog-header.php' ); to '/subdirectory/wp-blog-header.php' );   * checked the permalink structure. the following code is in the new copied root .haccess file              # BEGIN WordPress     <IfModule mod_rewrite.c>     RewriteEngine On     RewriteBase /     RewriteRule ^index\.php$ - [L]     RewriteCond %{REQUEST_FILENAME} !-f     RewriteCond %{REQUEST_FILENAME} !-d     RewriteRule . /index.php [L]     </IfModule>          # END WordPress}      When I navigate the new site my permalinks seem to be working. for example > ruthsabrosa.com/birth-preparation does not show as > subdirectory.ruthsabrosa.com/birth-preparation But now the problems: I need to type in the full old url structure to see the admin bar http://yogaseowp.ruthsabrosa.com/birth-preparation/ When I edit this page or any other page and try to preview changes I get: > You do not have permission to preview drafts. Also after I update the post it successfully updates but when I view the post I am directed to my root url which I expected: **ruthsabrosa.com/birth- preparation/** However my top admin bar is now gone, also this root directory page is not updated. Only my original page: **yogaseowp.ruthsabrosa.com/birth- preparation/** is showing the update and the admin bar. So when someone uses the sites navigation or lands on the **ruthsabrosa.com/birth-preparation/ page** from a search they don't see the updated content. I've been looking at this for several hours and the change made to while logged in to yogaseowp.ruthsabrosa.com/birth-preparation/ seems to eventually appear in the main ruthsabrosa.com/birth-preparation/ page, perhaps it takes about 1 hour for the change to appear. It's incredibly frustrating to make any changes or updates to the website now as I keep having to manually add the complete url with subdiretory to make changes to any page or post, can't preview any change and I am still not convinced all changes will eventually appear in the root directory pages. Any guideance would be appreciated.


Temporarily disable user role login and replace with message

Is there a simple way to temporarily stop a user role logging in with wordpress? For example, if I have a user role called **media** , how can I block them from logging in? I would like a custom message to appear on the website, for example like 'Site undergoing maintenance' So it looks like this... http://i.imgur.com/nDf7a.jpg The reason why, is because my website is completely locked down from the public using this function...               // LOCK DOWN     add_action('get_header', 'wpq_member_only_site');     function wpq_member_only_site() {         // logged in users or visits to a specified page are allowed         if ( !is_user_logged_in() ) {                  $redirect_after_login = get_home_url();                  // the URL where login/registration takes place             $login_url = wp_login_url( $redirect_after_login );                  // redirect visitors             wp_redirect( $login_url, 302 );             exit;         }     }      But I need to do some maintenence and I'm after a simple way to lock all users out that are the role **media** This is because I wan't **administrators** and **editors** to still have access, but not **media**. Can any one help please? Thanks Josh


Cache metadata for set of posts

I have a query that can only be done using straight SQL, but I need to loop through the returns as a set of posts. As I understand it, WP_Query automatically gets all the metadata for all the posts retrieved, and caches it for when get_post_meta is called. But since I have to use wpdb->query, I was wondering if there was anyway I could call another function after it with a set of like post ids, which would cache all their meta; this way I don't hit the database for every post in the loop. Right now I am actually inner joining the fields I need from the post_meta, but this just seems like a bad (and messy) idea. Thanks,   Max


Rename files on upload

I have been trying to rename my images on upload and only piece of code I found was the one that uses a 32char hash.               function make_filename_hash($filename) {        $info = pathinfo($filename);        $ext  = empty($info['extension']) ? '' : '.' . $info['extension'];        $name = basename($filename, $ext);        return md5($name) . $ext;     }     add_filter('sanitize_file_name', 'make_filename_hash', 10);      My php knowledge is very limited and I looked everywhere for an example that uses some random number being generated instead of a hash, without success. My initial idea was to get the db image id and use it as image filename on upload but I got my brain twisted in the process. Anyway at this point I would settle for some sort of numbering system that will increase by one digit on every upload or if that is not possbile at least some random number by using a range, like rand(10000,99999). Any help would be very appreciated thanks a lot ========================================================== Can you read data from a custom table in functions.php and write to it. I'm trying to read a counter from a table set the image to that counter number and update the counter in the db. It doesn't seem to work, the counter increases but the table never gets updated, and no matter what the value in the db is, the counter does not use that value, so this means it's not reading this value either. I just want to know if there is another way to do this to rename files but with a value from my custom table. This is what I got so far. I was thinking maybe I use the wrong hook but at this point I am a bit stuck. Thanks guys.                function make_filename_counter($filename) {              $qry;        $fcnt = 0;        $sql = ("SELECT counter FROM bwbps_filenamecounter WHERE id = 1");        $cnt = mysql_query($sql);        foreach($cnt as $cnt) {           $fcnt = $cnt->counter;        }        $fcnt = $fcnt + 1;        $info = pathinfo($filename);        $ext  = empty($info['extension']) ? '' : '.' . $info['extension'];        $sql = "UPDATE bwbps_filenamecounter SET counter = " . $fcnt . " WHERE id = 1";        $qry = mysql_query($sql);        $fcnt = 0;       return $fcnt . $ext;     }     add_filter('sanitize_file_name', 'make_filename_counter', 10);


wp-postratings: list current user's unrated posts

This is the code I use to list current user's rated posts (I use the wp- postratings plugin on my site for rating posts):               <?php     global $wpdb, $current_user;     $userranking = $wpdb->get_results( " SELECT * FROM wp_ratings WHERE rating_userid=$current_user->ID ");     if($userranking) {         foreach ( $userranking as $userranking ) {         echo "
rating_postid). "'>" .get_the_title($userranking->rating_postid). "
";         }       }     ?>      How do I list the posts that the current user has not rated yet?


How in insert image path in Wordpress database that will display product image in wp admin not on front end?

$insert = $wpdb->insert( $prefix."posts", array("post_title" => $posTitle,"post_content" => $postContent,"post_status" => "publish","post_type" =>"product"));          // select products ID     $select = $wpdb->get_results("SELECT ID AS productsId FROM ".$prefix."posts WHERE post_title='".$posTitle."'");     //echo $select[0]->productsId; die();     // insert Image in pots and product attribute meta posts table      $insertImg = $wpdb->insert($prefix."posts",array("post_status" =>"inherit","post_type" => "attachment","guid" => $postGuid,"post_parent" => $select[0]->productsId ));      I need a small, which table and column I need to insert to display product image in wordpress admin,I insert products by query in wordpress rather than insert product by admin


Total Word Count For Posts And Comments By One Author

How can I count words in posts + tags + comments and display the number of total words used by each author ?


multisite can't import media and users

I have recently created my first unmanaged VPS and install WordPress Multisite. Ok is working well, until I try to import other blog content (xml) via wordpress import tool. If I check "Download and import file attachments", it doesn't work, is loading all time.. And if I don't check it, all post, pages and menus are imported, but user and images no. It show me this error: Failed to create new user for John Doe. Their posts will be attributed to the current user. Failed to import Media “1”. what can be causing this?


Display child pages in sidebar of parent page in wordpress

How to get displayed child pages on parent page and also on child page of that parent in sidebar?Trying to paste code from wp codex page and from several other sites, but with no success.I always get instead of list of child pages, list of parent pages!? what is the problem?Just to mention, maybe is important, all parent pages have its own page-template. example code:                   <?php         if($post->post_parent)         $children = wp_list_pages("title_li=&child_of=".$post->post_parent."&echo=0"); else         $children = wp_list_pages("title_li=&child_of=".$post->ID."&echo=0");        if ($children) { ?>     <ul>     <?php echo $children; ?>     </ul>     <?php } ?>      I also try this code which seems to me doing god job, but again I got list of parent pages


Sidebar login: How do I get the username to show after "Welcome"?

Yo, Sidebar login used to say "Welcome %username%" without a problem until I applied __() to the "Welcome" string. Since then the welcome message just says "Welcome" (in all languages) but i can't bring that username back in there to save my life. What am I doing wrong? Here's how it looks: function widget_wp_sidebarlogin($args) { global $user_ID, $current_user;                   /* To add more extend i.e when terms came from themes - suggested by dev.xiligroup.com */         $defaults = array(             'thelogin'=>__('Login'),             'thewelcome'=>__('Welcome'),             'theusername'=>__('Username:','sblogin'),             'thepassword'=>__('Password:','sblogin'),             'theremember'=>__('Remember me','sblogin'),             'theregister'=>__('Register','sblogin'),             'thepasslostandfound'=>__('Password Lost and Found','sblogin'),             'thelostpass'=> __('Lost your password?','sblogin'),             'thelogout'=> __('Logout','sblogin')         );              $args = array_merge($defaults, $args);         extract($args);                   get_currentuserinfo();              if ($user_ID != '') {             // User is logged in                  global $current_user;             get_currentuserinfo();                  if (empty($thewelcome)) $thewelcome = str_replace('%username%',ucwords($current_user->display_name),get_option('sidebarlogin_welcome_heading'));                  echo $before_widget . $before_title . __("Welcome") . $user_info->user_login . $after_title;                  if (get_option('sidebar_login_avatar')=='yes') echo '
'.get_avatar($user_ID, $size = '38').'
';                  echo '
';                  if(isset($current_user->user_level) && $current_user->user_level) $level = $current_user->user_level;                  $links = do_shortcode(trim(get_option('sidebarlogin_logged_in_links')));                  $links = explode("\n", $links);             if (sizeof($links)>0)             foreach ($links as $l) {                 $l = trim($l);                 if (!empty($l)) {                     $link = explode('|',$l);                     if (isset($link[1])) {                         $cap = strtolower(trim($link[1]));                         if ($cap=='true') {                             if (!current_user_can( 'manage_options' )) continue;                         } else {                             if (!current_user_can( $cap )) continue;                         }                     }                     // Parse %USERNAME%                     $link[0] = str_replace('%USERNAME%',$current_user->user_login,$link[0]);                     $link[0] = str_replace('%username%',$current_user->user_login,$link[0]);                     // Parse %USERID%                     $link[0] = str_replace('%USERID%',$current_user->ID,$link[0]);                     $link[0] = str_replace('%userid%',$current_user->ID,$link[0]);                     echo '
'.$link[0].'
';                 }              }      Gracias...


Proper Way to Modify Plugin

What is the best way to modify a plugin? I frequently want to make small changes to one or two functions within a large plugin. This is easily done, but I have to use comments to mark my changes and modify the plugin again after an update. Ideally I'd like to leave the plugin alone and make my changes elsewhere, much like we do with themes and child themes. Can I make a plugin that requires the parent plugin and will override it?


Creating a path in a plugin to call a function

Okay, let's assume that I want to create a dynamic "printable" page using a system that doesn't play well with wordpress's theming engine, is there a way for me to define a "permalink" in my plugin that will call a predefined function, also in my plugin? If you're familiar with Drupal it's similar to how their hook_menu works, but I only need it on a very limited basis, so it doesn't have to be that robust.


Show different theme for admin?

I'd like to test some theme changes on my live site, but I obviously don't want regular users seeing any errors that may arise from it. I'd like to just duplicate my theme folder and if I'm logged in as admin, then that theme is shown to me, otherwise, the old theme is shown to my users. Is there a plugin to do this?


Multiple Plugins Interacting with Menu

Got an issue with the use of multiple plugins interacting with the menu system in WordPress. We are using UberMenu and wanted to use If Menu as well to control the visibility of some of the menu items. However UberMenu overrides If Menu and it can't be used. On the UberMenu forum one of the developers said > Unfortunately it is a limitation of the WordPress menu system that you can > only have one plugin/theme adding settings to a menu item at a time. and mentioned he was working on a work around. I'm curious has anyone else experienced this issue and could anyone offer a suggestion for a work around. Thanks in advance.


How do I include a template file while allowing it to render its own dynamic content added via custom box?

I have 3 theme files: `header.php`, `navigation.php` and `page.php` `page.php` calls `header.php` They both have content which is added to via a `custom box`. `navigation.php` has some content added to it via a `custom box`. Based on the page being called, I would want to include `navigation.php` within `header.php` as well. How would I do this? I want `navigation.php` to be included into `page.php` while both have content that is added to it via a `custom box`. **My guess** Create a page called 'Navigation', for example. I never display this link in my templates so that it's not used as a page on it's own even though it exists as one. This will allow me to edit its contents. Create another page by whatever name, this would use `page.php`. `page.php` would use some function to include `navigation.php` based on `is_home()`. If that idea is right, can someone please elaborate and give me details on what functions I would use, etc?


Get Content Limit?

I know this might seem like a silly question, but I've searched online and can't find what I"m looking for. It seems like I've used the following markup before (though modified) to limit the number of words that appear where this snippet is place. Can anyone help? I don't necessarily want to Read More link, just to be able to limit # of words in a few - NOT ALL - of my template files.               <?php the_content(); ?>


How to get current post ID in quick edit callback

This question is related to another previously asked question, which is a follow up on an answer. # Task As I want to extend QuickEdit to be something really awesome (and more than just _quick edit_ ), I need the ID of the currently "quick edited" post in my callbacks. ## Core MarkUp From what I can see in core in the `class-wp-posts/terms-list-table.php` file and the `WP_*_List_Table#inline_edit()` function, there're no values for checkboxes, input fields, etc. set via PHP. All are set via JavaScript. The structure looks like that:                    <form id="posts-filter" action method="get">

Post Data

another post... etc.

     </form>     <form method="get" action>

          </form>      ## Custom Quick Edit fields Depending on what and on which list table (post/term) we want to add custom quick edit boxes to, we need to add callbacks to filters. Again, those only work if we got a custom column (see other question).               add_action( 'quick_edit_custom_box', array( $this, 'addFields' ), 10, 3 );     # add_action( 'bulk_edit_custom_box', array( $this, 'addFields' ), 10, 2 );      The callback itself has the actual **_problem I'm facing_**. We have two (or in case of terms, three) arguments: `$postType` and `$columnName`. Both doesn't help me to retrieve the actual `$post_ID`, which I'd need for stuff like the `wp_editor()` for example.               public function addFields( $colName, $postType, $taxonomy = '' )     {         // How to retrieve the ID of the currently quick edited post in here?     }