title: How to make all posts in a category "unsticky"?

text: The other day I posted this question. Now I'm wondering how I can do the same thing except this time instead of making unsticky posts sticky the code should make the ones that already are marked as sticky (in the specified category) unsticky. I hope my question is clear. Thanks for all your help! EDIT: I actually figured out a way to almost make it work. The things I changed from the original code was to make it check if the post is already sticky (instead of checking that it isn't). Then I added an 'unset' to the actual action that the code performs. Anyway, here's the reformed code:               /**      * Un-sticky all posts in category 16      */          add_action( 'save_post', 'mark_post_unsticky' );     function mark_post_unsticky( $post_id ) {              if ( !wp_is_post_revision( $post_id ) && isset($_POST['sticky']) &&             in_category('16',$post_id) ) {                  unset($_POST['sticky']);                 }     }      The only problem now is that the change only happens when I manually edit the article and publish it again. So basically, I need a new "trigger" for it, could anyone please help with that? Thanks!


title: Images not showing and plugins not installing on wordpress server move

text: I have recently moved my wordpress site from localhost to an apache server with plesk. Upon doing this my images are not appearing on the website despite still being in the media folder (however I cannot see them in uploads despite that being their url path). Also when I try and install plugins wordpress asks for ftp login details and even when they are correct, the install fails. I have seen a number of potential solutions online, none of which seem to be working for me! Does anyone know if this may just be a case of the hosting company changing permissions? I did change them all temporarily to 777 in ftp but that still didnt solve the issue. My woocommerce importer won't even allow me to import csvs at the moment! Any help or ideas would be much appreciated as there seems to be one thing after another on this server move:) Matt


title: Display all posts under child sub category in sidebar on post page?

text:
I am trying to make a custom sidebar for my posts in certain categories. It will look something like this. ![enter image description here](http://i.stack.imgur.com/Jn9wS.png) My category structure looks like this:   * Parent 1      * Child 1        * Sub Child 1       * Sub Child 2     * Child 1        * Sub Child 1       * Sub Child 2   * Parent 2 What I want to do is to display all posts under Sub Child 1 and 2. I will be more specific, lets say we have 3 posts, 2 of them is under sub child 1 and last one is under sub child 2. Then I only want the 2 posts that is under sub child 1 to be displayed under Sub child 1, and the 3 :rd post to display only under sub child 2. I have been looking in 2 days now over the Internet to figure this out how to do this, but I dont get what I am doing wrong. Here is my code and what I am trying to modify:               <?php      $cat = get_the_category();     $catID = get_cat_ID($cat);     $subcats = get_categories('child_of=' . $catID);         foreach($subcats as $subcat) {         echo '
';         echo 'cat_ID) . '">';         echo '/' . $subcat->cat_name . '';         echo '
';         echo '
';         $subcat_posts = get_posts('cat=' . $subcat->cat_ID);         foreach($subcat_posts as $subcat_post) {             $postID = $subcat_post->ID;         echo '
';         echo '';         echo get_the_title($postID);         echo '
';         }         echo '
';     }      ?>      Any ideas?


title: Multiple posts with fixed order position

text: I have a scenario where I need to account for promo posts/ads within a category. For example, say I have a category called "featured", when I click through to this category, posts #2, #6 and #8 will display posts from the "Promo" category, while the rest of the "featured" posts would continue to render as normal. My thinking was to create a "Promo" category, and add a custom field of "sequence" to the posts within this category. Then, during the rendering of the featured loop check the position in the loop, check to see whether a post of Promo with sequence position exists, and display this, somehow - I'm not sure how. What would be the best way to implement this?


title: Using tabs for wordpress plugin

text:
Done my research and found this is how to call the built-in ui tabs jquery script in wp for the admin area but I'm stuck on implementing the other jquery scripts needed that I believe are built into wp. I know how to add the css and just added html, I just don't want to cause any problems with other existing plugins so I want to add these scripts below properly that are required. http://code.jquery.com/jquery-1.8.3.js http://code.jquery.com/ui/1.9.2/jquery-ui.js Here is what I'm going to use for javascript (again how to add the scripts above?):               function my_plugin_load_js() {     wp_enqueue_script('jquery-ui-tabs');     }     add_action('admin_enqueue_scripts', 'my_plugin_load_js' );          function mypluginjs() {     echo '';     }     add_action( 'admin_enqueue_scripts', 'mypluginjs' );      Here is what I got so far for html:

My plugin
       <form method="post" action="options.php">       <?php settings_fields('my_plugin_options'); ?>       <?php $options = get_option('my-plugin'); ?>

First

Second

Third

 options tr/td go here

 options tr/td go here

 options tr/td go here

        <input type="submit" class="button-primary" value="<?php _e('Save Changes') ?>" />

       </form>


title: Plugin to show a widget hashtag as widget or shortcode?

text: Is there a plugin that will show the results of a Twitter hashtag search either as a a widget or in a post/page via a shortcode? The shortcode is preferred. Thanks!


title: Problem with implenting Uploadify with Wordpress

text: Trying to get Uploadify to work together with Wordpress. I've implented the code from documentation in a metabox in wordpress admin area. I can "select file" and upload it, and Uploadify will show progress, but when I check the destination folder, it's empty. The folder has chmod 777 so I don't understand what could be wrong.. All help appreciated.               <link href="<?php echo get_stylesheet_directory_uri() ?>/uploadify/uploadify.css" type="text/css" rel="stylesheet" />     <script type="text/javascript" src="<?php echo get_stylesheet_directory_uri() ?>/uploadify/jquery-1.4.2.min.js"></script>     <script type="text/javascript" src="<?php echo get_stylesheet_directory_uri() ?>/uploadify/swfobject.js"></script>     <script type="text/javascript" src="<?php echo get_stylesheet_directory_uri() ?>/uploadify/jquery.uploadify.v2.1.4.min.js"></script>     <script type="text/javascript">     $(document).ready(function() {     $('#file_upload').uploadify({     'uploader' : '<?php echo get_stylesheet_directory_uri() ?>/uploadify/uploadify.swf',     'script' : '<?php echo get_stylesheet_directory_uri() ?>/uploadify/uploadify.php',     'cancelImg' : '<?php echo get_stylesheet_directory_uri() ?>/uploadify/cancel.png',     'folder' : '<?php echo get_bloginfo('url') ?>/wp-content/uploads',     'auto' : true     });     });     </script>          <input id="file_upload" name="file_upload" type="file" />      Uploadify.php               <?php     /*     if (!empty($_FILES)) {         $tempFile = $_FILES['Filedata']['tmp_name'];         $targetPath = $_SERVER['DOCUMENT_ROOT'] . $_REQUEST['folder'] . '/';         $targetFile =  str_replace('//','/',$targetPath) . $_FILES['Filedata']['name'];              // $fileTypes  = str_replace('*.','',$_REQUEST['fileext']);         // $fileTypes  = str_replace(';','|',$fileTypes);         // $typesArray = split('\|',$fileTypes);         // $fileParts  = pathinfo($_FILES['Filedata']['name']);              // if (in_array($fileParts['extension'],$typesArray)) {             // Uncomment the following line if you want to make the directory if it doesn't exist             // mkdir(str_replace('//','/',$targetPath), 0755, true);                  move_uploaded_file($tempFile,$targetFile);             echo str_replace($_SERVER['DOCUMENT_ROOT'],'',$targetFile);         // } else {         //  echo 'Invalid file type.';         // }     }     ?>


title: How to have dynamic sidebar content per post

text: I am setting up a site for a client and have included a dynamic sidebar in the template for certain types of posts. I would like the client to be able to add a text widget to that sidebar for a post and put in content related to that post only. Is this possible in WordPress or is the text widget put in one post going to show up on all others?


title: Set colors depending on category

text:
I have this function which outputs the last 6 posts of categories 1 and 2.
     <?php query_posts('cat=1,2&showposts=6'); ?>     <?php if ( have_posts() ) while ( have_posts() ) : the_post(); ?>
<a href="<?php the_permalink(); ?>" title="<?php the_title(); ?>"><?php the_title(); ?>
         <?php echo substr(get_the_excerpt(), 0,110); ?> ...

     <?php endwhile; ?>
      What I'd like to do is have the link to the article (for instance) red if it's from category 1 and green if it's from category 2. Can you help me?


title: WooCommerce "Save Changes" button appears inside custom settings

text: I am writing WooCommerce plugin which requires custom settings page. I have decided to extend general WooCommerce settings by adding new custom tab. I have managed how to do it in WooCommerce way and everything looks fine. However when I try to render my settings, the `Save Changes` button is rendered incorrectly. Here is how it looks like: ![enter image description here](http://i.stack.imgur.com/rYAFW.png) And here is test plugin:               <?php     /**      * Plugin Name: WooCommerce Settings Bug      */          add_action( 'woocommerce_settings_start', 'wpse8170_register_settings' );     function wpse8170_register_settings() {         global $woocommerce_settings;              $woocommerce_settings['test'] = array(             array( 'type' => 'title', 'title' => __( 'My Test Options', 'wc-loyal-customer' ), 'desc' => '', 'id' => 'test-options' ),                  array(                 'title'    => __( 'Enable Test', 'some-text-domain' ),                 'desc'     => __( 'Enable test options', 'some-text-domain' ),                 'id'       => 'test_option',                 'type'     => 'checkbox',                 'default'  => 'yes',             ),         );     }          add_filter( 'woocommerce_settings_tabs_array', 'wpse8170_register_settings_tab', PHP_INT_MAX );     function wpse8170_register_settings_tab( $tabs ) {         $tabs['test'] = esc_html__( 'Test tab', 'some-text-domain' );         return $tabs;     }          add_action( 'woocommerce_settings_tabs_test', 'wpse8170_render_settings_page' );     function wpse8170_render_settings_page() {         global $woocommerce_settings, $current_tab;         woocommerce_admin_fields( $woocommerce_settings[$current_tab] );     }      It is quite simple example, but works improperly... What am I doing wrong?


title: Wordpress hosting moved from windows server to linux server

text: Currently I asked my hosting provider to move my website from a windows server to a linux server. I'm trying to test if it works, but don't want to move the domain name just yet. I have to check if it works correctly. But when I try to login in wp-admin it redirects me to the old server. How can I change this? The url reads something like "..?reauth=1".


title: Enumerating over a category of links

text: I need to show a list of links, similar to what "Bookmarks" widget does. But Bookmarks widget is not suitable, because I need to display links (with removed "http://") instead of titles and also images of a custom size. Bookmarks widget seems not to being able to do this. As such, I want to code it in PHP. My question: How to enumerate all links of a specified category?


title: How can I change the way dates shown in the archive widget?

text: Now it shows something like this:   * March 2012   * February 2012 But I want to show something like this   * 03.2012   * 02.2012 or something in Turkish like this   * Mart 2012   * Şubat 2012


title: Uploading Images in the Link Manager

text: In `/wordpress/wp-admin/link-add.php` there is the possibility to add an image to a link, but it belongs to the category " **Advanced** " and is really a little too advanced for an average user, which needs first to upload an image somehow and only then to add the URL of the image to a link. Maybe there exists a plugin which simplifies adding an image to a link?


title: Should use widgets in this case?

text: We develop a new WordPress site with a new theme developed exclusively for this site. Some widgets of the same type (such as two "Bookmarks" widgets) should be styled differently (that is have different CSS). My question: In this case, should I use two Bookmarks widgets or hard-code it into the theme? I can write CSS specifically for these widgets having their ID, but this seems inelegant, especially because it would be broken if somebody removed my widget and then add his own similar widget. Widgetize or hard-code?


title: How to store an extra (surrogate) ID when creating a post with wp_insert_post?

text: I am generating posts based on rows from a table on an existing database. If a row in the database gets updated I will have to update the respective post. The proble is that I have to find the post to be able to update it, and I don't have any suitable key for that... One chance would be using the title, but the title can change so that is not an option. The best option for me looks like storing the key, from the respective database row, in the wordpress post (not as post id because that can lead to other problems). What is the best way to achieve this? Is there already an auxiliary field for this?


title: Apply custom taxonomy archive template to children

text: There is a slight problem that I cannot figure out by myself: I created a custom post type (`tours`) with custom taxonomy (`tour categories`). I have created a `taxonomy-tour-categories.php` to display an `archive` page for each tour category. Works perfect. I have a `tour category` (`School tours`) which needs a different layout, so I added a second template `taxonomy-tour-categories-shool-tours.php` with my desired layout. Again it works perfect. The problem is that the `'school tours'` tour category has its own subcategories (like `'workshops'`, `'science labs'` and so on) which I would like to be displayed by the `taxonomy.tour-categories-school-tours.php` template, but are displayed by the `taxonomy.tours-categories.php` template. Why that? I thought that wordpress - when a template file for a specific term is missing - would fall back to the immediately above level template file (in this case `taxonomy.tours-categories-school-tours.php`). What am I missing? Thanks for your help!


title: 3.8 Media Upload and Custom Meta Box

text: I've been using Tammy Hart's Reusable Custom MetaBox code for some time now but with the recent 3.8 update the media upload seems to be no longer functioning, and the code is no longer supported. The console is highlighting this area as being `Uncaught TypeError: Object #<Object> has no method 'media'`. Which I assume has something to do with a change in how 3.8 handles the media uploader. Reusable-Custom-WordPress-Meta-Boxes/metaboxes/js/scripts.js               imageFrame = wp.media({                     title: 'Choose Image',                     multiple: false,                     library: { type: 'image'},                     button: { text: 'Use This Image' }     });


title: do_shortcode does not work with slideshow shortcode

text: I am using the Slideshow plugin 2.2.7 by Stefan Boonstra and am adding the shortcode to a custom wp_editor() metabox. When I echo the slideshow plugin with:               echo do_shortcode( $banner ); /* $banner contains the shortcode string */      All I get is the string:               !slideshow_deploy!      on the webpage. I would appreciate some help on how I might get this to work or any alternatives that will work as well. This seems to be the best slideshow plugin around in terms of ease of use and efficiency. The plugin homepage is here: http://wordpress.org/extend/plugins/slideshow-jquery-image-gallery/ Thanks, nav **Edit** p.s. This question has been cross posted on the wordpress forum here.


title: how to keep theme background image, menu or site header image while moving site in sub directory?

text: I'm moving site root to sub directory, menu background image or site header display as default, I have change URL in db as set all sub directory location also set .htaccess but my custom background or header and menu not display as before? I'm used twenty ten theme.


title: Foundation 5 Dropdown Top Bar not working in WordPress

text: I made a 'first version' of a site with help of foundation 5. Now I'm trying to convert it to a WordPress (3.8) template. Most problems have been easily solved, but I can't get the Top Bar to work. At first it wouldn't work at all. With the help of google and earlier answers I fixed the normal menu with https://gist.github.com/awshout/3943026 and the mobile menu with http://foundation.zurb.com/forum/posts/304-foundation-5-topbar-mobile- navigation My only problem left is the dropdown menu. The dropdown still doesn't work. If I click on it, the button does turn dark, but no dropdown menu appears.


title: adding image in the header of my dev widget

text:
i want to add an image to the header of my widget in a div tag like so:

      how to get the right path to images folder then display the images ? Thanks


title: Changing Permalinks for Default Post type to reflect navigation

text: I have a particular issue with setting the permalink structure for "posts" on my website. Right now, I have the default "posts" page living under www.mywebsite.com/news-events/current-news/ I'd like the links for each post to parent under the URL structure, so they will read like such www.mywebsite.com/news-events/current-news/article-1 www.mywebsite.com/news- events/current-news/article-2 Right now, they only show as such www.mywebsite.com/article-1 www.mywebsite.com/article-2 Any ideas how I can repath the posts to reflect my URL structure? I only want to change it for the default posts, as I have CPTs that do not need to have the base URL rewritten to add "/news-events/current-news/", which is why I can't use the "Custom Structure" setting under "Permalinks" Thanks, Devin


title: Syntax for a function in order to get post's title in JSON encoded response

text:
I use the following code in functions.php in order to obtain all the images attached to a post so I can retrieve them via AJAX.               <?php     function get_all_images($post_id=0, $size='bigger', $attributes='') {         $post_id = $_POST['post_id'];         if ($post_id<1) $postid = get_the_ID();         if ($images = get_children(array(             'post_parent' => $post_id,             'post_type' => 'attachment',             'numberposts' => -1,             'orderby' => 'menu_order',             'post_mime_type' => 'image',)))             $response = '';             foreach($images as $image) {                 $attachment=wp_get_attachment_image_src($image->ID, $size);                 $tranparent=get_template_directory_uri();                 $response .= '';             }         die( json_encode( $response ) );     }?>      What I would like to do is to add a `<h2 class="titles">Title of the post</h2>` in the response before all the images. So I tried this:               <?php     function get_all_images($post_id=0, $size='bigger', $attributes='') {         $post_id = $_POST['post_id'];         if ($post_id<1) $postid = get_the_ID();         if ($images = get_children(array(             'post_parent' => $post_id,             'post_type' => 'attachment',             'numberposts' => -1,             'orderby' => 'menu_order',             'post_mime_type' => 'image',)))             $img = '';             $title = get_the_title($post_id);             $response = '
'.$title.'
'.$img.'';             foreach($images as $image) {                 $attachment=wp_get_attachment_image_src($image->ID, $size);                 $tranparent=get_template_directory_uri();                 $img .= '';             }         die( json_encode( $response ) );     }?>      I now get the post's title but not the images anymore. Any idea?


title: archives page ordering posts by multiple custom fields with query_posts

text: On my archives page, I am displaying posts ordered by a custom field 'date1'. This is the code that I am using, and it works.                $term = get_term_by( 'slug', get_query_var( 'term' ), get_query_var( 'taxonomy' ) );             query_posts( array_merge( array(       'meta_key' => 'date1',       'orderby' => 'meta_value',       'order' => 'ASC',       'posts_per_page' => 60        ), $wp_query->query ) );          if (have_posts()) : while (have_posts()) : the_post(); ?>      Now, I need to not only order the posts by the 'date1' field, but also by a custom 'time1' field, since there are multiple events that occur on one day, and I need to sort them by time. I am stumped on how to modify or replace my code to order by 2 custom fields on an archives page. Any suggestions would be welcome. I have it working on a custom template with the following code:               <?php               $querystr="SELECT * FROM $wpdb->posts     LEFT JOIN $wpdb->postmeta AS eventdate ON(     $wpdb->posts.ID = eventdate.post_id     AND eventdate.meta_key = 'date1'     )     LEFT JOIN $wpdb->postmeta AS eventtime ON(     $wpdb->posts.ID = eventtime.post_id     AND eventtime.meta_key = 'time1'     )     LEFT JOIN $wpdb->term_relationships ON($wpdb->posts.ID=$wpdb->term_relationships.object_id)     LEFT JOIN $wpdb->term_taxonomy ON($wpdb->term_relationships.term_taxonomy_id =  $wpdb->term_taxonomy.term_taxonomy_id)     WHERE  $wpdb->posts.post_status = 'publish'      AND $wpdb->term_taxonomy.taxonomy = 'Festival'     AND $wpdb->term_taxonomy.term_id = 97     ORDER BY eventdate.meta_value ASC, eventtime.meta_value ASC";     $pageposts = $wpdb->get_results($querystr, OBJECT);     if ($pageposts):       foreach ($pageposts as $post): ?>       However, I'd love to get it to work for my archive.php page so that all festival archives will pull up the schedule in the correct order. Any suggestions on how to get the sorting by multiple meta key values to work on an archive, category or search result page would be appreciated. I figured out a solution. I created a custom template for the taxonomy "Festival" (taxonomy-Festival.php) with my archive code, and then adjusted it to pull the term ID dynamically and insert it in to the query string.               <?php     $queried_object = get_queried_object();     $term_id = $queried_object->term_id;              $querystr="SELECT * FROM $wpdb->posts     LEFT JOIN $wpdb->postmeta AS eventdate ON(     $wpdb->posts.ID = eventdate.post_id     AND eventdate.meta_key = 'date1'     )     LEFT JOIN $wpdb->postmeta AS eventtime ON(     $wpdb->posts.ID = eventtime.post_id     AND eventtime.meta_key = 'time1'     )     LEFT JOIN $wpdb->term_relationships ON($wpdb->posts.ID =    $wpdb->term_relationships.object_id)     LEFT JOIN $wpdb->term_taxonomy ON($wpdb->term_relationships.term_taxonomy_id =    $wpdb->term_taxonomy.term_taxonomy_id)     WHERE  $wpdb->posts.post_status = 'publish'      AND $wpdb->term_taxonomy.taxonomy = 'Festival'     AND $wpdb->term_taxonomy.term_id = ";      $querystr.=$term_id;      $querystr.="     ORDER BY eventdate.meta_value ASC, eventtime.meta_value ASC";     $pageposts = $wpdb->get_results($querystr, OBJECT);     if ($pageposts):       foreach ($pageposts as $post): ?>       This is giving me some posts, however, which weren't included in the regular archive and I'm not sure why. Any input is welcome.


title: Publish post facebook page & twitter automatically

text: I need a feature in wordpress, using which a new post automatically posted to Facebook Page & Twitter. Do I need some plugin to do that.. Do you know any plugin that provides for this kind of feature? And may be support more social networks.


title: Updating URLs in many posts

text: I copied my WP content to a new install on a different server, so now my uploaded PDF documents have the old URL. Is there a simple way to fix that in all my posts at once, perhaps with SQL or some plugin ?


title: Plugin jQuery version VS Theme jQuery version: search for best practice

text: I have built a Wordpress plugin that is based on jQuery and I am using `wp_enqueue_script('jquery');` to make it all work. Let say the default version of jQuery loaded by Wordpress is 1.7.2, what would happen if the users installs a theme based on a different version of jQuery?   1. **What version of jQuery will run in the page where the plugin is called** : the default version of jQuery (as I'm using wp_enqueue_script('jquery')) or the version of jQuery called in theme?   2. **I can't figure out what version of jQuery will be used if a page includes multiple plugins and if each one of theme uses a different of jQuery**? Will everything mix up and end up in conflicts? Thanks for your help


title: Downgrade admin account by mistake

text: I made a huge mistake changing my admin account role from 'administrator' to 'Basic User'. Don't know what to do. Any suggestions how should I proceed to retrieve my account role back again, please?


title: wordpress pinboard theme

text: I would like to add content(just plain text) to the first page of my site and also have the posts displayed on it aswell. I am using pinboard theme. Does anyone know a good way of achieving this without having to hack away on the code? BR Kimpo


title: Display one post from each term in a custom taxonomy

text:
I am trying to display a list which shows one post (and information about the person posting) from each custom taxonomy term. The code I am using is as follows, but it is instead printing out EVERY single post. I could really use some help on this. My code is as follows:                               <?php $post_type = 'guestblogs';                          // Get all the taxonomies for this post type                     $taxonomies = get_object_taxonomies( (object) array( 'post_type' => $post_type ) );                          foreach( $taxonomies as $taxonomy ) :                               // Gets every "category" (term) in this taxonomy to get the respective posts                         $terms = get_terms( $taxonomy );                              foreach( $terms as $term ) :                                   $posts = new WP_Query( "post_type=$post_type&taxonomy=$taxonomy&term=$term->slug&posts_per_page=1" );                                  if( $posts->have_posts() ): while( $posts->have_posts() ) : $posts->the_post(); ?>
                                          <img class="alignleft" src="<?php the_field('profile_image','user_'.get_the_author_meta('ID')); ?>" style="height:210px; width:140px;" />
<?php the_terms($post->ID, 'guestbloggers'); ?>

                                              A blog by <?php the_author_meta(  'display_name', $author->ID ); ?>.

<?php the_author_meta( 'user_description', $author->ID ); ?>

<?php the_author_firstname(); ?>'s Latest Post: <a href="<?php the_permalink(); ?>"><?php the_title(); ?>

<?php echo wp_trim_words( get_the_excerpt(), 45, '...

ID) . '">...continue reading this article' ); ?> or view <?php the_author_firstname(); ?>'s entire archive in <?php the_terms($post->ID, 'guestbloggers', '', '', ''); ?>.

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


title: How to get themes from wordpress.com per SVN?

text: I'm running wordpress on my own host and would like to install the Ideation and Intent theme. I couldn't, however, find a place to download it from, nor can I search for it on my Wordpress dashboard under Appearance -> Themes. The best I could find was this svn url: https://wpcom- themes.svn.automattic.com/ideation-and-intent/ Does anyone know how I can get the theme? http://theme.wordpress.com/themes/ideation-and-intent/


title: Manually add navigation items to a menu

text: I tried to add a link manually to my menu, but something not works. I register my menu:               register_nav_menus(                 array(                     'main_nav' => 'Main',         ));      I try to add the item:               function add_login_logout_link( $items, $args  ) {         if( $args->theme_location == 'main_nav' ) {                 if (is_user_logged_in()) {                     $items = 'Logout';                 } else {                     $items = 'Login';                 }             }             return $items;     }     add_filter( 'wp_nav_menu_items', 'add_login_logout_link', 10, 2 );      where is the problem?


title: Save Email after login with ldap

text: I am using simple ldap login plugin to login into wordpress from active directory. But after successful login the username field is ok but email field is empty in wordpress users table. How can i make email saved in the database using this plugin. The link to plugin is: http://wordpress.org/plugins/simple-ldap-login/ Thanks in advance:)


title: Customizing an oEmbed video

text: I want to customize all videos on our site. Basically creators fill out a small application on our site and it generates into a post.               <?php if ( $campaign->video() ) : ?>             <div class="video-container">                 <?php echo $wp_embed->run_shortcode( '[embed]' . $campaign->video() . '[/embed]' ); ?>             </div>         <?php else : ?>             <?php the_post_thumbnail( 'blog' ); ?>         <?php endif; ?>      This is where there video gets inserted. I want to make a custom play button that is blue. I also want to hide the title of the player. I have been seeing sites taking advantage of customizing videos. Heres an example of what I am looking to do. https://www.quirky.com/shop/572-converge-4-port-usb-charging-station Best Regards,


title: Why does `url_to_postid` return 0 when testing `page_for_posts` Page?

text: If I set **Reading Settings** > **Posts Page** (in other words, the `page_for_posts` option) to a static page, and then attempt to pass its URL through `url_to_postid()` it will return `0` - why is it? I understand that it's technically no longer a static/post page, but is the posts page, however that page _still has an ID_ and I still need to get at it. Funny enough, I need to get the ID in order to test if it _is_ the same value as `page_for_posts`. I can't use the `0` returned from the url_to_postid function because 0 can be returned for a number of reasons. Does anyone know how I can test the current URL to get its ID, when it's set to the `page_for_posts` page?


title: Linking Custom Fields to Database Records

text: Hey there im fairly new to wordpress and php, but have a strong programming/database background. I recently learned about custom fields and am wondering if it is at all possible to do the following with them in conjunction with database tables... I want to be able to display a picture and name value for the person who posted the 'static' home page message. I would like to reference these values from a custom field bt have it linked to a pre-existing table of users. I say 'static' because its nt really a blog post and would be changed maybe once or twice a year. Is this the correct approach to this idea or does wordpress offer a more elegant approach? Thank you for your response/s in advance.


title: Why am I getting syntax error, unexpected 'endwhile' (T_ENDWHILE) in this template?

text:
I'm trying to echo a form, when the user is logged in, I get this in the browser when I upload the code: `syntax error, unexpected 'endwhile' (T_ENDWHILE) in` My code:               <?php     /*     Template Name: Customers     */          get_header(); ?>

                      <?php while ( have_posts() ) : the_post(); ?>                     <?php get_template_part( 'content', 'page' ); ?>                     <?php if (is_user_logged_in()):          echo '<form type="post" action="" id="newCustomerForm"> ';          echo 'Name:';     echo'<input name="name" type="text" />';          echo'Email:';     echo'<input name="email" type="text" />';          echo'Phone:';     echo'<input name="phone" type="text" />';          echo'Address:';     echo'<input name="address" type="text" />';          echo'<input type="hidden" name="action" value="addCustomer"/>';     echo'<input type="submit">';     echo'</form>';     echo'

';     echo'

';     echo '

';          else:     echo 'Sorry, only registered users can view this information';     ?>                      <?php endwhile; // end of the loop. ?>

          <?php get_sidebar(); ?>     <?php get_footer(); ?>


title: Problem with height in video shortcode

text: i think there is a problem with the video shortcode. When i use `[video src="" height="400"]` the **400px** height not work. The width work correctly but the height nothing. Is it a bug?


title: How can I enable Visual and Text tabs in a front end implementation of TinyMCE?

text: I have a plugin that uses TinyMCE for front end entry of content by users. However, the Text / Visual tabs are not available, and I'm not sure how to make them available. Here is the code from the plugin where the buttons are manipulated.               function dwqa_init_tinymce_editor( $args = array() ){     extract( wp_parse_args( $args, array(             'content'       => '',             'id'            =>  'dwqa-custom-content-editor',             'textarea_name' => 'custom-content',             'rows'          => 5,             'wpautop'       => false,             'media_buttons' => true        ) ) );               wp_editor( $content, $id, array(         'wpautop'       => $wpautop,         'media_buttons' => $media_buttons,         'textarea_name' => $textarea_name,         'textarea_rows' => $rows,         'tinymce' => array(                 'theme_advanced_buttons1' => 'bold,italic,underline,|,' .                         'bullist,numlist,blockquote,|,' .                         'link,unlink,|,' .                         'image,code,|,'.                         'spellchecker,wp_fullscreen,dwqaCodeEmbed,|,',                 'theme_advanced_buttons2'   =>  '',                 'content_css'   => apply_filters( 'dwqa_editor_style', DWQA_URI . 'assets/css/tinymce.css' ),         ),         'quicktags'     => false     ) );      } What do I need to change to enable text / visual buttons? The function reference doesn't seem to say how this can be enabled or disabled. Also, here is a link to the dev page where it's being used. http://bluepresley.com/exj/ask-question/ This code is part of the DWQA plugin (Design Wall Questions and Answers)


title: How I make a shortcode for this code?

text:
I wrote a script to display recent posts from a specific category in wordPress.               <?php     $catquery = new WP_Query( 'cat=3&posts_per_page=10' );     while($catquery->have_posts()) : $catquery->the_post();     ?>

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

<?php the_content(); ?>

     <?php endwhile; ?>      Now I want to make a short code for this code because I want to display recent categories in pages. I have no good idea about short codes. Can you please help me to create a shot code?


title: How do I add Facebook OpenGraph meta tags for attachments in the header for a custom theme?

text: How do I add Facebook OpenGraph tags in the header when the header has already been called, and the values I need to add are obtained in the body? This is a highly customized theme (which I did not create). Here is the `image.php` file which contains the attachment page for an image:                 <div class="posted-att">         <?php            echo wp_get_attachment_image($attachment_id,'large');      I don't know where `$attachment_id` is set. It's not set in `image.php`. It's set in several places in `wp-admin` and `wp-includes` but I'm not sure which ones are relevant. I tried adding the following to `header.php`, but `$attachment_id` was `null`/`0`.               <?php wp_head(); ?>          <?php echo 'attachment id = ' . $attachment_id; ?>     <?php if ($attachment_id != null) : // Facebook OpenGraph       $shareImage = wp_get_attachment_url($attachment_id); ?>       <meta property="og:image" content="<?=$shareImage?>" />     <?php endif; ?>      I also found this http://www.wpbeginner.com/wp-themes/how-to-add-facebook- open-graph-meta-data-in-wordpress-themes/, but my posts don't have featured images. I'm trying to share specific attached images.


title: Custom Admin Message from external source to multiple users

text: I am administrator for several wordpress sites. Each site has an editor and I would like to find a way to be able to write a single message in an external centralised place, and have that message display in each client's Wordpress admin (e.g. an info notice), similar to the update nag. At the moment, we use a plugin on each site to display static info, but this is not really ideal for sending a quick message to each client site. I have looked at several plugins but nothing appears to offer the simple functionality that I need. One message, typed centrally, then pulled in to each admin - probably via a plugin that calls for the message? What would be the best way to achieve this?


title: What is the right way to replace a post type's template?

text:
Recently I authored a plugin called Ultimate Post Types and now I have a conflict with the "Virtue" theme from WordPress.org My plugin is useful for quickly creating post types through the admin. When a CPT is created, I'm allowing users to choose which template to use for the newly created post type. The options include:   * The default page template   * The default post template   * Any custom page template that is available in the active theme. Then, when anything is being loaded I do this (assume that $cpt_slug and $chosen_template already have the right values):               <?php     add_action( 'template_redirect', 'upt_template_changer' );     function upt_template_changer() {         if( is_singular( $cpt_slug ) ) {             switch( $chosen_template ) {                 case 'single':                     get_template_part( 'single', 'event' );                     break;                      case 'page':                     get_template_part( 'page' );                     break;                      default:                     locate_template( $this->vars[ 'template_type' ], true, false );             }                  exit;         }     }     ?>      I'm locating the correct template, including it and existing. For me that should work well, since on 'template_redirect' WP has already loaded and the template should be ready to handle the loop. What is different though, is the way **Virtue** works. The page.php file of the theme looks like this:

                 <?php get_template_part('templates/page', 'header'); ?>

           <div class="main <?php echo kadence_main_class(); ?>" role="main">          <?php get_template_part('templates/content', 'page'); ?>
      As you can notice, there are no get_header() or get_footer() template tags inside that file. Instead, the template is being wrapped through the 'template_include' filter. Full code here: https://themes.trac.wordpress.org/browser/virtue/2.2.4/lib/utils.php#15 Now, when I use both at the same time, I'm including page.php and there are no header/footer. Do you think that what I'm doing is wrong or the theme isn't coded correctly? Could you give me any suggestions on how to react? I need the most universal and conflict-free solution if possible.


title: Advanced custom field - gallery - display one random image

text: I created a gallery with the "gallery add-on" of "advanced custom field" plugin. I'm trying to show one random image from the gallery on page refresh. Here's my code:               <?php              $gallery = get_field('gallery_home');                    $rand = array_rand($gallery, 1);                  if( $rand ): ?>                      <img src="<?php echo $image['url']; ?>" alt="<?php echo $image['alt']; ?>" />          <?php endif; ?>      But the result is this:                     Where am I missing something?


title: w3 Total Cache not Caching - Requested URI is rejected

text: For some reason Total Cache does seem to be caching my pages. Each time I got to a page, when I view source, the Total Cache comment shows that it regenerated the page for this request. What worse, it seems to be regenerating the combined/minified css and js files for each request as well! This alone adds another 5sec to the already 4sec the page takes to load. So I turned on debugging and this is what I am seeing:               W3 Total Cache: Page cache debug info:     Engine: disk: basic     Cache key: w3tc_site.com_1_page_e251273eb74a8ee3f661a7af00915af1     Caching: disabled            //PROBLEM     Reject reason: Requested URI is rejected           //PROBLEM     Status: not cached           //PROBLEM     Creation Time: 0.634s     Header info:     X-Pingback: http://site.com/xmlrpc.php     Content-Type: text/html; charset=UTF-8     X-Powered-By: W3 Total Cache/0.9.2.4          Performance optimized by W3 Total Cache. Learn more: http://www.w3-edge.com/wordpress-plugins/          Minified using disk: basic     Database Caching 6/6 queries in 0.011 seconds using disk: basic     Object Caching 608/613 objects using disk: basic          Served from: site.com @ 2011-09-18 17:47:24      Any ideas what could be going on hear? Update: For the record, if it makes a difference, the site is being hosted on IIS 7.5.


title: Load random posts without refreshing page (jQuery)?

text: I really hope that someone can help. I would like to load random posts on the homepage when a "LOAD NEW MESSAGE" button is clicked. We have 200 short messages loaded as posts in Wordpress. ON the homepage we would like people to be able to click a button to reload new messages - but without the page being refreshed. Please can someone help with how to do this? Thank you for your time. AB


title: Custom Post Type Categories Not Maintaining URL structure any more

text: I'm having a really hard time with this... I have a custom post type called "locations" that has several taxonomies for it. I was originally able to get it so that when you clicked on the category / taxonomy, the url and content pulled up just fine without any issues. However, I updated to wordpress 4.0 friday and since (might be indirectly responsible, or an updated plugin), it seems that the urls are weird and not pulling the custom post type category. The "locations" main page with ALL of custom post types comes up fine, and when you click on an individual custom post type, those come in too. However, still when you just try to click on "retail" for example as the category which should pull in the post types for all of "retail" posts that category, it's not doing it and the page is just completely blank... I have PHP error reporting on, but nothing is showing up. So, to make it more clear what's happening, this link doesn't come up blank without anything at all for the category of my custom post type: http://mydevsite.com/?locations_cats=retail HOWEVER, if you just manually type "locations" as the parent custom post type before the ?, it comes up just fine with all of the posts in that category... http://xmgpreview.com/playtime/locations/?locations_cats=retail So, I'm not sure what's going on... below is the code I am using for it. Can someone PLEASE help? Not sure why this isn't working any more, and the client wants to go live with the site soon. :? I'll try to provide the code used for my taxonomy if that helps...


title: How To Assign "Taxonomy per Taxonomy"?

text: In short, I have a site that offers products in several different stores. Each store is associated with a particular school. Since each school has its own school colors, many products are only available in certain colors in certain school. For example, given a particular T-shirt, we would want to offer that T-shirt in red, white and blue at School A, red, green and blue at School B, etc. Assigning colors and schools separately won't satisfy the requirement, unfortunately. Is there a way to assign taxonomies to a post in this way? As in check the School taxonomy first, then assign colors from the color taxonomy to that particular school taxonomy?


title: Apple push notification doesn't work

text: I wrote a plugin which fires an apple push notification to IOS devices. When I fire it manually via the root directory, it works perfectly. The catch, when I move it to plugin folder and run it as a plugin using:               add_action( 'publish_post', 'post_published' ,10,2);      it returns a ssl error from apple servers. Nothing was changed in the code (except for include ('wp-config.php')) which is not needed as a plugin. This is the error: > Warning: stream_socket_client() [function.stream-socket-client]: SSL > operation failed with code 1. OpenSSL Error messages: error:14094410:SSL > routines:SSL3_READ_BYTES:sslv3 alert handshake failure in > /nas/wp/www/staging/geektimecoil/wp-content/plugins/wp-mes-push-to-apple/wp- > mes-push-to-apple.php on line 131 > > Warning: stream_socket_client() [function.stream-socket-client]: Failed to > enable crypto in /nas/wp/www/staging/geektimecoil/wp-content/plugins/wp-mes- > push-to-apple/wp-mes-push-to-apple.php on line 131 > > Warning: stream_socket_client() [function.stream-socket-client]: unable to > connect to ssl://gateway.sandbox.push.apple.com:2195 (Unknown error) in > /nas/wp/www/staging/geektimecoil/wp-content/plugins/wp-mes-push-to-apple/wp- > mes-push-to-apple.php on line 131 Error: 0 This is the code as it is in the plugin:               function post_published($ID, $post ) {              // $url = "http://geektimecoil.staging.wpengine.com/googlePush.php"; global $wpdb;          // $post = get_post(211051);              $categories = get_the_category($post->ID );         if($categories){             $cond = array();             $cats = array();             foreach($categories as $category) {                      $cats[] = $category->slug;                 switch ($category->slug) {                     case "startup":                         $cond[] = "startup";                         break;                     case "development":                         $cond[] = "dev";                         break;                     case "gadgets":                         $cond[] = "mobile";                         break;                                   case "internet":                         $cond[] = "internet";                         break;                     case "hi-tech":                         $cond[] = "hightech";                         break;                     case "%d7%a1%d7%a7%d7%99%d7%a8%d7%95%d7%aa": // hebrew skirot                         $cond[] = "reviews";                         break;                     case "science":                         $cond[] = "science";                         break;                 }             }             print_r($cond);                  $condition = "( (".$cond[0]."=1)";             for ($i=1; $i<=(count($cond)-1) ; $i++) {                  $condition .= "or(".$cond[$i]."=1)";             }             $condition .= " )";         }              $sql="SELECT token FROM wp_mobile where device=1 AND ".$condition;         $users = $wpdb->get_results($sql);              print_r($sql);         print_r($users);                  $passphrase = '***';                  $ctx = stream_context_create();             stream_context_set_option($ctx, 'ssl', 'passphrase', $passphrase);             stream_context_set_option($ctx, 'ssl', 'local_cert','/push/geek_dev.pem');             // stream_context_set_option($ctx, 'ssl', 'local_cert','/push/geek_prod.pem');             stream_context_set_option($ctx, 'ssl', 'cafile', '/push/ios_entrust.pem');                  # Open a connection to the APNS server             $fp = stream_socket_client(//'ssl://gateway.push.apple.com:2195', $err,                                        'ssl://gateway.sandbox.push.apple.com:2195', $err,                                        $errstr, 60, STREAM_CLIENT_CONNECT|STREAM_CLIENT_PERSISTENT, $ctx);                  if (!$fp){                 echo "Error: ".$err;                 exit;             }                       $post_url = str_replace('www','m',get_permalink( $post->ID));             $body["aps"] = array(                                  "alert" => "message", //title                                  "sound" => "default",                                  "badge" => "0",                                  "url" => $post_url,                                  );                  $payload = json_encode($body);                  $msg = chr(1)                           // command (1 byte)             . pack('N', 'notification')             // identifier (4 bytes)             . pack('N', time() + 86400)             // expire after 1 day (4 bytes)             . pack('n', 32)                         // token length (2 bytes)             . pack('H*', 'db8***b414004ccb9a***2a54d9de06')                . pack('n', strlen($payload))           // payload length (2 bytes)             . $payload;                             // the JSON payload                  // Send it to the server             $result = fwrite($fp, $msg, strlen($msg));             //echo "\n$result";                  //set blocking             stream_set_blocking($fp,0);                  //Wait to response             sleep(1);                  fclose($fp);                  return $print;         }               add_action( 'publish_post', 'post_published' ,10,2); ?>      As I mentioned before, without the `add_action` and not as plugin, this exact same code is working.


title: featured image as slider and multiple featured images (without Plugin)?

text: hi there i need little help can anybody tell me that how can i add multiple featured images to a page and than make it a slideshow i didn't find any answer on Google thanks looking forward help from you guys


title: Personalized message for each unique password-protected page

text: How do I provide two different personalized messages for two different password-protected pages? I'm able to personalize the default message using the code below, but I'm not sure how to add a second unique message for visitors to a second password-protected page. I assume I would add some conditional code in my functions.php file but my attempts have failed. Any ideas?               // to functions.php: change password message for protected page/s          function change_pw_text($content) {     $content = str_replace(     'This post is password protected. To view it please enter your password below:',     'Hint: Tell our system to show you, and it will.',     $content);     return $content;     }     add_filter('the_content','change_pw_text');


title: WordPress 404 page returning with default in IIS7

text: I've installed a number of WordPress sites across many different platforms and I'm finding that when installed on IIS7 I'm getting the nasty default IIS7 404 error. I nuked Window's hold on the 404 and now I'm receiving the standard. > The resource you are looking for has been removed, had its name changed, or > is temporarily unavailable. Is there an address I need to redirect to in order to display the WP404? Or does anyone have a better suggestion? Thanks a ton!


title: How can I publish Word files to a WordPress blog without losing the footnotes?

text: I would like to take the contents from Microsoft Word files and convert them into WordPress blog posts without losing the footnotes. I've tried many different methods but have not found a simple working solution to this basic issue. The ideal solution would automatically upload a Word file (or many files) to a WordPress blog and convert the footnotes to HTML anchors.


title: Generate featured images old posts

text: I am looking for a way to generate featured image per post based on the first image in the post for old posts without a set featured image. I'm switching from handmade thumbnails to auto generated featured images. With new posts I got this working, but I don't want to set a featured image of my other 2000 posts by hand. Found some plugins, but they aren't working well or not supported and the info I did find here is all about setting the image with new posts. Any hook, script or function for this? Anyone got an idea?


title: How to get the date of a post in WordPress, so I could use it in a script?

text: I'm very new to WordPress. I need to get the date of a post and compare that date to a specific date (04/01/2011), so add some banners and stuff to every post created "after" that pivot date. But the only functions I found in the wordpress documentation are examples of functions to "print" the date, like the_time(), etc. Anyone knows how I could made this thing? Thanks in advance!!!


title: Replace default Blogroll Links with Social Media Links

text:
I'm creating a script that will remove the default "Blogroll" links in Links manager and replace them with an arbitrary listing of links, each with a custom css style name. It my case, I'll be replacing them with my list of social media links and icons. In order to make this truly dynamic, I'll be seeding the links from a customizable text file which the plugin owner can edit and place inside the plugin before its installed and activated. For example, the default blogroll.txt file would look like this:

Twitter

FaceBook

YouTube

LinkedIn

      And I'm creating a script that will parse this content and for each list item, it will use wp_insert_link() to add the list item to the "Links" listing. The only problem I have is that there's no way to insert a custom css class to define each link. This is needed so that the appropriate icon can be attached to the link. Perhaps I could use the "image address" field to do this, but css would be my preference. How would one assign a css class id or name to each link that's created?


title: Insert an image into a post by API

text: By using the code below, I can create a new post and upload an image to wordpress's `upload` directory as a attachment through a form's submitted data.                   $new_post = array(             'post_title' => $title,             'post_content' => $content,             'post_status' => 'publish',             'post_date' => date('Y-m-d H:i:s'),             'post_author' => $user_ID,             'post_type' => 'post',             'post_category' => array(3)         );         $post_id = wp_insert_post($new_post);              if (!function_exists('wp_generate_attachment_metadata')){             require_once(ABSPATH . "wp-admin" . '/includes/image.php');             require_once(ABSPATH . "wp-admin" . '/includes/file.php');             require_once(ABSPATH . "wp-admin" . '/includes/media.php');         }         if ($_FILES) {             foreach ($_FILES as $file => $array) {                 if ($_FILES[$file]['error'] !== UPLOAD_ERR_OK) {                     return "upload error : " . $_FILES[$file]['error'];                 }                 $attach_id = media_handle_upload( $file, $post_id );             }            }      I want to insert an image to post, not replace the featured image so `set_post_thumbnail()` function is not appropriate. I found that if I manually insert an image to post, it will generated the HTML code likes:                     So which API would provide the function of inserting image to post, likes generating the HTML code above and not replacing the featured image? Thanks


title: Implement Hooks Using Array

text: I'm trying to implement some hooks into a theme, but rather than write out every hook with repetitive code I was wondering if I could use and array to declare the hooks instead. E.g. ordinarily i'd use something like:               function hook_name_1() {         do_action( 'hook_name_1' );     }          function hook_name_2() {         do_action( 'hook_name_2' );     }      Is there a way to place the hook names into an array and then call them with one foreach loop or something similar? Something like the following:               $hook_array = array(     home_name_1,     hook_name_2     );          foreach ($hook_array as $hook) {         function $hook() {             do_action($hook);     }     }


title: GalleryView binding for WP Gallery, without NextGen

text: Is there a WP plugin that binds jQuery GalleryView to the stock WP Gallery? I love the appearance of GalleryView, but I don't want to have to use an external image & gallery database like NextGen. I just want to use the stock WP Gallery, stock WP media library, and display images attached to a particular post or page with jQuery GalleryView.


title: WP_Query most viewed posts, in multiple Post Types, last 30 days, excluding a specific taxonomy term

text: OK so I'm about 90% done, the only part that keeps breaking is when I try to exclude a specific taxonomy term. Break down: Sorting: ('v_sort' => 'views') This is being done via the popular WP-Postviews plugin. Post Types: post, videos, music, albums. Date: The last 30 days. **Excluded Taxonomy Term:** Taxonomy = content, Term = indy. The code of what works thus far.               <?php              // Create a new filtering function that will add our where clause to the query         function filter_where( $where = '' ) {             // posts in the last 30 days             $where .= " AND post_date > '" . date('Y-m-d', strtotime('-30 days')) . "'";             return $where;         }              add_filter( 'posts_where', 'filter_where' );              // The Query         $the_query = new WP_Query( array(             'posts_per_page' => '5',             'v_sortby' => 'views',              'post_type' => array( 'post', 'music', 'videos', 'albums' ) )          );         remove_filter( 'posts_where', 'filter_where' );         // The Loop         while ( $the_query->have_posts() ) :             $the_query->the_post(); ?>          I'm doing stuff here...              <?php endwhile;              /* Restore original Post Data           * NB: Because we are using new WP_Query we aren't stomping on the           * original $wp_query and it does not need to be reset.         */         wp_reset_postdata(); ?>      How would I exclude the content taxonomy term indy? I'm a beginner btw.


title: Usage of filters

text: Why is the filter removed after fetching feeds in the following example (from WordPress.org?)               <?php     function return_7200( $seconds )     {       // change the default feed cache recreation period to 2 hours       return 7200;     }          add_filter( 'wp_feed_cache_transient_lifetime' , 'return_7200' );     $feed = fetch_feed( $feed_url );     remove_filter( 'wp_feed_cache_transient_lifetime' , 'return_7200' );     ?>


title: removing inline styles from wp-caption div

text: Inline width and height attributes were never a huge problem with images in WordPress, since these were easily overwritten with CSS. The problem I'm having is that any images with captions are being wrapped in a ID 'attachment_('attachmentnumber') and a class of 'wp-caption' AND they're given inline CSS width and height properties. This is a major pain in the butt, so I'd like to remove the inline styles of this div if at all possible.


title: Custom Headers on Blog Posts Page

text:
So I have created my own template that has a set header for all of my pages home (which is a static front page), about, services, contact, etc.... I have recently created two newer pages products and blog. Products is using CataBlog to list my products and their information so I don't want the same header that I have used on the content pages. This also holds true for the blog page. I went into my header.php file and did the following:                           <?php                      if (is_page('blog')) { ?>

hi
                  <?php                 }                      if (is_page('product')) { ?>

hi
                  <?php                 }                      else {?>

<img src="<?php bloginfo('stylesheet_directory') ?>/images/01.jpg" alt="Pawtucket Pawnbrokers" />

<img src="<?php bloginfo('stylesheet_directory') ?>/images/02.jpg" alt="We Buy Gold" />

<img src="<?php bloginfo('stylesheet_directory') ?>/images/03.jpg" alt="Need Cash?" />

<img src="<?php bloginfo('stylesheet_directory') ?>/images/04.jpg" alt="Instant Cash Loans" />

             <?php                 }                  ?>      Now, when I go to the blog page the header maintains that of the static pages however the header on the product page is changed to display "hi" as expected. I changed the name blog in the is_page function to another of the static pages and received the desired result. I am assuming this means somewhere in my template files that original header is being called to display on the blog page. If this is true where should I look to make that change? If this is not the case what am I doing wrong? Any help is always appreciated!


title: wordpress settings API and option array structure

text:
how do you get the settings API to save options that are in an array structure like this:               $array = array (                     array(                  'id'=> '1',                  'name'=> 'tom',                  'pageurl'=> 'someurl',                  'notes'=> 'someNotes'                   )                     array(                      'id'=>'2',                      'name'=>'harry',                      'pageurl'=>'someotherurl',                      'notes'=>'anothernote'                       )                );      This array gets data sets added to and deleted from it by the user. The wp_list_table class I am using had its option set up the same way and I need to be able to edit those values later without having to delete the whole data set of the array I need to change and then recreating it. I have tried presscoders example and ozh sample options solutions with no success. I am trying to update the name field in the array of arrays. Only reason I am using this array structure is because of the wp list table. About to pull my hair out trying to get this to work. Here is what I have tried:               add_action('admin_init', 'ozh_sampleoptions_init' );     add_action('admin_menu', 'ozh_sampleoptions_add_page');          // Init plugin options to white list our options     function ozh_sampleoptions_init(){         register_setting( 'ozh_sampleoptions_options', 'fp_options', 'ozh_sampleoptions_validate' );     }          // Add menu page     function ozh_sampleoptions_add_page() {         add_options_page('Ozh\'s Sample Options', 'Sample Options', 'manage_options', 'ozh_sampleoptions', 'ozh_sampleoptions_do_page');     }          // Draw the menu page itself     function ozh_sampleoptions_do_page() {         ?>

Ozh's Sample Options
             <form method="post" action="options.php">                 <?php settings_fields('ozh_sampleoptions_options'); ?>                 <?php $options = get_option('fp_options'); ?>

Tab Name	                         <input type="text" name="ozh_sample[name]" size="75" value="<?php echo $options[0]['name']; ?>" />

                 <input type="submit" class="button-primary" value="<?php _e('Save Changes') ?>" />
             </form>
         <?php        }          // Sanitize and validate input. Accepts an array, return a sanitized array.     function ozh_sampleoptions_validate($input) {              // Say our option must be safe text with no HTML tags         $input[0]['name'] =  wp_filter_nohtml_kses($input['name']);              return $input;     }


title: What's the proper way to use the get_image_tag filter?

text: I'm attempting to remove the title attribute for post thumbnails (on certain posts), and I assume the get_image_tag filter is the way to do this. However, what I've got so far isn't working. What do I need to change to make this work? My code:               add_filter('get_image_tag', 'image_no_title');     function image_no_title($title) {         $title = '';         return $title;     }      And the relevant function (from wp-includes/media.php):               function get_image_tag($id, $alt, $title, $align, $size='medium') {              list( $img_src, $width, $height ) = image_downsize($id, $size);         $hwstring = image_hwstring($width, $height);              $class = 'align' . esc_attr($align) .' size-' . esc_attr($size) . ' wp-image-' . $id;         $class = apply_filters('get_image_tag_class', $class, $id, $align, $size);              $html = '<img src="' . esc_attr($img_src) . '" alt="' . esc_attr($alt) . '" title="' . esc_attr($title).'" '.$hwstring.'class="'.$class.'" />';              $html = apply_filters( 'get_image_tag', $html, $id, $alt, $title, $align, $size );              return $html;     }


title: A minimalistic admin theme for a WP 3 install

text: Is there a minimalistic admin theme that works with WP 3? Adminimize looks nice, but isn't compatible with 3.x.


title: Your own Bookmarklet in a blog

text: Does anyone know how to publish your own bookmarklet in a blog like wordpress or blogger? All of them seem to format the bookmarklet removing the javascript or messing it up. E.g., pasting this in wordpress blog:               f.fn.jquery||h(f)){c=a.createElement("script");c.type="text/javascript";c.src="http://ajax.googleapis.com/ajax/libs/jquery/"+g+"/jquery.min.js";c.onload=c.onreadystatechange=function(){if(!b&&(!(d=this.readyState)||d=="loaded"||d=="complete")){h((f=e.jQuery).noConflict(1),b=1);f(c).remove()}};a.documentElement.childNodes[0].appendChild(c)}})(window,document,"1.3.2",function($,L){$.hide()});" title="Run">      results in               Run jQuery Code


title: How to search all user meta from users.php in the admin

text: The search form at the top of the users listing in the Admin area (wp- admin/users.php) is limited and does not search all of the user meta fields, such as bio, instant messenger handles, etc. I've not been able to find a plugin that can add this. Is anyone aware of a plugin or a function I could create that could expand this search for all the date in the _usermeta DB -- ideally even extra fields create by a plugin or function.


"Remove Update Notification for all users except ADMIN User" I have 2 administrators in my wordpress, but I only want that one of them see the "Update Notification". I've inserted this code on my funtions.php file and change name of one of my adminastrator login name the code - if ($user_login !== "miguel") - but it didnt' work? Any help? Thanks


title: Apply class to every paragraph that holds image?

text: Hey guys,   When adding an image to a page or post wordpress is automatically adding a paragraph tag as parent holding the image. since there is no parent selector in CSS I'd love to find a solution to apply a specific classname to those paragraphs holding an actual image. Any idea if I can use add_filter() to apply a classname to each p that holds an image?


title: How to parse a huge list of users using a CRON function?

text: I have several thousand users subrscribed to a WP website. Everyday I need to send an email to each user. The emails are custom generated depending on the data of several custom user profile fields. For each user a custom query based on this data returns a list of posts, which constitute the message of the email. As you can imagine that can get pretty heavy on the server, for that reason, when I launch the function to parse the users, generate the email and send it, Wordpress crashes. It works fine with a couple of dozen users, but several thousand is too much. What I'd like to do to avoid this, is to only handle ten users at a time, every two minutes for example. I can do that with a CRON function. I'm looking for the best way to do that. It would be something like "parse the first ten users and send their email, then parse the next ten, etc." How can I implement this ten by ten rule ? How is my function going to know on which user to start each time I call it ?


title: Filter custom taxonomy table

text: I am trying to make a limited admin panel for some users. I would like to customize the taxonomy menu so that there is only one term visible when a user has a specific capability, but also allow him to add/remove children from that term (hierachically). Is there a filter or an action to do that?


title: Plugin: AJAX query external API to sync to tables

text: I'm wanting to write a plugin that hooks into an external API and syncs to a couple of database tables some information. I want to do this in a best practice way if there is one. I want the user to be able to click a button under the admin options for the plugin and do it manually and option via cron. I suppose it could take a few minutes the process so was thinking about using some sort of button and attaching an action to be commenced using jQuery to fire off via AJAX and put some sort of timer up until complete. For some reason im struggling to think of what way to achieve this and was hoping for a bit of direction on best practice way using WP features rather than a hack job. Had my eye out of plugin development for a while trying to find my feet again.


title: I have an error message coming up after I type in my domain. How Do I get my site back

text: i was informed by a bluehost rep that this is what he see's [03-Apr-2013 06:56:38] PHP Fatal error: Cannot redeclare widget_twidget() (previously declared in /home5/brandpg1/public_html/wp- content/plugins/twitter-widget/twitter-widget.php:21) in /home5/brandpg1/public_html/wp-content/plugins/twitter-widget/twitter- widget.php on line 21


title: Errors while Loading Most Recent Version of jQuery

text: I am trying to set up my WordPress so that it will use the most recent version of jQuery. Here is what I have done so far: ### functions.php               <?     add_action( 'wp_enqueue_scripts', 'RegisterJQuery' );     add_action( 'wp_enqueue_scripts', 'EnqueueScripts' );          function RegisterJQuery()     {         wp_deregister_script( 'jquery' );     wp_register_script( 'jquery', '//ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js', false, "1.9.1" );     wp_enqueue_script( 'jquery' );     }          function EnqueueScripts()     {         wp_enqueue_script('karate', THEME_DIRECTORY . '/js/karate.js', 'jquery');     }      So everything in my 'karate' .js file is working as expected (including an alert that confirms that the version of jQuery has indeed been updated). However, my theme (Elegant Theme Chameleon) uses a mouseover effect on its menu to show submenus and this effect does not work anymore. How can I figure out what is going on? My understanding is that if something was not compatible with the newer version of jQuery, it would still work if I upgraded the version (because of no-conflict mode). What do you think? William


title: How to change the name of the "edit my profile" link in the WordPress admin backend

text: I am really confused at this point. I can not figure it out how to rename `Edit My Profile` link in the admin backend. How can that be done?


title: Loading post content in FancyBox

text:
I got a tricky question. I have created a custom post type whose posts I would like to display in a scrolling carousel. The carousel will only display the title, the excerpt and a "read more" button. The "read more" button displays the full post in a FancyBox. Here is my code so far:
     <?php         $args = array( 'post_type' => 'jobs', 'posts_per_page' => 15 , 'order' => 'ASC' );         $loop = new WP_Query( $args ); ?>         <?php while ( $loop->have_posts() ) : $loop->the_post(); ?>

<?php the_title(); ?>
                 <?php echo excerpt( '30' ); ?>                 Read more →

<?php the_content(); ?>

         <?php endwhile; wp_reset_query(); ?>
       Everything is working nicely. The Carousel and FancyBox scripts are loading correctly but the FancyBox is displaying the wrong content. Any help/advice would be great.


title: Get list of months with posts

text: I am trying to add a filter on my custom theme based on post month, similar with the archives but with some differences. What is the best way to get a list of months in witch we have posts? Thanks, Alex I used the following query:                $wpdb->get_results("SELECT DISTINCT YEAR(post_date) AS `year`, MONTH(post_date) AS   `month`, count(ID) as posts                           FROM $wpdb->posts                           WHERE post_type = 'post' AND post_status = 'publish'                           GROUP BY YEAR(post_date), MONTH(post_date) ORDER BY post_date DESC"      Could not use the `wp_get_archives` function because it returns only the following formats:               html - In HTML list (<li>) tags and before and after strings. This is the default.     option - In select (<select>) or dropdown option (<option>) tags.     link - Within link (<link>) tags.     custom - Custom list using the before and after strings.


title: Migrating users from .com to .org?

text: I am in the process of migrating my blog from my wordpress.com address to a self-hosting (wordpress v3.1.2) address. Blog has migrated across nicely. Appears my users have also migrated across, but they cannot login with there old credentials (which are tied to wordpress.com, right)? I have around 30 users, and I would like to minimise the amoutn of work they have to do, to re-register to get access to the wp-admin console. What is the best way to keep the new users, but perhaps reset all there password to 'password'?


title: Redirect to requested page after (custom) login

text: I am developing a WP site locally and I want the content to be viewable only to users that have logged in, except for the front page that's visible to everyone. When a **non-logged in** user clicks on a link from the front page, it takes him to a customized login page made with _Theme My Login_. If he logins succesfuly from there, I want him taken to the page he initially requested, i.e. the link he clicked while at the front page. I have the first part of this working. Non-logged in users are taken to the custom login page. I cannot find a way to send them directly where they wanted to go, though. I have read several things and posts on the matter, tried different plugins, but haven't managed to apply them to my case. This is the code I am using to send them to the login page:               function checkLogged()     {         $pg = get_permalink();         if (!is_user_logged_in() && !is_front_page() && $pg != home_url('/?page_id=126'))         {             wp_redirect(home_url('/?page_id=126'));             exit;         }     }     add_action('wp_head', 'checkLogged'); ` where the page with ID=126 is the custom login page. Right now I am redirecting to the front page after login. But I want to change that to the requested page. I am using the login_redirect filter for that.               function takeMeThere()     {         $lastPage = wp_get_referer();         $loginPage = home_url('/?page_id=126');         if ($lastPage == $loginPage)         {             wp_redirect(home_url()); //this redirection should be to the requested page             exit;         }     }     add_filter('login_redirect', 'takeMeThere', 10, 3); ` I don't know if some of the code in the latter function is redundant but the login page kind of breaks without that (the footer doesn't appear). Anyway, essentially I'm asking how I can somehow retrieve the url of the link the user clicked on when not logged in. Or if there's an alternative approach I'd be happy to try it but I want that custom login page, not the Wordpress one. Any help would be greatly appreciated.


title: Get url-friendly version of the_title?

text: How can I get an url-friendly version of the post_title? I´m using anchor links for my posts on an archive page, and for the moment the posts get the post_ID as a hash tag but I would like to get the title instead as it would look nicer.


title: Archive pages have smaller font then the rest of my website

text: I have my awesome wordpress website here that I have been working on for weeks now and all is great with it except for one thing! For some reason when you try to look at the archives pages the whole page's font gets smaller. I mean, any navigation link, text link, paragraphs, titles, etc. I've checked my CSS and files but I can't seem to find out what is different with just that one page. I've used firebug to find out maybe the scripting is off in a section but I've had no luck finding anything different. I've tried to copy over from the twentyeleven archive.php page so I'd basically start as new as I could and then add in my extras but that didn't seem to work either. Had anyone come across this issue before or has advice as to what might be happening? I appreciate any feedback!


title: register_taxonomy and register_post_type does not work

text: I have a problem using the register_post_type and register_taxonomy on my Wordpress. I created the code on my functions.php and it does not update my panel. Why?               //Categorias personalizadas     register_taxonomy('produtos', 'produto', array('hierarchical' => true, 'label' => 'Categorias de Produtos', 'query_var' => true, 'rewrite' => true));     //Posts personalizados     add_action('init', 'create_post_type');     function create_post_type() {         register_post_type('produto',         array(             'labels' => array(             'name' => __('Produto'),             'singular_name' => __('Produto')),             'public' => true,             'rewrite' => true,             'supports' => array('title','editor','author','thumbnail','excerpt','comments','custom-fields','image'),             'has_archive' => true)         );     }


title: Order taxonomy terms wordpress

text: It seems like something really simple, however I can't find a good solution to what I am looking for. I created a page template that shows all my taxonomy term of a taxonomy called " **news** " eg: paper1, paper2 etc etc this is the code I generated:               <?php     $post_type = 'article';     $tax = 'news';     $tax_terms = get_terms( $tax );     if ($tax_terms) {         foreach ($tax_terms  as $tax_term) {         $args = array(             'post_type' => $post_type,             "$tax" => $tax_term->slug,             'post_status' => 'publish',             'posts_per_page' => -1,             'order' => 'ASC',             'caller_get_posts'=> 1         );                  $my_query = null;             $my_query = new WP_Query($args);                  if( $my_query->have_posts() ) : ?>          //here comes my styling for any term including it's custom post types          <?php else : ?>             <?php endif; // if have_posts()             wp_reset_query();              } // end foreach #tax_terms     }     ?>      everything works fine and the page generate all the taxonomy terms and their posts one by one like so (just a demonstration of course..):               paper1      - article 1      - article 1      - article 1      - article 1          paper2      - article 1      - article 1      - article 1      - article 1          paper3      - article 1      - article 1      - article 1      - article 1      The problem is that it displays everything in an a Descending order and I want to change it to Ascending. I always need to latest "paper" to show on top. Notice that I did add:               'order' => 'ASC',      to my arguments but it doesn't work on custom taxonomy terms and it keeps showing all the terms (papers) in a Descending order. I thought it should work like regular categories but surprisingly it doesn't. can anyone help?


title: How to specify URLS for custom posts & taxonomies

text: I've read a few posts about this, but can't find a clear answer :(   * I have a custom post type called {ondemand}   * Within the custom post, I have three taxonomies {speakers} and {categories} and {season}   * Each taxonomy has 3-4 terms, for example under {speakers} there is one called [joebloggs] Currently I have a main URL on our site, where the latest post is placed : www.mysite.com/ondemand When I filter the posts by taxonomy terms the URL defaults to: www.mysite.com/ondemand/{speakers}/[joebloggs] (uses taxonomy.php to display the results) However I'd like the URL to be like this for any term filtered: www.mysite.com/ondemand/[joebloggs] Here's the code that I've used in my functions.php - I tried a re-write in each taxonomy (commented out) but that didn't work - they lead to a 404 page.... Any advice or re-code hints would be very much appreciated               /**     * On Demand TV Post Type     */          add_action('init', 'ondemand');          function ondemand() {          $labels = array(     'name' => __('On Demand TV', 'post type general name'),     'singular_name' => __('TV Episode', 'post type singular name'),     'add_new' => __('New TV Episode', 'TV Episode'),     'add_new_item' => __('Add TV Episode'),     'edit_item' => __('Edit TV Episode Item'),     'new_item' => __('New TV Episode Item'),     'view_item' => __('View TV Episode Item'),     'search_items' => __('Search TV Episode'),     'not_found' => __('Nothing found'),     'not_found_in_trash' => __('Nothing found in Trash'),     'parent_item_colon' => ''     );          $args = array(     'labels' => $labels,     'public' => true,     'publicly_queryable' => true,     'show_ui' => true,     'query_var' => true,     'rewrite' => false,         'capability_type' => 'post',     'hierarchical' => true,     'menu_position' => 3,        'supports' => array('title','editor','comments','thumbnail')     );           register_post_type( 'ondemand' , $args );          register_taxonomy("Categories", array("ondemand"),      array("hierarchical" => true,      "label" => "Category",      "singular_label" => "Category",      "rewrite" => true));          register_taxonomy("Speaker", array("ondemand"),      array("hierarchical" => true,      "label" => "Speakers",      "singular_label" => "Speaker",      "rewrite" => true));     //"rewrite" => array('slug' =>'ondemand', 'hierarchical' => true, 'with_front' => false)));          register_taxonomy("Season", array("ondemand"),      array("hierarchical" => true,      "label" => "Seasons",      "singular_label" => "Season",     "rewrite" => true));     //"rewrite" => array('slug' =>'ondemand', 'hierarchical' => true, 'with_front' => true)));          }


title: Is there any good tutorial to write custom login, registration and password recovery forms?

text: I like to have login and password recovery managed by my own forms and embed them into my theme. I'm using the well written Jeff Farthing's plugin "Theme My Login" on some of my projects. But I would like to write my own custom functions and avoid the use of a plugin. However I would also like to learn more on the process of making custom forms for logging in. While I might spending some time dissecting the plugin as suggested in an answer to a similar question (How to create custom LOGIN and REGISTRATION forms?), I would like to know if there's any good tutorial, wiki or codex page which I might have missed that digs more or less deeply into user forms writing to have a better understanding of the subject. I'd rather have the answer "no, there isn't any" than just "stick to the plugin", which is kinda obvious and repeated - after all, me and some others reading might have missed something different and new such as a well written article or tutorial. cheers!


title: How to custom change author base without $this->front?

text: I have a sample code:               function change_author_permalinks() {         global $wp_rewrite;         $wp_rewrite->author_base = 'u';         $wp_rewrite->author_structure = "/" . $wp_rewrite->author_base . '/%author%';         add_rewrite_rule('u/([^/]+)/?$', 'index.php?author_name=$matches[1]', 'top');     }     add_action('init','change_author_permalinks');      but my current front set on my blog is: `t%post%` (ex: `www.domain.com/tauthor/username`) I want change to:               www.domain.com/u/username      But when run code, result is page not found ? How to fix it ?


title: Query multiple taxonomies with pagination

text:
i'm query multiple taxonomies and have no problem with it but pagination is not working how to solve it, i try alot of suggestion but no success here is my code                       if ( get_query_var('paged') ) {                 $paged = get_query_var('paged');             } elseif ( get_query_var('page') ) {                 $paged = get_query_var('page');             } else {                 $paged = 1;             }             if(isset($_POST['genre'])) {                 $myquery['tax_query'] = array(                 'showposts' => 20 ,                 'orderby' => 'title',                 'order' => 'ASC',                 'paged' => $paged,                 'relation' => 'AND',                 array(                     'taxonomy' => 'anime_genre',                     'terms' => $_POST['genre'],                     'field' => 'slug',                     'operator' =>'AND'                     )                 );             }             query_posts($myquery);                 if (have_posts()):                     while (have_posts()):                         the_post();                         mystique_post();                     endwhile;                 wp_pagenavi();                 else: ?>
<?php _e("No posts found","mystique"); ?>

<?php _e("Sorry, but you are looking for something that isn't here.","mystique"); ?>
                 <?php                  endif;       i have no problem with query taxonomies but only pagination is not working


title: Having a 2nd admin page for a custom post type

text: Right now, I understand by registering a custom post type, a list/edit page for it will appear in the admin menu in wp-admin. Is it possible to have a second list or edit page for the custom post type? The situation is that I am adding a functionality to WooCommerce's shop_order custom post type. If the user is of a certain role, he is able to view a limited info of the shop_order posts. So I would like to add in another admin page that would display the custom_post_type without messing with WooCommerce's one.


title: Custom field in TWIG template - Advanced custom fields plugin

text:
Does anyone know how to insert a custom fields (from Advanced Custom Fields plugin) into a twig template? This is the code I want to add into the twig file.               <img src="<?php the_field('profile_pic'); ?>" />      And this is the coding of the Twig template file                   {% extends 'layout - tlt.twig' %}          {% block content %}

{{ post.post_title }}

                                              {% if wp.get_the_post_thumbnail(wp.get_the_ID()) %}                             {{ wp.get_the_post_thumbnail(wp.get_the_ID())|raw }}                         {% else %}                                                      {% endif %}

                     {{ wp.do_shortcode(wp.apply_filters('the_content', post.post_content))|raw }}

                                                          {{ wp.get_post_meta(wp.get_the_ID(), '_tlt_mobile', TRUE) }}

                                                          {{ wp.get_post_meta(wp.get_the_ID(), '_tlt_phone', TRUE) }}

                                                                                {{ wp.get_post_meta(wp.get_the_ID(), '_tlt_email', TRUE) }}

                                                          {{ wp.get_post_meta(wp.get_the_ID(), '_tlt_location', TRUE) }}

                                                          {{ wp.get_post_meta(wp.get_the_ID(), 'contact_number', TRUE) }}

              {% if properties %}
                             {% endif %}     {% endblock %}      I did everything correctly up to inserting the code in the .twig file. Nothing worked.


title: Inconsistencies when inserting [video] vs [audio] and [playlist] using AJAX

text: Below are some test cases listed:   1. Insert audio or video `[playlist]` in the back-end TinyMCE. Result: it's always 100% wide.   2. View post with audio or video `[playlist]`. Result: it's always 100% wide.   3. Insert audio or video `[playlist]` in the front-end with AJAX and setup it with `WPPlaylistView`. Result: it's always 100% wide.   4. Insert `[audio]` in the back-end TinyMCE. Result: it's always 100% wide.   5. View post with `[audio]`. Result: it's always 100% wide.   6. Insert `[audio]` in the front-end with AJAX. Result: it's always 100% wide.   7. Insert `[video]` in the back-end TinyMCE. Result: it's always 640px wide.   8. View post with `[video]`. Result: it's always 100% wide (even if in the back-end it was shown as 640px wide).   9. Insert `[video]` in the front-end with AJAX. Result: it's always 640px wide. So, inconsistencies happen in 7, 8 and 9. 8 is the correct behavior. 7 and 9 should be 100% wide too. They are 640px wide even if I insert 1920x1080px video. Can I insert a video with AJAX and have it 100% wide (9th case)? I insert it via AJAX using `wp_oembed_get()`.


title: tinymce modal and I18n strings methods

text: Im working on a plugin that loads a tinyMCE modal. As many who know this normally involves opening a static html or even php file. The problem I've run into, is that I would like to translate using WP I18n functions the many strings in my modal. In the context of a piece of content that would normally be static, what options are there? Below is a typical example of the javascript that registers a new tinymce plugin, creating a new button which triggers a modal.               (function() {     tinymce.create('tinymce.plugins.ExamplePlugin', {         init : function(ed, url) {             ed.addCommand('tinyExample', function() {                 ed.windowManager.open({                     file : url + '/example.htm', // THIS IS A TYPICAL PATH                     width : 450 + parseInt(ed.getLang('example.delta_width', 0)),                     height : 450 + parseInt(ed.getLang('example.delta_height', 0)),                     inline : 1                 }, {                     plugin_url : url                 });             });             ed.addButton('example', {title : 'Example', cmd : 'tinyExample', image: url + '/example.gif' });         },         getInfo : function() {             return {                 longname : 'Example',                 author : 'Paul Robinson',                 authorurl : 'http://return-true.com',                 infourl : 'http://return-true.com',                 version : tinymce.majorVersion + "." + tinymce.minorVersion             };         }     });     tinymce.PluginManager.add('example', tinymce.plugins.ExamplePlugin);     })();      In this case the file url is a static html file. One option would be to instead use a php file and require the wp core like so:               // Load up Wordpress     define('WP_USE_THEMES', false);     require('../../../../../../wp-blog-header.php');      If we were to do this and then wrap all our strings in I18n functions, would this localise the strings in the modal for the user, and would this be best practice?


title: call shortcode in javascript

text: I want to display a shortcode through jquery after the DOM is loaded: This is how I call the shortcode: `<?php echo do_shortcode('[plugin]'); ?>` Now, my question is how can I call that shortcode inside a jquery function, because my website is based on jquery/ ajax calls? Thanks!


title: Get all posts (of any post type) an attachment is used in

text: It's not easy to count the amount of posts an image is attached to - WordPress simply doesn't keep track of that. It just keeps track of the post an attachment was originally uploaded to (not necessarily even using it there). ![enter image description here](http://i.stack.imgur.com/BHd1n.png) # Plugin To get you started as quick as possible, here's the plugin code:               <?php     /**      * Plugin Name: Media Count      * Description: Adds a column to the media admin list table to show the count of posts      */          add_filter( 'manage_media_columns', function( $cols, $detached )     {         $cols['count'] = 'Count';         $cols['size']  = 'Size';         return $cols;     }, 10, 2 );          add_action( 'manage_media_custom_column', function( $col, $id )     {         switch ( $col )         {             case 'size' :                 $meta = wp_get_attachment_metadata( $id );                 // Image                 isset( $meta['width'] )                     AND print "{$meta['width']} × {$meta['height']}";                 // Audio                 isset( $meta['bitrate'] )                     AND print "{$meta['length_formatted']} min";                 break;             case 'count' :                 $att  = get_post_custom( $id );                 $file = $att['_wp_attached_file'][0];                 // Do not take full path as different image sizes could                 // have different month, year folders due to theme and image size changes                 $file  = pathinfo( $file, PATHINFO_FILENAME );                 // @TODO Fill in the blanks                 break;         }     }, 10, 2 );      # Question: How to count the amount of posts an attachment is used in - the most efficient way. # Final Plugin The full plugin can be **downloaded as Gist here**.


title: More than one TinyMCE (wp_editor) with different $settings['drag_drop_upload'] values breaks

text: It appears that when I have two+ separate `wp_editors` with different values for `drag_drop_upload` they all are built as if they have `drag_drop_upload` set to true. If I set them all to false they act as expected, but if they have different values they do not. Here is code to demonstrate:               add_action( 'add_meta_boxes', function() {              add_meta_box( 'asdf123_editors', 'Editors', function() {                  wp_editor( 'Drag/Drop => True', 'asdf123_editor_1', array(                 'drag_drop_upload' => true,             ) );                  wp_editor( 'Drag/Drop => False', 'asdf123_editor_2', array(                 'drag_drop_upload' => false,             ) );              }, 'post' );          });      If you prefer, here's the code as a gist Is this a bug?


title: Shortcodes in widget titles: attributes include quotes which are html encoded, why?

text: I wrote a shortcode plugin that works with widget titles. So I added shortcode support to widget titles like this:               add_filter('widget_title', 'do_shortcode');      So my shortcode looks like this:               [hid-widget-title-twitter-link username="myusernameattribute"]      And in my shortcode handler I take one attribute "username" like this:               $args = shortcode_atts( array(             'username' => ''     ), $atts);      The problem is, the $args['username'] attribute includes surrounding quotes in its value, which are html encoded like this:               "myusernameattribute"      Instead of like this:               "myusernameattribute"      or this (with no quotes at all):               myusernameattribute      I can't find a mention of this in the WordPress docs, and I'm puzzled why the attribute value includes quotes at all, why those quotes are encoded and how to best handle it. Is there another WP function I should be calling to unencode the shortcode attributes, or should I be using `html_entity_decode()`, or is there something else wrong with my approach? Thanks. EDIT: This code will do the trick, however I still don't understand why the shortcode attribute is coming through with quotes, let alone with HTML-encoded quotes. When I put the same shortcode in a page rather than a widget title, it does not pass the quotes through so WP must process shortcodes differently in a page/post vs. a widget title.               $args['username'] = html_entity_decode($args['username'], ENT_QUOTES);     $args['username'] = str_replace(array("\"", "'"), '', $args['username']);


title: Meta query stopped working

text: The following query stopped working all of a sudden and I can't figure out why.               <?php     $today = date("Y/m/j");      query_posts(array(         'post_type' => array('events'),         'meta_key' => 'event_date',         'post_status' => 'publish',         'orderby' => 'meta_value',         'order' => 'ASC',             'meta_query' => array(                 array(                     'key' => 'event_date',                     'meta-value' => $value,                     'value' => $today,                     'compare' => '>=',                     'type' => 'CHAR'                     )              )        ));     ?>      No plugins have been installed and no one thouched the code, and I have no php/javacript error on the page. If I disable `value` in the meta_query, the posts show up fine, only there is no point of the query without it...


title: Remove 'Theme Options' Option Tree Wordpress

text: I use the Options Tree. Just to use a Meta Box only. And I do not use his Theme Options. In the picture below, how to throw Theme Options menu? Is it possible? ![Option Tree Theme Options](http://i.stack.imgur.com/61z86.png)


title: Is the W3 Total Cache plugin a good choice for WordPress MultiSite?

text: I heard that many people had issues with W3 Total Cache on a WordPress MultiSite install. And then I see this on the plugin page: > Compatible up to: 3.2.1 > > Last Updated: 2011-8-26 Seeing that I'm running on WordPress MultiSite Version 3.4.1 and that it's been over a year since the last plugin update, I'm really wondering if this plugin is a good choice for me. Or should I use WP Super Cache with WP Minify instead?


title: Linking Images to Post Page from Categorized Gallery

text: I used the code from this thread to create a plugin that automatically makes a gallery out of images attached to posts with certain categories. It works great, but now I want to make the images link back to their original post page (as opposed to linking to the attachment page or media file). Is there a way to do this? I have some coding experience, but it's mostly front end, so please be patient with my lack of PHP knowhow :)