title: Passing variables from header.php to template and vice verca

text: I've defined a variable - let's call it `$header_var`, which is placed in the header.php file. I would like this variable to be passed onto my template file (in this case taxonomy.php). Also I would like to be able to do the same the other way around, like passing a `$template_var` from my taxonomy.php to header.php. Is this even possible since the variable was not declared once the header was loaded? I've tried using global `$header_var` but without luck. Any suggestions?


title: Visual (non-HTML) display of post revisions

text: So you know when you click "show revisions" on a post and can choose to edit any of the recent drafts? I have a client, non tech-savvy, who is frustrated by how the revision previews display as HTML rather than how they would appear on the site. He finds it hard to determine which revision he wants to use because he can't see the images, formatting, etc. I looked for a plugin that would allow you to preview the revisions in their published form, but was unable to find anything of the kind. Can anyone suggest a plugin or a solution to this issue? Thanks!


title: '&' causes an error in my shortcode when I list the content of the page

text:
I would like to list the specified pages with my shortcode, but the problems are with the '$' charachters.               function get_page_func( $atts )         {             extract(shortcode_atts( array(                     'title' => ''             ), $atts ) );             $page = get_page_by_title($title);                  $the_query = new WP_Query( 'page_id='.$page->ID );                  if ( $the_query->have_posts() ) {                 while ( $the_query->have_posts() ) {                     $the_query->the_post();                     $html = '
post_name.'">

'.get_the_title().'

'.get_the_content().'
';                      }             }                  return do_shortcode($html);                  wp_reset_postdata();         }              add_shortcode( 'get_page', 'get_page_func' );      If I use `[get_page title="Questions&Answers"]`, the shortcode doesn't list the content of the Questions&Answers page, but lists every blog posts. Do I use the `wp_reset_postdata();` function properly? Where is the problem?


title: How should I store global information such as a phone number so that it is editable through the CMS?

text: Right now I have a p element in header.php containing the address and phone number my client wishes to use for contact info. How can I set this up so that it is editable through the WP admin area so that my client can easily change this in the future?


title: Add script into front from my plugin

text: I have a WordPress plugin, and I must load scripts from my plugin to the front of the site.               class My_Plugin {          function __construct()      {         add_action('admin_menu', array(&$this, 'add_submenu'));              add_action('admin_init', array(&$this, 'admin_init'))          }          function load_my_scripts(){         wp_enqueue_script('script', 'js/myscript.js');     }      I would like to load my script, so using the right hook which will be able to add the script into all the page of the site. I've already tried with               add_action('wp_head', array(&$this, 'load_my_scripts'));     add_action('init', array(&$this, 'load_my_scripts'));      etc, ... but I don't find any solution... Could you help me please ?


title: Google Maps and Yandex Maps doesn't work correctly

text:
When I try to insert a map into my WordPress page, I get only a gray-colored field with some controls as shown on the picture: ![enter image description here](http://i.stack.imgur.com/faHJ9.jpg) No matter, how I put in into the page: by using a special plugin or with my own java-code. I use WordPress 3.2.1 and I've tryed Google Maps for WordPress version 1.0.3 and Yandex Maps for Wordpress version 1.3.1 plugins as well as and my own code (I'm inserting it in the body of the page in html mode):

      I've tested the problem under different browsers: Opera 10.51, Google Chrome, IE8


title: Dropdown Menu for Query_Posts

text: I can successfully query post results using query posts like so...               <?php          // The Query     query_posts("gdsr_sort=rating");          // The Loop     while ( have_posts() ) : the_post();     ?>     <?php get_template_part( 'content', get_post_format() ); ?>     <?php      endwhile;          // Reset Query     wp_reset_query();          ?>      I was wondering if it's possible to make a dropdown menu where users can select different queries. So an example would a dropdown menu that says "Select Query" by deafult then when you click the dropdown menu it gives you different options like "Query 1", "Query 2", Query 3".. and when you click on one it loads the correct query for whatever query is set to number 1, 2, or 3. I've done a lot of research and haven't found too much help regarding this issue. I don't know if I should set up an `if / else` statement connect that to the `<select>` input and then.. I don't know where to go from there.. or if that is even a proper way of doing it. So, how would I make a dropdown menu that successfully loads different post queries? Any help would truly be appreciated. :)


title: Show page title just from the first child-page in template

text:
how can I do this: Pages: Home   - sub-1   -- sub-sub-1   --- sub-sub-sub-1  On home-page should only show the page-title of the **first child-page** like: sub-1 I found this:               <?php $child_pages = $wpdb->get_results("SELECT *  FROM $wpdb->posts WHERE post_parent = ".$post->ID."   AND post_type = 'page' ORDER BY menu_order", 'OBJECT'); ?>     <?php if ( $child_pages ) : foreach ( $child_pages as $pageChild ) : setup_postdata( $pageChild ); ?>
<a href="<?php echo  get_permalink($pageChild->ID); ?>" rel="bookmark" title="<?php echo $pageChild->post_title; ?>"><?php echo $pageChild->post_title; ?>
     <?php endforeach; endif; ?>      But it doesn´t work for me at all. The title will be show two times and show all child-page titles (sub-1, sub-sub-1, sub-sub-sub-1) Thanks   Ogni


title: Link to RSS feed not clickable?

text:
Having recently installed a theme update on an inherited premium theme, I am facing a minor irritation that I do not have the coding knowledge to solve. The theme displays a link to RSS feeds for archive and category pages but for some reason the new php file breaks the link - it displays correctly on the page but the hyperlink remains dead. I kept a copy of the old theme files so I am able to at least provide the differences in the code snippets. (If I add both to the file, although the page obviously displays the links twice, one of them will work, but either one on its own results in no clickable link to the feed). Here is the code from the old theme file:
Archive | <?php echo single_cat_title(); ?> <?php $cat_obj = $wp_query->get_queried_object(); $cat_id = $cat_obj->cat_ID; echo 'RSS feed for this section'; ?>
       and here is what I have in the new one:
<?php _e('Archive', 'woothemes'); ?> | <?php echo single_cat_title(); ?> <?php $cat_obj = $wp_query->get_queried_object(); $cat_id = $cat_obj->cat_ID; ?><a href="<?php get_category_rss_link(true, $cat, ''); ?>"><?php _e('RSS feed for this section', 'woothemes'); ?>
        I am afraid that as I do not have a membership to the theme provider's site I cannot get help from that avenue without paying a costly fee and as I'm not a customer of theirs I'm reluctant to pay so much in order to ask what is probably a simple question. Thanks in advance for any help that can be offered here. EDIT: When looking at the page source in FF the output appears to be correct yet still the link is not functioning. Here is the relevant output as seen in the page source:
     Archive | Wordpress                                   RSS feed for this section                   As you can see the feed is valid and the html would appear to be correct.


title: Convert a date to ISO8601 date format

text: This is more of a PHP question than a WordPress one. I have a custom post type event that by default outputs the date as "September 11, 2011 9:00 am" format. I'm trying to format the post in http://schema.org/Event format, I have converted every other part of the post to that format (place,address, etc) except the dates. Any help on how to convert that format to ISO8601 (http://en.wikipedia.org/wiki/ISO_8601) date format ? Thanks in advance.


title: jQuery UI Tools: Scrollable: More than 1 instance possible?

text:
[Found the answer (please scroll down to Edit2]: I'm trying to implement Scrollable into my theme. I ran into a few problems. I don't know much about javascript, but as people here encouraged me to try as it's very well documented, I gave it a try. Now, I need your help. I want several instances, but with my current setting it doesn't work. If I scroll through one instance, the other one will scroll, too. This is probably easy to fix for somebody who knows what to do. Also (it's a CSS problem, I suppose), I cannot get the "prev" and "next" buttons to work properly and I have no clue why. Here's the messed up page where I tried to implement it: click I used the minimal setup html, javascript and CSS provided here. The documentation says something about multiple instances here, but I don't quite get it. EDIT: It seems to work fine, here: http://www.tribalmystic.com/test/prevnext/ I used Firebug to analyze the Javascript. They tried exactly what I did using .scrollable2 etc., but it doesn't take effect at all for me!! Anybody any idea why? Ok, here we go: HTML + JS:

     a ölkad jfaölkds jfölksad jfösalkd jfsa     daödkjf aölksd jfölksad jfölksad jf     adsfjaöksdl jfölkdsa jfölkdsa jfölksad jfölkdsa jfölksadjf ölksadjf     dsfjaöksd jfölksadjf

     TEST TEST TEST TEST TEST TEST TEST TEST TEST TEST TEST TEST TEST TEST TEST TEST TEST TEST TEST TEST     TEST TEST TEST TEST

                     CSS:               /*         root element for the scrollable.         when scrolling occurs this element stays still.     */     #scrollable-1 {              /* required settings */         position:relative;         overflow:hidden;         width: 680px;         height:120px;              /* custom decorations */         border:1px solid #ccc;         background:#fff;     }          /*         root element for scrollable items. Must be absolutely positioned         and it should have a extremely large width to accomodate scrollable items.         it's enough that you set the width and height for the root element and         not for this element.     */     #scrollable-1 .items {         /* this cannot be too large */         width:20000em;         position:absolute;         clear:both;     }          .items div {         float:left;         width:680px;     }          /* single scrollable item */     #scrollable-1 img {         float:left;         margin:20px 5px 20px 21px;         background-color:#fff;         padding:2px;         border:1px solid #ccc;         width:100px;         height:75px;         -moz-border-radius:4px;         -webkit-border-radius:4px;     }          /* active item */     #scrollable-1 .active {         border:2px solid #000;         position:relative;         cursor:default;     }          /* this makes it possible to add next button beside scrollable */     #scrollable-1 {         float:left;      }               /*         root element for the scrollable.         when scrolling occurs this element stays still.     */     #scrollable-2 {              /* required settings */         position:relative;         overflow:hidden;         width: 680px;         height:120px;              /* custom decorations */         border:1px solid #ccc;         background:#fff;     }          /*         root element for scrollable items. Must be absolutely positioned         and it should have a extremely large width to accomodate scrollable items.         it's enough that you set the width and height for the root element and         not for this element.     */     #scrollable-2 .items {         /* this cannot be too large */         width:20000em;         position:absolute;         clear:both;     }          .items div {         float:left;         width:680px;     }          /* single scrollable item */     #scrollable-2 img {         float:left;         margin:20px 5px 20px 21px;         background-color:#fff;         padding:2px;         border:1px solid #ccc;         width:100px;         height:75px;         -moz-border-radius:4px;         -webkit-border-radius:4px;     }          /* active item */     #scrollable-2 .active {         border:2px solid #000;         position:relative;         cursor:default;     }          /* this makes it possible to add next button beside scrollable */     #scrollable-2 {         float:left;      }          /* prev, next, prevPage and nextPage buttons */     a.browse {         display:block;         width:30px;         height:30px;         float:left;         margin:40px 10px;         cursor:pointer;         font-size:1px;     }          /* right */     a.right                 { background-position: 0 -30px; clear:right; margin-right: 0px;}     a.right:hover       { background-position:-30px -30px; }     a.right:active  { background-position:-60px -30px; }                /* left */     a.left              { margin-left: 0px; }      a.left:hover        { background-position:-30px 0; }     a.left:active   { background-position:-60px 0; }                    /* disabled navigational button */     a.disabled {         visibility:hidden !important;            }       Where's the mistake? EDIT2: Found a solution: I finally found out what to do, so I'm writing it here as answer for future reference (maybe others run into the same problem). I hope it's okay to answer your own question? If not, please let me know! If you wrap the whole scrollable div in its own div INCLUDING the "prev" and "next" divs, then it works without any problems, more about it here. My poor nerves!! ;) I really appreciate your help, thanks!


title: Error establishing a database connection - Multi-site with subsite don't exisit

text: I have a multi site setup to which I have placed               define( 'NOBLOGREDIRECT', 'http://www.example.com' );      In the wp-config.php file However when I visit a site which dose not exist (e.g. http://nosite.example.com) I'm greeted with the following > Error establishing a database connection Instead of being redirected to the homepage as defined. I have disabled all plugins and reverted back to the default .httaccess however this has not solved the issue. How can I solve this and have a none existing subsites redirected to the appropriate location?


title: How to use wp_http with https-pages?

text: I'm trying to get content from an other site of mine, using iFrame-less Reloaded (http://wordpress.org/plugins/iframe-less-reloaded/) It uses the class WP_http but doesn't work with a page in https. Does anybody know a solution?


title: Issue with sorting by post date and custom post type

text:
I'm having a strange issue with sorting by post date. I created a slideshow post type and it does by default order by post date but If I change the date posted through the admin the order doesn't update in the query, but it does get updated in the admin. The Post Type               /* Slideshow Post Type */     add_action('init', 'slide_init');     function slide_init() {         $labels = array(             'name' => _x('Slides', 'post type general name'),             'singular_name' => _x('Slide', 'post type singular name'),             'add_new' => _x('Add New', 'slide'),             'add_new_item' => __('Add New Slide'),             'edit_item' => __('Edit Slide'),             'new_item' => __('New Slide'),             'view_item' => __('View Slide'),             'search_items' => __('Search Slides'),             'not_found' => __('No slides found'),             'not_found_in_trash' => __('No slides found in Trash'),              'parent_item_colon' => '',             'menu_name' => 'Homepage Slides'         );         $args = array(             'labels' => $labels,             'public' => true,             'publicly_queryable' => true,             'show_ui' => true,              'show_in_menu' => true,              'query_var' => true,             'rewrite' => true,             'capability_type' => 'post',             'has_archive' => true,              'hierarchical' => false,             'menu_position' => null,             'supports' => array('title', 'editor', 'thumbnail')         );          register_post_type('slide', $args);     }      The Query               // Slideshow Query     $slideshow_args = array(         'post_type' => 'slide',         'posts_per_page' => '10',     );     $slideshow = new WP_Query( $slideshow_args );      Edit - - I found out this has something to do with this line of code.               $slideshow_post_count = $slideshow->post_count;           <?php if ($slideshow_post_count > 1) : ?>

     <?php endif; ?>


title: How can I set the color of the border area areoun the page/post

text:
I'm trying to change the colors on a my WP site. I've made progress with the body of the posts/pages (as seen in this question). However, I haven't been able to extend it to the border of the post/page body. My experimental site can be found here See the circled areas in the following screen shot: ![example screen shot](http://i.stack.imgur.com/msMXo.png) I've managed to change the body color by setting the background color for .grid and .page. However the border around the text still eludes me. Here's what I think are the relevant elements.

                                    Doing the same trick .clearfix doesn't work for me. So I'm missing something fundamental here. What have I missed?


title: How can i change menu link when page content empty?

text: I have a menu with parent and child. I created menu from admin panel using Appearance >> Menus with selecting page. But some of my parent pages content empty so i want to set link(null) when page content empty as like :               <a href='javascript:void()'> Page Name </a>      i can do it set custom menu and link. But i want it dynamic if it is possible? any idea


title: Get terms within a custom taxonomy

text: I need to get an array of all terms within a custom taxonomy where they have a parent term from another custom taxonomy. The example would be I have a custom taxonomy "School" where each term (in this example we can say the term is "NE High", but other terms would be "SE High" and "SW High") can have children terms from another custom taxonomy called "Group". I would want to get all the groups that have been created for an individual school. Do I use get_terms for this, and if so, is it 'parent' that I leverage and how does it know which taxonomy to refer to? Thanks for any guidance!


title: Using xprofile_insert_field

text: I'm trying to add a xProfile to BuddyPress, but I don't know where but my snippet is not working. I have tried so many stuff, but I just can't get it right. Hope you can help, here's the latest version of my snippet:               add_action('bp_init', 'field_xprofile_twitter');          function field_xprofile_twitter()     {          xprofile_insert_field( $xfield_args );     global $bp;     $xfield_args =  array (                field_group_id  => 1,                name            => 'Twitter',                can_delete      => false,                field_order  => 1,                is_required     => false,                type            => 'textbox'         );     }


title: Remove "Get Shortlink" button in admin of custom post type

text: I want to remove completely this section under my title in my custom post type. (I don't need this because I use this only for content management). ![enter image description here](http://i.stack.imgur.com/bStyz.png) With this piece of code I can remove the permalink section:               add_filter('get_sample_permalink_html', 'myfunction', '',4);     function myfunction($return, $id, $new_title, $new_slug) {         global $post;         return ($post->post_type == 'mycustomposttype') ? '' : $return;          }      Now it looks like this but I want to remove the "Get Shortlink" button too. ![enter image description here](http://i.stack.imgur.com/V4JBW.png) Is there another filter for doing that? And yes... with CSS it's easy but I think a hook would be a better solution :)


title: Bridge Wordpress Media API with custom tinyMCE plugin

text: In my tinyMCE plugin, I would like to be able to call the Wordpress Media manager introduced in WP 3.5. I am currently working on a plugin that needs to fetch images from the library. I know we can easily call the media manager from a plugin but problem is in my tinyMCE plugin I can't call the wp_enqueue_media() in order to make it work. So is there any way to bridge tinyMCE with this media manager API ?


title: how to check if given page is active page

text: I am building my own custom menu for custom post type. I have a loop and I need to know if given item is active one. How to this properly? How to compare if given items address (slug, permalink, id or some other appropriate option) is the one that is currently loaded?               $args = array('post_type' => 'services');     $services = new WP_Query( $args );     $cnt = 0;     if( $services->have_posts() ) {         while( $services->have_posts() ) {         $services->the_post();         // HOW TO CHECK IF $services is the active page?


title: display unique post per category

text: On home page i need to display few post from different categories and here are some of the issues i have   1. Any posts can belongs to any number of categories. this is how i am planning to do it               $cat_args = array(          'orderby' => 'name',           'order' => 'ASC',          'exclude' => '17,1',          'number' => '6'        );           $fcategories =   get_categories($cat_args);         foreach($fcategories as $fcategory) {         $post_args = array(                  posts_per_page' => 1,                  'cat' => $fcategory->cat_ID                );             $fposts = query_posts($post_args);      while(have_posts()) : the_post();      get_template_part('post', 'homepage');      endwhile;      but i am facing few issue in this, on the `post-homepage.php` , i have following code to get category               $category_detail=get_the_category($post->ID);      and this can pick any category assigned to the post, moreover since same posts can be associated with multiple categories, its quite possible that same posst can appear under different category. How can i display unique posst per category, so that no 2 category have same post. As of now i can not pass any additional parameter to `get_template_part()`


title: URL prefix to include one PHP page

text: is it possible to set one URL prefix to include one PHP page every time? Only Wordpress header and this PHP page. I need to include some custom application but HAVE TO include wordpress powered web-design. For example - http://my.web.com/customapp/ is a prefix and               http://my.web.com/customapp/     http://my.web.com/customapp/some/function1     http://my.web.com/customapp/some/function2/x/y      points to one PHP page included in Wordpress theme-page. Thanks.


title: How to manage a particular "order by" for get_search_query()?

text:
How to manage in the search.php file the order of a posts search query managed with the following code               <?php     echo sprintf(__('%s Zoekresultaten voor ', 'website'), $wp_query->found_posts);     echo get_search_query();          while (have_posts()) {       the_post();     ?>

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

<?php the_excerpt(); ?>
         <?php the_time('j-M-Y H:i'); ?>
     <?php     }     ?>      Is it possible to chose a field to order the search results? My goal should be to sort them according the time of the post managed with the function `the_time('j-M-Y H:i');`.


title: Is it safe to use $_SERVER['REQUEST_URI']?

text: I've looked at other answers and I see that `$_SERVER['REQUEST_URI']` is usually recommended and is the accepted answer for getting the current page URI along with `$_SERVER['HTTP_HOST']`. I looked at the WP source code and it's widely used there too. But I found some controversy about it not working on IIS. Perhaps it was only an issue in the past? I even tried to install IIS in my PC to check it out but I can't configure it and it seems like an overkill just to confirm this. It seems like it's the only SERVER variable that includes the information I want: /pane-slug`/nggallery/tags/dark-colors/` the highlighted example part is added via NextGEN Gallery 2 and is only accessible through the `$_SERVER['REQUEST_URI']`, nothing else. Previously it was accessible using get_query_var, not anymore. If `$_SERVER['REQUEST_URI']` is not set, faking it through setting it manually and creating it based on `PHP_SELF` and `QUERY_STRING` brings inequivalent results. So is it safe to rely on `$_SERVER['REQUEST_URI']` being always available for use on WP installs? I assume it is since the WP core code uses it, but I had to ask.


title: Custom fields to save multiple values

text:
I’m adding custom meta-box, by means of jquery I can create in it several custom fields with a key “test”. There can be one or several custom fields, but the key is only “test”. I can also delete key values, which are no longer required. The problem is that I can’t save several values of the custom field with the same key. Only the last value is saved in all the fields. Help me, please, to find a decision!               <?php add_action( 'add_meta_boxes', 'add_test_meta_box' );           function add_test_meta_box()           {               add_meta_box( 'test_meta_box', 'TEST PARAM', 'add_test_meta', 'post', 'normal', 'high' );               }                function add_test_meta( $post )           {               // Grab our data to fill out the meta boxes (if it's there)               $test = get_post_meta( $post->ID, 'test', true );                   // Add a nonce field              wp_nonce_field( 'save_test_meta', 'test_meta' );              ?>

                      Param 1 key "test"
                     <input type="text" name="test" value="<?php echo esc_attr( $test ); ?>"  size="60" />Delete

                  <input type="button" value="Добавить" id="addnew">                  <?php          }               add_action( 'save_post', 'test_meta_save' );          function test_meta_save( $id )          {              // No auto saves              if( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ) return;                    // Check our nonce              if( !isset( $_POST['test_meta'] ) || !wp_verify_nonce( $_POST['test_meta'], 'save_test_meta' ) ) return;                   // make sure the current user can edit the post              if( !current_user_can( 'edit_post' ) ) return;                   // strip all html tags and esc attributes here              if( isset( $_POST['test'] ) )                  update_post_meta( $id, 'test', esc_attr( strip_tags( $_POST['test'] ) ) );            }                add_action('admin_head', 'my_add_input');                   function my_add_input() { ?>                         <?php } ?>


title: Theme Customizer not displaying saved values in wp_head (CSS)

text: I've been learning hot to add theme customizer feature to a theme. Used few sources for the code and help, but chose the Codex in the end. I am using a snippet from the codex itself, slightly modified to add more settings. The only thing I've done was to add few more color options. I am also using the Java script to show live changes. THE ISSUE: the function which calls back the settings saved values and adds the new values to a STYLE section in the header - Doesn't work. :/ it seems that it will not pull the saved value (or even the default one) with "get_theme_mod" can someone have a look at the code and point me to the right direction please ?? Here's my functions.php file.               <?php          class UnReady_Customize {             public static function register ( $wp_customize ) {           //1. Define a new section (if desired) to the Theme Customizer           $wp_customize->add_section( 'mytheme_options',              array(                 'title' => __( 'MyTheme Options', 'mytheme' ), //Visible title of section                 'priority' => 35, //Determines what order this appears in                 'capability' => 'edit_theme_options', //Capability needed to tweak                 'description' => __('Allows you to customize some example settings for MyTheme.', 'mytheme'), //Descriptive tooltip              )           );                //2. Register new settings to the WP database...           $wp_customize->add_setting( 'mytheme_options[body_background]', //Give it a SERIALIZED name (so all theme settings can live under one db record)              array(                 'default' => '#FFFFFF', //Default setting/value to save                 'type' => 'option', //Is this an 'option' or a 'theme_mod'?                 'capability' => 'edit_theme_options', //Optional. Special permissions for accessing this setting.                 'transport' => 'postMessage', //What triggers a refresh of the setting? 'refresh' or 'postMessage' (instant)?              )           );                     $wp_customize->add_setting( 'mytheme_options[site_title]', //Give it a SERIALIZED name (so all theme settings can live under one db record)              array(                 'default' => '#000000', //Default setting/value to save                 'type' => 'option', //Is this an 'option' or a 'theme_mod'?                 'capability' => 'edit_theme_options', //Optional. Special permissions for accessing this setting.                 'transport' => 'postMessage', //What triggers a refresh of the setting? 'refresh' or 'postMessage' (instant)?              )           );                     $wp_customize->add_setting( 'mytheme_options[site_description]', //Give it a SERIALIZED name (so all theme settings can live under one db record)              array(                 'default' => '#000000', //Default setting/value to save                 'type' => 'option', //Is this an 'option' or a 'theme_mod'?                 'capability' => 'edit_theme_options', //Optional. Special permissions for accessing this setting.                 'transport' => 'postMessage', //What triggers a refresh of the setting? 'refresh' or 'postMessage' (instant)?              )           );                         $wp_customize->add_setting( 'mytheme_options[link_textcolor]', //Give it a SERIALIZED name (so all theme settings can live under one db record)              array(                 'default' => '#0076d1', //Default setting/value to save                 'type' => 'option', //Is this an 'option' or a 'theme_mod'?                 'capability' => 'edit_theme_options', //Optional. Special permissions for accessing this setting.                 'transport' => 'postMessage', //What triggers a refresh of the setting? 'refresh' or 'postMessage' (instant)?              )           );                          $wp_customize->add_setting( 'mytheme_options[link_hover_textcolor]', //Give it a SERIALIZED name (so all theme settings can live under one db record)              array(                 'default' => '#0066d1', //Default setting/value to save                 'type' => 'option', //Is this an 'option' or a 'theme_mod'?                 'capability' => 'edit_theme_options', //Optional. Special permissions for accessing this setting.                 'transport' => 'postMessage', //What triggers a refresh of the setting? 'refresh' or 'postMessage' (instant)?              )           );                //3. Finally, we define the control itself (which links a setting to a section and renders the HTML controls)...           $wp_customize->add_control( new WP_Customize_Color_Control( //Instantiate the color control class              $wp_customize, //Pass the $wp_customize object (required)              'mytheme_bg_color', //Set a unique ID for the control              array(                 'label' => __( 'Background Color', 'mytheme' ), //Admin-visible name of the control                 'section' => 'colors', //ID of the section this control should render in (can be one of yours, or a WordPress default section)                 'settings' => 'mytheme_options[body_background]', //Which setting to load and manipulate (serialized is okay)                 'priority' => 10, //Determines the order this control appears in for the specified section              )           ) );                $wp_customize->add_control( new WP_Customize_Color_Control( //Instantiate the color control class              $wp_customize, //Pass the $wp_customize object (required)              'mytheme_site_title_color', //Set a unique ID for the control              array(                 'label' => __( 'Site Title Color', 'mytheme' ), //Admin-visible name of the control                 'section' => 'colors', //ID of the section this control should render in (can be one of yours, or a WordPress default section)                 'settings' => 'mytheme_options[site_title]', //Which setting to load and manipulate (serialized is okay)                 'priority' => 11, //Determines the order this control appears in for the specified section              )           ) );                $wp_customize->add_control( new WP_Customize_Color_Control( //Instantiate the color control class              $wp_customize, //Pass the $wp_customize object (required)              'mytheme_site_description_color', //Set a unique ID for the control              array(                 'label' => __( 'Site Description Color', 'mytheme' ), //Admin-visible name of the control                 'section' => 'colors', //ID of the section this control should render in (can be one of yours, or a WordPress default section)                 'settings' => 'mytheme_options[site_description]', //Which setting to load and manipulate (serialized is okay)                 'priority' => 12, //Determines the order this control appears in for the specified section              )           ) );                  $wp_customize->add_control( new WP_Customize_Color_Control( //Instantiate the color control class              $wp_customize, //Pass the $wp_customize object (required)              'mytheme_link_textcolor', //Set a unique ID for the control              array(                 'label' => __( 'Link Color', 'mytheme' ), //Admin-visible name of the control                 'section' => 'colors', //ID of the section this control should render in (can be one of yours, or a WordPress default section)                 'settings' => 'mytheme_options[link_textcolor]', //Which setting to load and manipulate (serialized is okay)                 'priority' => 13, //Determines the order this control appears in for the specified section              )           ) );                $wp_customize->add_control( new WP_Customize_Color_Control( //Instantiate the color control class              $wp_customize, //Pass the $wp_customize object (required)              'mytheme_link_hover_textcolor', //Set a unique ID for the control              array(                 'label' => __( 'Link Hover Color', 'mytheme' ), //Admin-visible name of the control                 'section' => 'colors', //ID of the section this control should render in (can be one of yours, or a WordPress default section)                 'settings' => 'mytheme_options[link_hover_textcolor]', //Which setting to load and manipulate (serialized is okay)                 'priority' => 14, //Determines the order this control appears in for the specified section              )           ) );                  }             /**         * This will output the custom WordPress settings to the live theme's WP head.         *         * Used by hook: 'wp_head'         *         * @see add_action('wp_head',$func)         * @since MyTheme 1.0         */             public static function header_output() {           ?>           <!--Customizer CSS-->           <style type="text/css">                                   body { color:<?php echo get_theme_mod('mytheme_options[body_background]'); ?>; }                  .site-title { color:<?php echo get_theme_mod('mytheme_options[site_title]'); ?>; }                              .site-description { color:<?php echo get_theme_mod('mytheme_options[site_description]'); ?>; }                              #content a { color:<?php echo get_theme_mod('mytheme_options[link_textcolor]'); ?>; }                              #content a:hover { color:<?php echo get_theme_mod('mytheme_options[link_hover_textcolor]'); ?>; }           </style>           <!--/Customizer CSS-->           <?php        }             /**         * This outputs the javascript needed to automate the live settings preview.         * Also keep in mind that this function isn't necessary unless your settings         * are using 'transport'=>'postMessage' instead of the default 'transport'         * => 'refresh'         *         * Used by hook: 'customize_preview_init'         *         * @see add_action('customize_preview_init',$func)         * @since MyTheme 1.0         */        public static function live_preview() {           wp_enqueue_script(                'mytheme-themecustomizer', // Give the script a unique ID                get_template_directory_uri() . '/js/theme-customizer.js', // Define the path to the JS file                array(  'jquery', 'customize-preview' ), // Define dependencies                '', // Define a version (optional)                true // Specify whether to put in footer (leave this true)           );        }              /**          * This will generate a line of CSS for use in header output. If the setting          * ($mod_name) has no defined value, the CSS will not be output.          *          * @uses get_theme_mod()          * @param string $selector CSS selector          * @param string $style The name of the CSS *property* to modify          * @param string $mod_name The name of the 'theme_mod' option to fetch          * @param string $prefix Optional. Anything that needs to be output before the CSS property          * @param string $postfix Optional. Anything that needs to be output after the CSS property          * @param bool $echo Optional. Whether to print directly to the page (default: true).          * @return string Returns a single line of CSS with selectors and a property.          * @since MyTheme 1.0          */         public static function generate_css( $selector, $style, $mod_name, $prefix='', $postfix='', $echo=true ) {           $return = '';           $mod = get_theme_mod($mod_name);           if ( ! empty( $mod ) ) {              $return = sprintf('%s { %s:%s; }',                 $selector,                 $style,                 $prefix.$mod.$postfix              );              if ( $echo ) {                 echo $return;              }           }           return $return;         }     }          // Setup the Theme Customizer settings and controls...     add_action( 'customize_register' , array( 'UnReady_Customize' , 'register' ) );          // Enqueue live preview javascript in Theme Customizer admin screen     add_action( 'customize_preview_init' , array( 'UnReady_Customize' , 'live_preview' ) );          // Output custom CSS to live site     add_action( 'wp_head' , array( 'UnReady_Customize' , 'header_output' ) );      Thanks Peeps :)


title: proper syntax of getting wp-admin pages/links

text: i cant seem to find the codex for my situation. normally, i use `get_bloginfo('template_url')` to get to the template path, but this time i need to get to some **WP-ADMIN** pages. i created a custom navigation bar on my `wp-admin` and everything is working fine. i just need to get the links for the ff:   * /wp-admin/upload.php    * /wp-admin/index.php   * /wp-admin/edit.php?post_type=page what is the proper syntax `getting` the **path** to these locations               get_bloginfo('admin_url')/wp-admin-upload.php // sample only, just to express my point.


title: Logout issue with new Domain on WP Multisite

text: I'm using a multisite and I set my site up at **_parentsite.com/mysite_**. When the logout button was clicked it worked correctly and logged the users out and brought them back to the homepage. Here's what the code was:               <a class="logout with-icon" href="<?php echo wp_logout_url( get_permalink() ) ?>" data-icon=""><?php _e('Log out', 'franklin') ?>      Then I bought a new domain name ( ** _mysite.com_** ) for the site, installed the "WordPress MU Domain Mapping" plugin and set up the A name to point to **_parentsite.com/mysite_**. Everything works fine except now the logout button brings them to the homepage of **_parentsite.com_** with this in the url: http://parentsite.com/?dm=cd427564d8195660acb35d2669c96069&action=logout&blogid=8&k=87e709a6777fa366cd42edc1c52f1db9&t=1751394297 instead of the homepage of **_mysite.com_**. I've tried changing the above code to:               <a class="logout with-icon" href="<?php echo wp_logout_url('http://mysite.com') ?>" data-icon=""><?php _e('Log out', 'franklin') ?>      but that didn't help. I've also tried               <a class="logout with-icon" href="<?php echo wp_logout_url('http://parentsite.com/mysite') ?>" data-icon=""><?php _e('Log out', 'franklin') ?>      and               <a class="logout with-icon" href="<?php echo wp_logout_url( home_url() ); ?>" data-icon=""><?php _e('Log out', 'franklin') ?>      Any ideas? This is very frustrating and embarrassing. Thanks!


title: Redirect to custom post type admin page after wp_trash_post

text: I currently have a `custom post type` (enquiries) with a custom `metabox` which displays the date(s) for that enquiry, these are saved as metakey key value pairs, there can be one or more. the metabox offers the option to delete any or all of these dates. When there are no dates, the post has no reason for being so it is trashed with `wp_trash_post()`. here is an excerpt of the function which saves the data in the metabox (i have taken out all the nonce stuff to display only the relevant code. This runs on a `save_post` action.               $enquiry_dates = get_post_meta( $post_id, 'enquiry_date', FALSE );          foreach( $enquiry_dates as $key => $value ) {         delete_post_meta( $post_id, 'enquiry_date', $value );     }          if( isset( $_POST['enquiry'] ) && ! empty( $_POST['enquiry'] ) ){         $enquiries = $_POST['enquiry'];         foreach( $enquiries as $date ) {             add_post_meta( $post_id, 'enquiry_date', $date, false );         }     } else {         // no enquiry dates set so trash the enquiry altogether         wp_trash_post( $post_id );     }      THE PROBLEM is that after trashing the post WP redirects back to the page to display the 'post_saved' message but it no longer exists. As expected, so, for this I built a function which is supposed to redirect by hooking into `trashed_post` but it is not working and I still get the same error message: "You can’t edit this item because it is in the Trash. Please restore it and try again" This is what I have so far:               add_action( 'trashed_post' , $redirect_to_cpt_admin_page, 10, 1 );          function redirect_to_cpt_admin_page( $post_id ){          $post_type = $post_type( $post_id );          if( $post_type ){         $loc = admin_url(  "edit.php?post_type=$post_type" );         wp_redirect( $loc );         exit;     }     }      Can someone point me in the right direction please ?! Thanks


title: Getting featured image with direct $wpdb within plugin

text:
I'm using a customized version of the Last Viewed Posts plugin to grab recently viewed releases on my record label site. The code I'm using grabs an attachment image but it is not always the page featured image - the results are intermittent. Here is the code:               function zg_recently_viewed() { // Output     echo '
';     if (isset($_COOKIE["WP-LastViewedPosts"])) {         //echo "Cookie was set.
";  // For bugfixing - uncomment to see if cookie was set         //echo $_COOKIE["WP-LastViewedPosts"]; // For bugfixing (cookie content)         $zg_post_IDs = unserialize(preg_replace('!s:(\d+):"(.*?)";!e', "'s:'.strlen('$2').':\"$2\";'", stripslashes($_COOKIE["WP-LastViewedPosts"]))); // Read serialized array from cooke and unserialize it         //echo $_COOKIE["WP-LastViewedPosts"];         foreach ($zg_post_IDs as $value) { // Do output as long there are posts             global $wpdb;             $zg_get_title = $wpdb->get_results("SELECT post_title FROM $wpdb->posts WHERE ID = '$value+0' AND ID IN ( SELECT object_id FROM $wpdb->term_relationships WHERE term_taxonomy_id = '5' ) LIMIT 1");             $thumb = $wpdb->get_var("SELECT ID FROM $wpdb->posts where post_parent = '$value' and post_type = 'attachment'");             /* $thumb = $wpdb->get_var( "SELECT meta_value FROM {$wpdb->postmeta} where post_parent = '$value' AND meta_key = '_thumbnail_id'" ); */             $thumbnail = wp_get_attachment_image_src($thumb);             foreach($zg_get_title as $zg_title_out) {                 if ($thumbnail) {                 echo "
post_title . "\">" . $zg_title_out->post_title . "
\n";                 } else {                 echo "
post_title . "\">" . $zg_title_out->post_title . "
\n";                 }                  }         }     } else {         //echo "No cookie found.";  // For bugfixing - uncomment to see if cookie     was not set     }     echo '
';      } This line: $thumb = $wpdb->get_var("SELECT ID FROM $wpdb->posts where post_parent = '$value' and post_type = 'attachment'"); ...grabs an image and most often _will_ grab the featured image for the page, but not always. The commented out line below that does not work but I think that is closer to what I'm looking for. The cookie is set in a function above this. Note that I do need to grab the featured image with a direct mysql call ($wpdb) and not using normal WP functions. Any ideas?


title: How to create a Dynamic link

text: I need a link thats dynamic, so So the lastestpost part will change whenever I create a new post. Basicly whatever is the last post to be created out of the three post types.


title: How can I write a rewrite rule to appear to move a multisite?

text: As we concluded in my question about trying to change the url of a multisite the simplest solution might be to add a rewrite rule, since it is infact only the end result that I'm concerned about here. I attempted to add a rewrite rule in a fairly simple way that didn't seem to work so I'm back to ask for your help. I think this is relevant here because the rewrite rule itself isn't complicated, but rather how it's interacting with WordPress that's daunting my efforts. The current directory structure looks something like this               r.info     /     +- blogs +- th              |   - .htaccess              |  + - wp-admin, wp-content, wp-includes              +- st      The original idea was that the new multisite would go into st giving /r.info/blogs/st but it turns out that the url considers /r.info/blogs/th to be base, resulting in /r.info/blogs/th/st At the moment there is no .htaccess file in any directory, except as noted above. I don't imagine that will stay the way it is for lots of obvious reasons.               -bash-3.2$ cat .htaccess     #RewriteEngine On    # Turn on the rewriting engine     #RewriteRule    /blogs/st/(.*)$    /blogs/th/st/$1    [NC]          # BEGIN wtwp_cache     <IfModule mod_mime.c>                  # Text             AddType text/css .css             AddType application/x-javascript .js             AddType text/html .html .htm             AddType text/richtext .rtf .rtx             AddType text/plain .txt             AddType text/xml .xml                  # Image             AddType image/gif .gif             AddType image/x-icon .ico             AddType image/jpeg .jpg .jpeg .jpe             AddType image/png .png             AddType image/svg+xml .svg .svgz                  # Video             AddType video/asf .asf .asx .wax .wmv .wmx             AddType video/avi .avi             AddType video/quicktime .mov .qt             AddType video/mp4 .mp4 .m4v             AddType video/mpeg .mpeg .mpg .mpe                  # PDF             AddType application/pdf .pdf                  # Flash             AddType application/x-shockwave-flash .swf                  # Font             AddType application/x-font-ttf .ttf .ttc             AddType application/vnd.ms-fontobject .eot             AddType application/x-font-otf .otf                  # Audio             AddType audio/mpeg .mp3 .m4a             AddType audio/ogg .ogg             AddType audio/wav .wav             AddType audio/wma .wma                  # Zip/Tar             AddType application/x-tar .tar             AddType application/x-gzip .gz .gzip             AddType application/zip .zip     </IfModule>          <IfModule mod_expires.c>             ExpiresActive On                  # Text             ExpiresByType text/css A31536000             ExpiresByType application/x-javascript A31536000             ExpiresByType text/html A3600             ExpiresByType text/richtext A3600             ExpiresByType text/plain A3600             ExpiresByType text/xml A3600                  # Image             ExpiresByType image/gif A31536000             ExpiresByType image/x-icon A31536000             ExpiresByType image/jpeg A31536000             ExpiresByType image/png A31536000             ExpiresByType image/svg+xml A31536000                  # Video             ExpiresByType video/asf A31536000             ExpiresByType video/avi A31536000             ExpiresByType video/quicktime A31536000             ExpiresByType video/mp4 A31536000             ExpiresByType video/mpeg A31536000                  # PDF             ExpiresByType application/pdf A31536000                  # Flash             ExpiresByType application/x-shockwave-flash A31536000                  # Font             ExpiresByType application/x-font-ttf A31536000             ExpiresByType application/vnd.ms-fontobject A31536000             ExpiresByType application/x-font-otf A31536000                  # Audio             ExpiresByType audio/mpeg A31536000             ExpiresByType audio/ogg A31536000             ExpiresByType audio/wav A31536000             ExpiresByType audio/wma A31536000                  # Zip/Tar             ExpiresByType application/x-tar A31536000             ExpiresByType application/x-gzip A31536000             ExpiresByType application/zip A31536000     </IfModule>     <FilesMatch "\.(?i:css|js|htm|html|rtf|rtx|txt|xml|gif|ico|jpg|jpeg|jpe|png|svg|svgz|asf|asx|wax|wmv|wmx|avi|mov|qt|mp4|m4v|mpeg|mpg|mpe|pdf|swf|ttf|ttc|eot|otf|mp3|m4a|ogg|wav|wma|tar|gz|gzip|zip)$">             <IfModule mod_headers.c>                     Header set Pragma "public"                     Header append Cache-Control "public, must-revalidate, proxy-revalidate"                     Header unset ETag             </IfModule>     </FilesMatch>     <FilesMatch "\.(?i:css|js|gif|ico|jpg|jpeg|jpe|png|pdf|swf|ttf|ttc|eot|otf)$">         <IfModule mod_headers.c>                     Header unset Set-Cookie             </IfModule>     </FilesMatch>     # END wtwp_cache          # BEGIN wtwp_security     <IfModule mod_rewrite.c>             RewriteEngine On             RewriteBase /blogs/th/st/             RewriteRule ^wp-admin/includes/ - [F,L]             RewriteRule !^wp-includes/ - [S=3]             RewriteRule ^wp-includes/[^/]+\.php$ - [F,L]             RewriteRule ^wp-includes/js/tinymce/langs/.+\.php - [F,L]             RewriteRule ^wp-includes/theme-compat/ - [F,L]     </IfModule>     <Files "wp-config.php">             Order allow,deny             Deny from all     </Files>     Options -Indexes     # END wtwp_security          # BEGIN WordPress     <IfModule mod_rewrite.c>     RewriteEngine On     RewriteBase /blogs/th/     RewriteRule ^index\.php$ - [L]          # add a trailing slash to /wp-admin     RewriteRule ^([_0-9a-zA-Z-]+/)?wp-admin$ $1wp-admin/ [R=301,L]          RewriteCond %{REQUEST_FILENAME} -f [OR]     RewriteCond %{REQUEST_FILENAME} -d     RewriteRule ^ - [L]     RewriteRule ^([_0-9a-zA-Z-]+/)?(wp-(content|admin|includes).*) $2 [L]     RewriteRule ^([_0-9a-zA-Z-]+/)?(.*\.php)$ $2 [L]     RewriteRule . index.php [L]     </IfModule>          # END WordPress      I have tried several variations of the RewriteRule you see commented out, which I left in case placement is an issue eg:               RewriteRule    ^r.info/blogs/st/$    r.info/blogs/th/st/        etc. Requests to the url in the rewrite returns a 404 error but accessing the undesired url directly works just fine.


title: Related posts with images ( not featured thumbnail)

text:
I need to show the thumbnail size images (not featured thumbnail) from the posts on the "related posts", code below: Thumbnail size (the images you insert into the posts from Media library) -vs- Featured thumbnail (is the new function "post-thumbnails" that you can attach an only image as featured image) What I need: [1] if the post has an only image, show it. [2] if it has multi images, show the first. [3] if non-images, show a static alternative. Can anyone modify the code below, or have other good snippets to make that happen please? Many thanks!               <?php     $categories = get_the_category($post->ID);     if ($categories) {         $category_ids = array();         foreach($categories as $individual_category) $category_ids[] = $individual_category->term_id;         $args=array(             'category__in' => $category_ids,             'post__not_in' => array($post->ID),             'showposts'=> 5, // Number of related posts that will be shown.             'caller_get_posts'=> 1         );         $my_query = new wp_query($args);         if( $my_query->have_posts() ) {             echo '
Related Posts
';             echo '
';             while ($my_query->have_posts()) {                 $my_query->the_post();             ?>
<a href="<?php the_permalink() ?>"><?php the_title(); ?>
             <?php             }             echo '
';         }     }     wp_reset_query(); ?>


title: how to get number of posts in a category on a specific date

text: I want to get the number of posts for each category on a specific date. I think I can do the following: - get a list of categories - start loop ---create a query for each category and specific date loop and count posts - end first loop Is there any easier way to do this? I plan to put this in the php code widget. Note I have quite a few categories


title: PHP echo inside javascript

text: I've got jwplayer installed in wordpress and have it showing in a single.php page... the way I have it I need to get a custom field in the javascript and I;m having no luck echoing it in there. I know you cant straight up run PHP in a javascript function, hence I'm here asking noob questions :)               <script type='text/javascript'>     jwplayer("lbp-inline-href-1").setup({     'flashplayer': '/wp-content/uploads/jw-player-plugin-for-wordpress/player/player.swf',     'image': '/wp-content/themes/sometheme/images/vid.png',     'file': '<?php echo get_post_meta($post->ID, 'video', true); ?>',     'skin': '/wp-content/plugins/jw-player-plugin-for-wordpress/skins/skewd.zip',     'stretching': 'exactfit',     'controlbar': 'bottom',     'width': '640',     'height': '360'     });     </script>       is it possible to get               <?php echo get_post_meta($post->ID, 'video', true); ?>      Running in there for the file path? Thanks for any advice.


What plugin should I use to add Microformats to my blog? So that information about author, ratings and comments are picked up by the search engines?


title: jquery ui dialog problem

text: I have problem to run jquery dialog right. Here is what i do: I'm adding               wp_enqueue_script('jquery-ui-dialog', array('jquery'));      next               jQuery(function($) {         $(".commnetsRights").dialog({             autoOpen: false,             show: {                 effect: "blind",                 duration: 1000             },             hide: {                 effect: "explode",                 duration: 1000             }         });              $(".commentsDialogRights").click(function() {             $(".commnetsRights").dialog("open");         });     });      And the result is: `Uncaught TypeError: Object #<Object> has no method '_hoverable' jquery.ui.dialog.min.js?ver=1.9.2:5`


title: Adding [...] string for a custom excerpt function

text: My blog is photo-oriented and the theme has a special excerpt function that, for better or for worse, I'd like to keep using. Anyway, it displays the excerpt and then the "More", but it just completely cuts of the excerpt, which I think looks a bit odd, especially mid sentence. Not really sure what kind of change has to be made here, and would if go into the custom excerpt function itself, or as a separate function called by the excerpt function?


title: Site Title and Tagline in Pagelines DMS Options Panel

text: I'm using the Pagelines DMS Theme and I'm wanting to extend the functionality of the front end admin panel. The user(s) I'm building this for would like to be able to edit a few settings directly from this page, including of which - the Site Title and Tagline. Concept: ![enter image description here](http://i.stack.imgur.com/LNXhK.png)               add_filter('pl_sorted_settings_array', 'add_global_panel2');     function add_global_panel2($settings){     $settings['privacy'] = array(         'name' => 'Blog Name',         'icon' => 'icon-eye-open',         'opts' => array(             // Regular Options Engine             array(             'id' => 'blogname',         'type' => 'text',                'label' => __('blog Name', 'pagelines')         ),             // Regular Options Engine             array(             'id' => 'blogdescription',         'type' => 'text',                'label' => __('blog description![enter image description here][1], 'pagelines')             ),         )     );     // Finally we return the new array     return $settings;     }      Is there a way to do this (add their own Site Title and Taglines) within a text-field for example, click Publish Options button to output it to the front-end of the site and display an updated version in the WP API Settings > General Settings sub-menu page?


title: Optimising a big Wordpress site

text: I'm looking at optimising a rather large site I've been adding to and adding to. The database has become pretty big (maybe 100,000 posts) and it has started slowing down somewhat and giving me "Mysql has gone away"errors. I've been reading about database optimisation and have ready some people saying you should only be looking to use 1-15 queries on a page. Do people think the suggestion that only a handful of queries should be used on any page? Am I correct in thinking that every time I use a Wordpress function such as get_permalink() I am creating a new query and new connection the database? I have some loops in there that literally loop through 100+ users at a time and use functions such as get_user_meta() in these loops - so would this mean I am literally making 100 database queries or are they somehow cached in Wordpress? Thanks


title: How do I remove TinyMCE text format

text: I just want to get rid of all the text format options in WP text editor, like H1, H2, etc. Typing the post/page title automatically gives you a H1 heading. It's not good practice to have more than one H1 heading per post/page so there's no need for this option. Let's say I just want to have an option for a subtitle like Heading 5 and nothing else. How do I do that? Appreciate any suggestion!


title: I want to add a custom "all posts by author" by authors name. How?

text: I have a custom display of meta-info (authors name, date and categories). So, I want to display a custom link to all posts by author. By theme default I have this `<?php the_author_posts_link(); ?>` which displays author name and if you press on it you get what I want. On the index.php actually it is what I want, but on single.php I would like to have something like "view all pages by author" text and if you would press on it, it should do exactly the same as adding `<?php the_author_posts_link(); ?>.` where should I start with this issue? Thanks!


title: How to pass the Querystring in pages?

text: I can easily add menu in the admin panel menus.just select the pages and cretae menu. i need to set pages URL with querystring. is that possible?. for example, http://mysite.com/about for this url i need to set http://mysite.com/about?abt=12 how can i set this querystring value using menu?. thanks Ravi


title: Check for featured image in WP_Query

text: Is there a way to filter posts by featured image when initialising a WP_Query object? Example               $my_query = WP_Query(array("has_thumbnail"=>true));      or, more ideally               $my_query = WP_Query(array("has_thumbnail_size"=>"custom_size"));


title: Metabox image upload and custom field

text: Is it possible to a) upload image in meta box (not using default WP image uploader) and then b) get the path to uploaded this way image in a custom field?


title: Why is WP creating both "/?tag=" and "/tag/" URLS for same content?

text: I've noticed that WordPress is generating duplicate content with slightly different URLs. For example:               http://example.com/the-blog/?tag=santas-workshop     http://example.com/the-blog/tag/santas-workshop/      Notice that, one is `/?tag=` (i.e. a query) and the other `/tag/` (i.e. a subdirectory). I deactivated all plugins but both URLs were still "200". Can't find any settings to change. Any suggestions for fixing this?


title: Is it possible to set JJ NextGen JQuery Carousel dynamic ids?

text: I usually get JJ NextGen JQuery Carousel with the short code:               <?php echo do_shortcode( '[jj-ngg-jquery-carousel gallery="2" width="120" height="120" visible="4" scroll="4" auto="0" wrap="circular" order="sortorder" gap="0" skin_class="jcarousel-skin-lango150"]' ); ?>      which is related to the nextGen gallery(id=2), previously created on the admin area. So, I'm trying to set this code on a single-{post type}.php, to be able to dynamically associate the gallery of each post, and retrieve their respective images, like:               <?php if(have_posts()) : ?>     <?php while(have_posts()) : the_post(); ?>     <!-- do-stuff -->     <?php echo do_shortcode( '[jj-ngg-jquery-carousel gallery="name-given-to-gallery" width="120" height="120" visible="4" scroll="4" auto="0" wrap="circular" order="sortorder" gap="0" skin_class="jcarousel-skin-lango150"]' ); ?>     <?php endwhile; ?>     <?php endif; ?>      Is it possible? Thanks in advance.


title: How can I use get header from within my plugin?

text: I'm writing a plugin to do some specific business logic - edit records for authenticated users, etc. Rather than having the overhead of a form processing plugin that uses stuff in template tags. I've created a rewrite do redirect like:               /mylisting/909  ->/wp-content/themes/myplugin/edit.php?id=909      Which seems to make sense as I'm keeping the very specific logic to an individual plugin. The problem is, I want to use my theme within my plugins files as they'll be output in the site's frontend and as such I want them to have the same look and feel. So I've tried get_header(); include('../mytheme/header.php') As well as including wp-load.php ...None of which work (I get fatal errors) Any help?


title: Permalink format: singular or plural

text: The default is singular, e.g.               http://example.com/category/apple/      But I am wondering if it is better to use the plural form, e.g.               http://example.com/categories/apple/      Are there any guideline on this?


title: Authors' Links on Homepage Not Going to Author Post Pages

text:
This problem only occurs with the articles/blog posts on the homepage of the site, readbuzz.com. On the homepage of the site, the author's name is supposed to link to that particular author's post page, where all the blog posts the author posted on the website will show up. Instead, each name that shows up links to the homepage. Yet, when you click and go into any of the posts on the homepage, then checked the author's link, it takes you directly to that author's post page. I know I need to include this function, but can't seem to find the place where I need to edit this: link **UPDATE: The code below is the correct code, in several different PHP files. Currently need to know how to write it using the the_author_posts_link();**
By <a href="<?php the_author_meta('user_url'); ?>"><?php the_author(); ?>


title: problem with pagination in custom permalinks

text: I have set custom permalinks: /%category%/%year%/%monthnum%/%day%/%postname%/ When I use the following url: http://revelutions.com/sandbox/one/2013/08/30/ works fine. However, when I click on the second page, I get a 404 I have tried this on a clean site. This also occurs with a standard theme


title: What's the best way to use the Featured Image for responsive web design?

text: I have a brilliant idea and since WordPress already takes care of some of the work, I just need to find a good method to make this work. I am working on a project that needs to be responsive to all devices, whether a desktop PC or mobile gadget. Thus, I want the images to also be responsive, meaning that mobile devices shouldn't load 50KB+ images. For each page or post, I can add a Featured Image using Post Thumbnails which, at full-size, the image is about 950x250 at ~60KB. If I load the website on an iPhone/Android, I wouldn't want the ~60KB image to load, but instead would like the small thumbnail to load in its place. The default method for responsive images is to make the width of the image 100% of the parent container, thus it will resize automatically if the parent container is also resized. Not the best method for larger images. I thought about trying out Filament Group's responsive image script, but I tried it and it didn't work right. One way this could be accomplished is through user-agent detection, but I'd rather not do this method either since user-agents can be spoofed. Here's another method for resizing images on the fly, but this seems to be duplicating what WordPress has already done. If there is a way of doing this with the Media Gallery images that WordPress has be default, with all the resized thumbnails already created, that would be preferable.


title: WP_Query to get posts in a specific category and post format

text:
I've been trying to utilize either `WP_Query` or `get_posts` to pull out the most recent post that's both in a specific category and of a specific post format.               <?php      $singargs = array(     'numberposts' => 1,     'tax_query' => array(         'relation' => 'AND',         array(             'taxonomy' => 'category',             'field' => 'slug',             'terms' => array ( 'gift-of-the-day' ),         ),         array(             'taxonomy', => 'post_format',             'field' => 'slug',             'terms' => array( 'aside'),         )     )     );     $singPost = new WP_Query( $singargs );     foreach ( $singPost as $post ) : setup_postdata($post); ?>
<?php the_title(); ?>
          <?php endforeach; wp_reset_postdata(); ?>      What am I doing wrong here?


title: Search for tags

text: Is it possible, to search just for tags? Not any other taxonomies or post types, just tag titles.


title: Perform query with meta_value date

text: I am trying to perform a query on a custom-type post using the value of a custom field. This field contains a string date: dd.mm.yyyy. The post type name is 'event' The custom field name is 'date_event' I would like to show all the EVENT that have the month of DATE_EVENT matching with the current month. Any suggestion pls?


title: Unable to create or edit menus

text: I'm running 3.4.2 on Ubuntu. I'm unable to make any changes to menus at all. Also I'm unable to upload anything (flash or browser uploader) to the media library. However plugins have no problem adding things to the library. When I try to make a change I get page not found. I have my memory limit set at 128MB in php.ini and wp-config.php. I've done all the basic troubleshooting on the wordpress wiki. Disabled all my plugins, switched themes, even ran _aptitude reinstall wordpress_ just to make sure all the core files weren't damaged. This is my debug.log               [21-Nov-2012 02:37:53 UTC] PHP Notice:  wp_enqueue_script was called incorrectly. Scripts and styles should not be registered or enqueued until the wp_enqueue_scripts, admin_enqueue_scripts, or init hooks. Please see Debugging in WordPress for more information. (This message was added in version 3.3.) in /usr/share/wordpress/wp-includes/functions.php on line 2758     [21-Nov-2012 02:37:53 UTC] PHP Notice:  wp_enqueue_style was called incorrectly. Scripts and styles should not be registered or enqueued until the wp_enqueue_scripts, admin_enqueue_scripts, or init hooks. Please see Debugging in WordPress for more information. (This message was added in version 3.3.) in /usr/share/wordpress/wp-includes/functions.php on line 2758     [21-Nov-2012 02:37:54 UTC] PHP Warning:  Creating default object from empty value in /usr/share/wordpress/wp-admin/includes/update.php on line 92      I'm managed to stump my self here. I've done everything short of re-installing the entire site.


title: WordPress Admin Interface not styled properly

text: The laptop I was working on recently crashed. But, I managed to get everything on it backed up, including my recent WordPress project off of my local server (I use MAMP). I uploaded my SQL database and copied the WordPress website folder into my local server. The WordPress login interface looks normal, but after you get the login, it looks like this: ![error screenshot](http://i.stack.imgur.com/aPLu8.png) Is there something I missed when transferring my WordPress project from my old local server to the new one? Any suggestions are greatly appreciated!


title: WPNetwork with custom URL Rewrite rules

text: I have a theme that has some custom rewrite rules built in to it. The problem is that they are not working with WP multisite. On the install I use to build themes (which is outside of the network), it works fine. When I bring the theme into the network, it doesn't work. **funcitons.php**               add_rewrite_rule('^prop/([^/]*)/?','index.php?pagename=prop&mls=$matches[1]','top');          add_filter('query_vars', 'add_mls');          function add_mls($public_query_vars) {         $public_query_vars[] = 'mls';         return $public_query_vars;     }      **web.config**               <?xml version="1.0" encoding="UTF-8"?>     <configuration>     <system.webServer>         <rewrite>             <rules>                 <rule name="WordPress Rule 1" stopProcessing="true">                     <match url="^index\.php$" ignoreCase="false" />                     <action type="None" />                 </rule>                 <rule name="WordPress Rule 2" stopProcessing="true">                     <match url="^wp-admin$" ignoreCase="false" />                     <action type="Redirect" url="wp-admin/" redirectType="Permanent" />                 </rule>                 <rule name="WordPress Rule 3" stopProcessing="true">                     <match url="^" ignoreCase="false" />                     <conditions logicalGrouping="MatchAny">                         <add input="{REQUEST_FILENAME}" matchType="IsFile" ignoreCase="false" />                         <add input="{REQUEST_FILENAME}" matchType="IsDirectory" ignoreCase="false" />                     </conditions>                     <action type="None" />                 </rule>                 <rule name="WordPress Rule 4" stopProcessing="true">                     <match url="^(wp-(content|admin|includes).*)" ignoreCase="false" />                     <action type="Rewrite" url="{R:1}" />                 </rule>                 <rule name="WordPress Rule 5" stopProcessing="true">                     <match url="^([_0-9a-zA-Z-]+/)?(.*\.php)$" ignoreCase="false" />                     <action type="Rewrite" url="{R:2}" />                 </rule>                 <rule name="WordPress Rule 6" stopProcessing="true">                     <match url="." ignoreCase="false" />                     <action type="Rewrite" url="index.php" />                 </rule>             </rules>         </rewrite>     </system.webServer>     </configuration>              Now, the part that I see that is similar, but not identical is "Wordpress Rule 3", where in my test site, it looks like this:               <rule name="wordpress" patternSyntax="Wildcard">         <match url="*"/>             <conditions>                 <add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true"/>                 <add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true"/>             </conditions>         <action type="Rewrite" url="index.php"/>     </rule>      So I went ahead and added the rule from my dev site to the network--but I still don't get anything. Any pointers?


title: Simple Local Avatar Plugin

text: I think that Im very close to achieve my goal.. I have this function on my themes but I need a help to find the right way to call simple local avatar function so it will show the local avatar image from simple local avatar pugin instead wordpress gravatar?               $first_img = get_avatar( $post->post_author );      Is there anyone can help?               function get_post_image() {       global $post, $posts;       $first_img = '';       ob_start();       ob_end_clean();       $output = preg_match_all('/<img.+src=[\'"]([^\'"]+)[\'"].*>/i', $post->post_content, $matches);       $first_img = $matches [1] [0];            if(empty($first_img)){ //Defines a default image         $first_img = get_avatar( $post->post_author );       }       return $first_img;     }


title: How to filter PHP opener?

text: I've been searching the web and in this great forum but I didn't find anything. I got some issue with a code higlighter plugin. Everything is fine except that some php tags do not work properly :               <!--?php instead of <?php      It just breaks markup ! **I only use HTML Editor**. How can I manage to make it work? EDIT: in the meantime I just changed plugin and it works fine but I'm curious to know how to solve this issue. The plugin is Google Syntax Highlighter (verry old I know)


title: specify size of post preview image (not post thumbnail)

text:
On the main page of my blog, I have a section in the header with post thumbnails(140x170px) linking to specific categories. Below within the actual blog loop, I also have post previews- an image 440x265px, and the first paragraph or so of content. I'm wondering how I can specify the size of the post preview image, without effecting a) the post thumbnails and b) the size of the image that will appear when the full post is viewed. Header thumbnail:
             <?php $new_query = new WP_Query( 'cat=your_category_id&showposts=2' );                 if( $new_query->have_posts() ): while( $new_query->have_posts ): $new_query->the_post();                      the_post_thumbnail();                      endwhile;                 endif;                 wp_reset_query();             ?>
outfit of the day

      Loop:

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

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

      Is this possible? What's the best way to achieve this?


title: Change search permalink slug to e.g. /tutorials/search/searchterm

text: I want to rewrite the ugly               /?s=searchterm      to               /tutorials/search/searchterm      It's a multisite, so I want to make this multilingual. How can I accomplish this?


title: Multiple categories filter

text: I am creating eshop based on woocommerce and I would like to create multi- category filter. Lets say that I have this products structure:               Category 1         Category 11           Category 111           Category 112         Category 12           Category 121     Category 2         Category 21           Category 211           Category 212         Category 22           Category 221      I am showing categories the basic way. So if user click a category it shows in link like www.site.com/category1/. But the problem is that I want to show categories even when I reach the last category. So lets say that user is currently viewing Category 121 and I want to show him filter with category 2. So he can chose product that belongs to category 121 but also to category 211 for example. How should I do this? I have tried this.               set( $category__and, $chosencategory )      but it didnt work for some reason. So whats the best way to create multi- category filter without using any other plugins? Thanks in forward


title: How to set author for post AND post attachments

text: I have multiple author accounts on one of my WordPress installs. Often I will create a post, and set the author to be a different account. However, when I upload images into that post, their attachment page lists the author as my account. How can I set the author for posts, and have it carry over to the media associated with that post?


title: Using arbitrary post status without registering it

text: I want to use an additional, arbitrary post status on one of my custom post types. I'm calling it "limbo", and it's assigned to a post which has been deleted by the user, but one that I still want to keep its data on the database for legacy purposes. I assign it to a post by hijacking the permanent deletion routine, which is to say I'm not really registering it via the proper WordPress function `register_post_status`, because a) it's not something I want my users to worry about or deliberately assign to their posts; and b) it's only applicable to a single custom post type, which I cannot specifically target with `register_post_status`. I don't feel confident that it's the most reliable solution, though. Is there a routine check that WordPress would run on the database which would detect this invalid post status and revert it, or am I being overly paranoid? Either way, is there a better solution which wouldn't rely on full-blown plug- ins like Edit Flow?


title: Ordering posts by date custom field

text:
Trying to order posts by custom field. Dates are entered into the custom field "event_time" as in this format: "June 6 2012 6:00 PM". Trying to order them by that date. All of the code below functions properly, but the posts are in order of post date, not "event_time". Where is my issue? **Contents of archive-event.php:**               <?php get_header(); ?>          <?php     $args = array(         "post_type" => "event",         "meta_key" => strtotime('event_time'),         "orderby" => "meta_value_num",         "order" => "ASC"         );     $event = new WP_Query( $args );     ?>

              <?php if ($event->have_posts()): ?>
                  <?php while ($event->have_posts()) : $event->the_post(); ?>                      <?php $get_event = get_post_meta( $post->ID, 'event', true ); ?>                      <a href="<?php echo $get_event[ 'event_url' ]; ?>" rel="bookmark">                          <?php the_title(); ?>
                     <?php echo $get_event[ 'event_venue' ]; ?>
                     <?php echo $get_event[ 'event_address' ]; ?>
                     <?php echo date( 'l, F j, Y \a\t g:i A', strtotime($get_event[ 'event_time' ])); ?>
                                        <?php endwhile; ?>
          <?php else: ?>
Sorry, no posts matched your criterias.
          <?php endif; ?>          <?php if(function_exists('wp_paginate')) { wp_paginate(); } ?>

         <?php get_sidebar(); ?>

          <?php get_footer(); ?>      **Relevant Contents of Functions.php**               $key = "event";     $meta_boxes = array(         "event_url" => array(             "name" => "event_url",             "title" => "Meetup Event Url",             "description" => "Enter the URL of the Meetup event, e.g. http://www.meetup.com/meetup-group/events/58276792/"),         "event_venue" => array(             "name" => "event_venue",             "title" => "Event Venue",             "description" => "Enter the event venue of the meetup, e.g. Granite City Brewery"),         "event_address" => array(             "name" => "event_address",             "title" => "Event Address",             "description" => "Enter the address of the venue, e.g. 25 Clair St., Denver , CO"),         "event_time" => array(             "name" => "event_time",             "title" => "Event Date & Time",             "description" => "Enter the date and time of the event in the following format, e.g. June 6 2012 6:00 PM")     );          function create_meta_box() {         global $key;              if( function_exists( 'add_meta_box' ) ) {             add_meta_box( 'new-meta-boxes', ucfirst( $key ) . ' Details', 'display_meta_box', 'event', 'normal', 'high' );             }         }          function display_meta_box() {         global $post, $meta_boxes, $key;         ?>
              <?php              wp_nonce_field( plugin_basename( __FILE__ ), $key . '_wpnonce', false, true );              foreach($meta_boxes as $meta_box) {             $data = get_post_meta($post->ID, $key, true);             ?>
                      <label for="<?php echo $meta_box[ 'name' ]; ?>"><?php echo $meta_box[ 'title' ]; ?>                          <input type="text" name="<?php echo $meta_box[ 'name' ]; ?>" value="<?php echo htmlspecialchars( $data[ $meta_box[ 'name' ] ] ); ?>" />
<?php echo $meta_box[ 'description' ]; ?>

              <?php } ?>
          <?php     }          function save_meta_box( $post_id ) {         global $post, $meta_boxes, $key;              foreach( $meta_boxes as $meta_box ) {             $data[ $meta_box[ 'name' ] ] = $_POST[ $meta_box[ 'name' ] ];         }              if ( !wp_verify_nonce( $_POST[ $key . '_wpnonce' ], plugin_basename(__FILE__) ) )             return $post_id;              if ( !current_user_can( 'edit_post', $post_id ))             return $post_id;              update_post_meta( $post_id, $key, $data );     }          add_action( 'admin_menu', 'create_meta_box' );     add_action( 'save_post', 'save_meta_box' );     ?>


title: Free WordPress plugins for membership?

text: I'm looking to create a membership-based website and I'm new to WordPress so its been a headache trying to look for free plugins that can creates 3 levels of membership (non-members, members, and premium members) limit access to certain pages/functionality of the site to members/premium members Also can't find a good plugin for customizable registration form


title: How WordPress encrypt password?

text: > **Possible Duplicate:**   >  How to validate WordPress generated password in DB using PHP? I am working with site that is done with WordPress, and I need to add some parts that are outside WP, and to check user login, but I can't find how WP is encrypting password before it writes it in DB... I tried with md5 but it's not... Does anyone know how to check password outside WP, without using it's pluggins/checkers, clear PHP code?


title: External app Login using Wordpress login credentials

text: I am building a php application for which user needs to login first and those login credentials will be same as wordpress login credentials I am trying to connect the application with wordpress database table 'users' where we have 'user_login' and 'user_pass' and the problem for me is column 'user_pass' is encrypted with a prefix '$S$B' and I came to know that wordpress uses one side md5 encryption method which can not be decrypted . . . now I want to validate password for my external application I tried using this               $password = clean($_POST['password']);     $pass = "$P$B" .md5($password);      but this didn't work can anyone please help me


title: How to write to the plugin's directory?

text: My plugin needs to create some directories for its use when it's executed. On many hosts (those using suPHP for example) there is no problem and everything works fine. But on other hosts, PHP does not have permission to write into the plugin's directory, and so all my directory creation attempts fail and the plugin won't work properly. How can I deal with this? I thought I could temporarily CHMOD the plugin directory, create the things I need, then put it back... but I don't have permission to CHMOD anything either. Do I need to use chown? Or something else...? Suggestions? **EDIT: I've decided that the most expedient solution is to very carefully document the potential error conditions and provide extremely specific instructions to my users on what to do, should they have permissions issues. It's not the ideal situation I hoped for but hey... waddya gonna do?**


title: WP 3.4 has missing photo data

text: I just updated to WP3.4 and discovered that previously available images are no longer "found" by the system. By this I mean that all the image files remain online and accessible, but WP has lost thumbnail data and subsequently shows the standard media icon on the media library list. Front-facing pages that should have images are now displaying the generic "image missing" icon because there is no URL (I checked the source). My guess is that somehow the connection between database and image listings have broken, and I"m trying to reverse engineer them to find differences. Hopefully there are others with a similar problem and have worked through it?


title: How do I get the image that is submitted with a post, when I'm in the loop?

text:
I'm using Gravity Forms to create a form. The form entry is created as a post. I have a loop that successfully gets the content of the post. However, I'd also like to get the image that is submitted with the post. I have this snippet:               <?php wp_get_attachment_link($POST->ID) ; ?>      However, this makes returns nothing. This makes me think that either the code is incorrect, or that GF is storing the image in a way that differs from how normal post images are stored. This is my full loop:               <?php global $query_string ; ?>       <?php  $my_query = new WP_Query('&cat=4&posts_per_page=10') ?>       <?php  while ( $my_query->have_posts())  : $my_query->the_post() ; ?>

        <img src="<?php wp_get_attachment_link() ; ?> " class="" alt="#" />           <a href="<?php the_permalink() ?>"  title="Link to <?php the_title_attribute(); ?>"><?php the_title(); ?>           <?php the_content() ;?>

      How can I get the image?


title: Odd Script File Trying to be Loaded

text: This is an odd query I have and wondered if anybody can shed some light on it? We have a number WordPress multi-site (formally Mu) install, but on nearly all the sites on multiple installs we are getting this script tag...               <script src='http://[parent-domain]/?dm=[random-string]&action=load&blogid=1&siteid=1&t=401255033&back=[this-sites-domain' type='text/javascript'></script>      I was wondering if anybody knows what this is all about? Thanks.


title: Sort get_users by custom field

text: I have a custom USER taxonomy called 'label' which also has a custom field of 'sort_order' - I am trying to return a list of users that have the label taxonomy and then sort this list by the sort_order field. So far I have.....               <?php     $users = get_users(     array(         'meta_key' => 'sort_order',         'fields' => 'all_with_meta'     )     );          function wpse98580_sort_order( $a, $b )     {           if ( $a->sort_order === $b->sort_order ) {           return 0;       } elseif ( $a->sort_order > $b->sort_order ) {         return -1;     }     return 1;       }       usort( $users, 'wpse98580_sort_order' );          /* Iterate over the sorted array */          foreach( $users as $user )     {     echo '<h4>' . $user_info-> user_firstname . ' ' . $user_info-> user_lastname . '</h4>';     }     ?>      This doesn't work, I am assuming it is becasue the 'sort_order' meta-key is actually a custom field of the taxonomy so it can't retrieve it. Usually I use the following code to access the sort_order...               $product_terms = wp_get_object_terms($user->ID, 'label');                         if(!empty($product_terms)){                         if(!is_wp_error( $product_terms )){                             foreach($product_terms as $term){                                  $t_ID = $term->term_id;                             $label_custom_fields = get_option("taxonomy_term_$t_ID");                             echo $label_custom_fields['sort_order'];                                  }                             }                         }      Can anyone help?


title: Add an A-Z menu at the top of A-Z listing code

text:
I have the following code that is creating a and A-Z listing of my Posts in a Custom post type. I'd like to somehow create a A-Z menu at the top which links down to its respective anchor. I just can't seem to get this part to work. Any help much appreciated?                   <?php        $args = array(         'post_type' => bha_issues,          //'post_status' => 'bha_issues',          'orderby' => 'title',          'order' => 'ASC',          'caller_get_posts' => 1,          'posts_per_page' => 40,                      );     query_posts($args);                              if (have_posts()) {         $curr_letter = '';         while (have_posts()) {             the_post();             $this_letter = strtoupper(substr($post->post_title,0,1));                  if ($this_letter != $curr_letter) {               echo "

$this_letter

";               $curr_letter = $this_letter;             }                   ?>
<a href='<?php the_permalink() ?>'><?php the_title(); ?>
         <?php          }     }     ?>


title: Attachments without images

text: I am using the Attachments plugin, but this question I'm sure is applicable to the regular media library. What I want to do is have an 'attachment' (metadata, title, caption) but with no image associated with it. Reason being, I want to treat attachments as 'project items' which can either be an image or a block of text. Is this possible?


title: Forcing the title of a text widget on to a new line in the admin area

text:
I have created some custom widgets based on the standard WP text widget by extending the WP_Widget class. I would very much like to force the title of the widget on to a new line in the sidebar summary area of the admin section. I was thinking of using a line break html tag so that the title doesn't become truncated or cut off. I notice WordPress adds a span element to the widgets.php file. This file is located in the wp-admin/includes/widgets.php. By adding a line break tag here on line 188

<?php $widget_title ?>

      I was able to force the actual title on to a second line. However the result is unsatisfactory as the css clearly isnt accommodating the height of the content. The problem is that I am unsure where to put such html markup for the change to take effect within my actual widget code below? I could change the wordpress files themselves but updates would erase the changes I have made. Any help would be appreciated. The code is attached.                 <?php       /**        * Counselling Widget        *        * @since 2.8.0        */       /**        * Add function to widgets_init that'll load our widget.        * @since 0.1        */       add_action( 'widgets_init', 'counselling_widget' );            /**        * Register our widget.        * 'Example_Widget' is the widget class used below.        *        * @since 0.1        */       function counselling_widget() {            register_widget( 'counselling_widget' );       }       /**        * Widget setup.        */       class counselling_widget extends WP_Widget {                 function __construct() {                 /* Widget settings. */                 $widget_ops = array('classname' => 'counselling_widget', 'description' => __('Add or amend text or HTML for the Counselling section'));                 /* Widget control settings. */                 $control_ops = array('width' => 400, 'height' => 350);                 /* Create the widget. */                 parent::__construct('counselling_widget', __('Counselling'), $widget_ops, $control_ops);            }            /**             * How to display the widget on the screen.             */            function widget( $args, $instance ) {                 extract($args);                 /* Our variables from the widget settings. */                           $title = apply_filters( 'widget_title', empty( $instance['title'] ) ? '' : $instance['title'], $instance, $this->id_base );                 $text = apply_filters( 'widget_text', empty( $instance['text'] ) ? '' : $instance['text'], $instance );                 /* Before widget (defined by themes). */                 echo $before_widget;                 if ( !empty( $title ) ) { echo $before_title . $title . $after_title; } ?>
<?php echo !empty( $instance['filter'] ) ? wpautop( $text ) : $text; ?>
                 <?php                 echo $after_widget;            }            /**             * Update the widget settings.             */            function update( $new_instance, $old_instance ) {                 $instance = $old_instance;                 /* Strip tags for title and name to remove HTML (important for text inputs). */                 $instance['title'] = strip_tags($new_instance['title']);                 if ( current_user_can('unfiltered_html') )                      $instance['text'] =  $new_instance['text'];                 else                      $instance['text'] = stripslashes( wp_filter_post_kses( addslashes($new_instance['text']) ) ); // wp_filter_post_kses() expects slashed                 $instance['filter'] = isset($new_instance['filter']);                 return $instance;            }            /**             * Displays the widget settings controls on the widget panel.             * Make use of the get_field_id() and get_field_name() function             * when creating your form elements. This handles the confusing stuff.             */            function form( $instance ) {                      $defaults = array(                   'title' => __('Counselling', 'counselling_widget_text'),                   'text' => '

Often referred to as person centred, this approach based on the belief that being able to talk to a caring professional about your feelings can provide you with the clarity, self awareness and solutions to promote the potential for change. The therapeutic \'space\' is utilised to listen to the client\'s problems, reflect back to the client what they are saying and offer clarification to achieve awareness and confidence at managing one\'s difficult circumstancesread more

',                 );                      $instance = wp_parse_args((array) $instance, $defaults);                 $title = strip_tags($instance['title']);                 $text = esc_textarea($instance['text']);       ?>
<label for="<?php echo $this->get_field_id('title'); ?>"><?php _e('Title:'); ?>                 <input class="widefat" id="<?php echo $this->get_field_id('title'); ?>" name="<?php echo $this->get_field_name('title'); ?>" type="text" value="<?php echo esc_attr($title); ?>" />
                      <textarea class="widefat" rows="16" cols="20" id="<?php echo $this->get_field_id('text'); ?>" name="<?php echo $this->get_field_name('text'); ?>"><?php echo $text; ?> </textarea>
<input id="<?php echo $this->get_field_id('filter'); ?>" name="<?php echo $this->get_field_name('filter'); ?>" type="checkbox" <?php checked(isset($instance['filter']) ? $instance['filter'] : 0); ?> /> <label for="<?php echo $this->get_field_id('filter'); ?>"><?php _e('Automatically add paragraphs'); ?>
       <?php            }       }            ?>


title: On main page link image to post page, on post page link it to it's own image?

text: I'm using a lightbox plugin that blows the image up to it's own window when an image is clicked. I want this behavior to ONLY happen when the image is clicked on from it's POST page. When the same image is clicked from the MAIN (home) page I want the user to be navigated to the POST page. **So the flow would be:** **1.** User clicks the image on main page (or any other page than it's own post page for that matter) ...   **2.** That takes them to the post page the image is on ...   **3.** The user clicks the image on it's _own_ post page ...   **4.** The image pops up in it's lightbox frame. I'm completely new to WordPress, can anyone help me with this? thanks!


title: How to use shortcode of any plugin to show it visually where i want?

text: I don't know much about shortcode. I have a countdown plugin with this plugin i'm displaying 'countdown timer', i can post it with shortcode E.g `[countdown event="Event with hour & minutes" date="12 June" hour="18" minutes="54"]`. I tried to fetch it with `get_post_field('post_content', $post->ID)` but with this way I can not displaying the 'countdown timer' as visually, just fetch the lettering. Is it possible to show countdown plugin with shortcode where i want. Hope you can help. I really need it.


title: rename 'page' URL fragment in pretty permalinks

text: i would like my WP URLs to be fully in my language so instead of: `site.com/page/2/` i would like to have: `site.com/pagina/2/` (in spanish) how can i accomplish this? i tried to do simple `str_replace` on default rules but when accessing `site.com/pagina/2/` WP redirects me to `site.com/pagina/2/page/2/` any ideas what could be wrong ?