Widget Area: Modify $param['xy'] from widget-$n

I have different widget areas. One is a horizontal area that may contain eg. 4 widgets next to each other. My Question is how would i add a different eg. `$param['widget_title']` to widget number `$n` (via a filter)? I already tried using `wp_registered_widgets();` function and te different globals, but with no result.


Creating a press page for our project

Over time our project got some good press: press releases, interviews, media appearances Now I want to create a "press page" (something like this). Requirements:   * is easy to update - everyone can write html at some degree, the procedure for adding a new article on the press page should be straightforward   * aggregates content from the original articles - a picture, title, maybe an abstract(excerpts )   * bind in my current theme (cannot be changed atm) How can I achieve this? Is there any plugin I can use?


How to add filter with 2 args?

I want to modify $path in the following filter. It has 1 input and 2 args.               function documents_template( $template = '' ) {                 $path = DOCUMENTS_INCLUDES_DIR . '/document/' . $template;            return apply_filters( 'document_template', $path, $template );     }      This is my function to add filter, it gets error message, how to get it right?               function my_template( $template = '' ){                $path = MY_INCLUDES_DIR . '/document/'. $template;               return $path;     }     add_filter( 'document_template','my_template', 10, 2 );      I tried to change my return value as following, it doesn't work either:               return apply_filters( 'my_template', $path, $template);      With the belowing answers, my new filter still not working, so, maybe it's because my filter is in a class? here's the completely new code:               Class My_Class{       function __construct() {          add_filter( 'document_template', array( $this, 'my_template',10, 2 ) );       }      function my_template( $path, $template ){                $path = MY_INCLUDES_DIR . '/document/'. $template;               return $path;      }     }


Jquery plugin not working on single pages

I use a news ticker jQuery plugin to show the last posts. The codes are in the `header.php` file and work fine on the home page, but not on single pages. The links are loaded but they don't move. Here is the home page and here the single page.


W3 Total Cache benefits without using plugin?

W3 Total Cache isn't compatible with WPTouch. Is there a way to get the benefits of W3 Total Cache without using the plugin?


Broken pagination

Well I'm here again with almost the same problem as I had in this post three weeks ago, but let me explain what has happened since then: I was originally using one loop to display the most recent sticky post at the top of the front page, then a second loop to display every other post (except for all other stickies). Here's my code as it stands now:               // first loop to display only my single, MOST RECENT sticky post     $sticky = get_option('sticky_posts');     $wp_query = new WP_Query(array('post__in' => $sticky, 'caller_get_posts' => 1, 'orderby' => ID, 'showposts' => 1)); ?>     <?php while (have_posts()) : the_post(); ?>         <!-- loop code -->     <?php endwhile; wp_reset_query(); ?>          // second loop to display every other post, excluding sticky posts     <?php query_posts(array('post__not_in' => get_option('sticky_posts'))); // exclude all sticky posts ?>     <?php if (have_posts()) : while (have_posts()) : the_post(); ?>         <!-- loop code -->     <?php endif; wp_reset_query(); ?>      What is happening here is perfect...for the front page only. I get my nice single/most-recent sticky post at the very top, followed by another 5 posts. Unfortunately, if I page over to the 2nd, 3rd, 4th, etc pages - all I see are the same 5 posts that were under the sticky post on the front page! I'm quite new with the concept of multiple loops, so I could really use a hand here! Thank you in advance :)


Daily notices of failed login attempts for non-existent admin user

I run a multi-user site and for the past week or two I have been getting daily notices that someone is getting locked out due to failed login attempts for user "admin" via the Limit Login Attempts plugin. There is no user account for "admin" and I assume this is an attack in an attempt to gain access to the wp-admin section of the site. I'm assuming if there is no "admin" user, then these attempts will never be successful. Am I safe to disregard these notices since there is no user named "admin" or are there other measures I can take to safeguard my site from being accessed maliciously? The attempts have been from a few different IP addresses so blocking the IP would only temporarily deter the behavior. Limiting the wp-admin to only specific IP addresses is not realistic due to the number of users that log in from different places.


bloginfo('template_directory') img src

I am lazy loading some images with URLs which are added via custom fields. The lazy load plugin I'm using requires a place-holder image in the `src` attribute and the actual image in data-original. http://www.appelsiini.net/projects/lazyload I need the image height and width as well, so I've been using `wp_get_attachment_image_src()`. My problem is using `bloginfo('template_directory')` to get the place-holding image. The first image here doesn't show the place-holder images but does output the url to the page.                   <?php                     $attch_id_1 = pn_get_attachment_id_from_url(get_post_meta($post->ID, 'img1', true));             $image_attributes_1 = wp_get_attachment_image_src( $attch_id_1, 'full');                   $attch_id_2 = pn_get_attachment_id_from_url(get_post_meta($post->ID, 'img2', true));             $image_attributes_2 = wp_get_attachment_image_src( $attch_id_2, 'full');                  $attch_id_3 = pn_get_attachment_id_from_url(get_post_meta($post->ID, 'img3', true));             $image_attributes_3 = wp_get_attachment_image_src( $attch_id_3, 'full');                  echo '';                  echo '';                  echo '';              ?>      The source for the page looks like this. `http://localhost/wordpress-cd/wp-content/themes/cd<img src="/images/img- BG.png"` Why can't I use `bloginfo('template_directory')` here? How can I output the images correctly?


When using TinyMCE which function should i use to sanitize the data?

I am developing a theme with several `custom post types` and each custom post type has its own settings page added with `[add_submenu_page(...)][1]`. One of these submenu pages includes a tinyMCE rich text editor, added with the following code:               <?php                      $content   = esc_html( get_option( 'standard_artist_contract_text' ) );                     $editor_id = 'artistcontract';                     $settings  = array(                         'textarea_name' => 'standard_artist_contract_text',                         'textarea_rows' => $textarea_rows,                         'media_buttons' => $media_buttons                         );                     wp_editor( $content, $editor_id, $settings );                     ?>      Each of the settings is registered with `[register_setting(...)][2]` now my question is which of wordpresses built in sanitation functions is best to handle this data, which one should i use as the third parameter in register_setting for data coming from wp_editor? Previously, with a textarea i had been using `esc_textarea` and `sanitize_text_field` with text inputs (to the contrary of what seems to be suggested in this post, where they use esc_attr only` !?)


Regarding Posts

I have several questions   1. How to limit characters in the post?   2. How to ensure every posting require images upload? That's all, appreciate if anyone can help..


Save WYSIWYG editor plugin settings, only works after second save

I have set up a WYSIWYG editor on one of my plugin settings pages. The content saves, but only after you hit save twice. If you hit it once, you get he message for settings saved, but the content doesn't actually save. You refresh the page and it reverts back to its previous state. I'm initializing the editor using wp_editor, like so:               $single_optin_message_parameters = array(             'teeny' => true,             'textarea_rows' => 15,             'tabindex' => 1,             'textarea_name' => 'single-optin-message'         );          <?php wp_editor( $this->optionVal['single-optin-message'] , 'single_optin_message', $single_optin_message_parameters); ?>      and I'm saving the content via AJAX.               $('#form').submit(function (e) {                     // Make sure the api key exists        if (blankFieldCheck()) {                   $.ajax({                     type: 'POST',                     url: ajaxurl,                     data: {                         action: 'yks_form',                         form_action: 'update_options',                         form_data: $('#yks-form').serialize()                     },                     dataType: 'json',                     success: function (RESPONSE) {                         if (RESPONSE == '1') {                               $('#yks-status').html('

<?php _e('The options were saved successfully!', 'yikesplugin'); ?>

');                             $('#yks-status').slideDown('fast');                         } else {                             $('#yks-status').html('

<?php _e('The options could not be saved (or you did not change them).', 'yikes-inc-easy-mailchimp-extender'); ?>

');                             $('#yks-status').slideDown('fast');                             console.log(RESPONSE);                         }                     },                     error : function(RESPONSE2) {                         console.log(RESPONSE2.responseText);                     }                 });        }         e.preventDefault();     });      This works when the field is a standard `<textarea></textarea>` but the second I convert it to a WYSIWYG, I need to hit save twice for the data to actually save. I'm not seeing why. I've tested the data that is serialized when saving the form, and I can see my new data has been passed along, and I get the confirmation that it saved. Then I refresh the page and it reverts. No sense made.


Advanced Custom Fields Plugin - Unable to get URL from post_object

I'm not sure what I'm doing wrong here. I have a field called "grid_thumbnail" and a "related_projects" post_object. I am able to display the title of the related post. I just don't know how to get the Image URL of that related post. Suggestions?               <?php foreach(get_field('related_projects') as $post_object): ?>
     <img src="<?php echo get_field('grid_thumbnail'); ?>">
     <a href="<?php echo get_permalink($post_object->ID); ?>"><?php echo get_the_title($post_object->ID) ?>
      # Edit print_r returns:               stdClass Object ( [ID] => 100      [post_author] => 1      [post_date] => 2012-01-12 05:11:25      [post_date_gmt] => 2012-01-12 05:11:25      [post_content] => Nulla facilisi. Pellentesque non tincidunt est. Nulla porta bibendum auctor. Proin feugiat eros bibendum lacus viverra fringilla ac id felis. Praesent a commodo leo. Phasellus et odio eget justo venenatis interdum at ut nulla. Praesent lacinia nulla eu libero tempus pulvinar. Sed elementum, nulla vitae imperdiet ornare, elit lorem vestibulum erat, ac aliquet purus lacus pharetra risus. Mauris facilisis volutpat odio a ultrices. Etiam nisl urna, mattis sed ultricies sit amet, euismod sit amet eros. Nam tempus erat ut ligula elementum cursus faucibus elit accumsan. Fusce rhoncus, nunc nec vestibulum facilisis, nibh leo vestibulum metus, vitae malesuada leo dui eu erat. Proin scelerisque, mi viverra dignissim porta, lectus justo pellentesque metus, at consequat ligula nulla eu ante. Fusce fringilla pretium venenatis. Quisque quis arcu porta dolor condimentum viverra at id augue. Donec pharetra venenatis felis.      [post_title] => Rada      [post_excerpt] =>      [post_status] => publish      [comment_status] => open      [ping_status] => open      [post_password] =>      [post_name] => rada-2      [to_ping] =>      [pinged] =>      [post_modified] => 2012-01-16 23:01:37      [post_modified_gmt] => 2012-01-16 23:01:37      [post_content_filtered] =>      [post_parent] => 0      [guid] => http://estevancarlos.kodingen.com/ecv7/?post_type=projects&p=100      [menu_order] => 0      [post_type] => projects      [post_mime_type] =>      [comment_count] => 0      [ancestors] => Array ( ) [filter] => raw )


Meta Box Only in CPT Edit Page, Not in Add New

I have a CTP named `leads` and have 2 metaboxes added to the CPT new/edit screen. I need to have one of them only in edit screen, not in add new. Played with the codes provided in couple of answers, but they weren't of much help. (97845 and 89395) Can anyone help? I don't necessarily want anyone to do it for me, but a few playable starts would be great. Thanks


Set role for manage users only under a role

I have to implement membership functionality where a user (company owner) can manage multiple users(employees) under him. I have created two roles in members plugin -               Company user - Can add /edit/delete/manage users     Employee - read permission      In my custom registration process I have linked employee type users to company type users. But problem here is after company user's login it shows all users in wp admin users list and he is able to edit users not under him. Is there any custom role or functionality using that I can show only users under that company user ? I have database structure, already setup with my custom tables -               wp_users - main wordpress users table     wp_company- custom table to add companies      wp_company_users - to link users, for company usertype I have a column for making him admin, using this column I can find employees under this user.      Any help please. How it is possible.


Not sure why wp_ajax isn't working?

I'm trying to get into grips in using AJAX in wordpress, the following code creates a form with an input box using the wordpress feature shortcode [ajaxf].               <?php     add_action( "wp_ajax_ajaxcf", "my_action_callback" );     add_action( "wp_ajax_nopriv_ajaxcf", "my_action_callback" );          function my_action_callback() {         $whatever = intval( $_POST['fname'] );         echo $whatever;         die();      }     function ajax_contact_form() {     ?>               <form id="ajaxForms">            First Name:         <input id="fname" name="fname" value="First Name" type="text" />

         <input name="action" type="hidden" value="ajaxcf" />         <input id="submit_button" class="submit" value="Send" type="button" />
     </form>     <?php         }     add_shortcode("ajaxcf", "ajax_contact_form");      I simply want to alert the response with jQuery but it doesn't seem to work and i have no idea why. Help appreciated. Thanks


Automatic creation of mutisite blog outside of the admin

i working on a system that in which i want user to be able to create their own page on login using the multisite feature in wordpress how do i get these done outside the admin. It seems like all the files in wordpress are all interwoven. i dont understand how all those function and class can be included into my project


How to create multiple loop in archive page?

This is my archive page codes i want to avoid duplicate posts in 4th loop & i want to count post in 3rd loop there are 4 loops 1 first loop count : 1 post                 <?php        $count = 1;       if (have_posts()) : while (have_posts()) : the_post();                   if($count == 1) : ?>           <a href="<?php the_permalink() ?>" rel="bookmark" title="" ><?php the_title(); ?>       2 second loop - - count = 1 post               <?php if (have_posts()) : ?>     <?php $count = 1; ?>     <?php while (have_posts()) : the_post(); ?>     <?php $count++; ?>     <?php if ($count == 2) : ?>      <a href="<?php the_permalink(); ?>" title=""><?php the_title(); ?>         3 third loop-- count = 5 post               <?php else : ?>      <a href="<?php the_permalink(); ?>" title=""><?php the_title(); ?>      <?php endif; ?>     <?php endwhile; ?>          <?php else : ?>
Most Viewed News
     <?php endif; ?>      4 loop -- count = rest of all post               <?php else : ?>      <a href="<?php the_permalink(); ?>" title=""><?php the_title(); ?>       -- ad count --               <?php if ( $count == 3 || $count == 5 ) : ?>     <?php dt_show_ads();?>      <?php endif; ?>          <?php endif; ?>      <?php $count++; ?>      <?php endwhile; ?>                <?php else : ?>

<?php _e('Sorry','linepress');?>

     <?php endif; ?>


Wordpress: embedding last posted video

I need to embed the last posted video (from a specific category) to the frontpage of my Wordpress site. Is there any shortcode (or widget, even) I can use to simply filter my posts by category, and have the content (in this case, an embedded .wmv or .m4v) displayed based on a "last posted" basis. I am currently able to get a simple static embed working, but I need the embed to be dynamic based on the last video posted. The video cannot be hosted on sites like youtube or vimeo; I need to have them hosted as video files on a server and embed them that way. Thanks in advance.


I want to add post meta for picture thum during submit for revision

I am using this function to get imnages urls from google                  function getGoogleImg($k)     {         $url = "http://images.google.com/images?as_q=##query##&hl=it&imgtbs=z&btnG=Cerca+con+Google&as_epq=&as_oq=&as_eq=&imgtype=&imgsz=m&imgw=&imgh=&imgar=&as_filetype=&imgc=&as_sitesearch=&as_rights=&safe=images&as_st=y";         $web_page = file_get_contents( str_replace("##query##",urlencode($k), $url ));         $tieni = stristr($web_page,"dyn.setResults(");         $tieni = str_replace( "dyn.setResults(","", str_replace(stristr($tieni,");"),"",$tieni) );         $tieni = str_replace("[]","",$tieni);         $m = preg_split("/[\[\]]/",$tieni);         $x = array();         for($i=0;$i<count($m);$i++)         {             $m[$i] = str_replace("/imgres?imgurl\\x3d","",$m[$i]);             $m[$i] = str_replace(stristr($m[$i],"\\x26imgrefurl"),"",$m[$i]);             $m[$i] = preg_replace("/^\"/i","",$m[$i]);             $m[$i] = preg_replace("/^,/i","",$m[$i]);             if ($m[$i]!="")             array_push($x,$m[$i]);        }        return $x;     }      After that i want add image url to post meta i am using this function to add post meta                 function add_image_to_save_post($post_ID)         {                 if ( !wp_is_post_revision($post_id) )             {             $title = $_POST['post_title'];             $image = getGoogleImg ($title);             add_post_meta($post_ID, 'thumb', $image[3], true);                  }         }         add_action('wp_insert_post', 'add_image_to_save_post');      But when i click on on link add new post its add autmatically blank thumb key in database I just want this for users so just add articles they no need to add image to article image will fetch automatically, Can anyone give me suggestion how this possible Thanks MOhammad Umer


WordPress Comment functions

As we know we can usually make changes to "the content" by calling the_content(). is there any equivalent function available for comments? or any such way do you know?


How to make search include data from wp_postmeta?

I have a site using Advanced Custom Fields to create and store various bits of relevant info. These need to be included in the main general search, which by default only searches the title and main content. I've found plenty of info about getting search results based on specific bits of postmeta, but I have an issue with that. There are a potentially unlimited amount of potential fields in postmeta to search. The solution could either search anything in postmeta or anything with a meta_key that matches this regex: `content_section_[0-9]{1,4}_content_.{2,8}` Example meta_keys to match are:               content_section_0_content_title     content_section_0_content_title     content_section_4_content_subtitle     content_section_8_content_text      Any way that I can alter the fields searched to include the postmeta would be very much appreciated.


Shortcodes not working

I have `WordPress 3.2.1` and I have created a personal shortcode, everything works fine until I change the `Permalink Settings` from `Default` to `Custom Structure`. The shortcodes stop to work permanently, instead I turn back to `Default` setting. > Hello, I'm [birthday year="1975-03-25"] years old. I've added `add_shortcode` function in my theme's `functions.php`.   If I add the new `shortcode` to the original WordPress theme `Twenty Eleven` in the `functions.php` file, it works fine! my functions.php file:               function short_birthday ($date) {         list($Y,$m,$d) = explode("-", $date['year']);         return( date("md") < $m.$d ? date("Y")-$Y-1 : date("Y")-$Y );     }     add_shortcode('birthday', 'short_birthday');      this is the only thing I've added to `functions.php`. How my theme can block the shortcodes? It's the only thing I've did.   Can I do something to fix it?


Multiple textdomains

I have a bunch of plugins. Obviously, they all have their own unique textdomains for internationalization (i18n). I also have a bunch of files that I include in all my plugins - I throw them all in a directory called common. This adds a dashboard widget that I want all my plugins to have, as well as a script for updating (since they don't live on the wordpress.org plugin repo). I want to be able to just drop my common folder into each of my plugins without having to edit the files. But I'm concerned about the text strings contained inside. Can I call load_plugin_textdomain twice, for two different domains, within the same plugin? What's the best way of handling this situation with i18n in mind? Or will I have to go through each instance of my common files and manually change the textdomain to match the plugin?


Meta_query and numeric comparison

I have a WP_Query with meta_query filter on meta_value.               if( ($capacity != '') && ($capacity > 0) ) $filters[] = array('key' => 'mb_capacity','compare' => '>','value' => $capacity, 'type' => 'NUMERIC');     and then later i set the  'meta_query' => $filters of the query      The custom field mb_capacity represents an number but WP store it as a String. I was thinking the "type=>'numeric'" option will handle that, but unfortunatly it doesn't work, the comparison still be done on String instead of Integer. Is there any solution to that problem ? Note that i'm using WP 3.2.1. Many thanks for any suggestions


Modifying the main editor priority

I want the main WordPress post editor to appear below some of my meta boxes (generated by Advanced Custom Fields). I know there are the `add_meta_box()` and `remove_meta_box()` functions, however it'd be really awesome if I could just modify the editor meta box priority without having to remove and add it again. Any ideas?


Get menu item slug

I use custom menus and I’d like to get the menu item slugs. Is that possible?               // Get the nav menu based on $menu_name (same as 'theme_location' or 'menu' arg to wp_nav_menu)     // This code based on wp_nav_menu's code to get Menu ID from menu slug          $menu_name = 'main-menu';          if ( ( $locations = get_nav_menu_locations() ) && isset( $locations[ $menu_name ] ) ) {              $menu = wp_get_nav_menu_object( $locations[ $menu_name ] );         $menu_items = wp_get_nav_menu_items($menu->term_id);         $menu_list = '
';                  foreach ( (array) $menu_items as $key => $menu_item ) {                 $title = $menu_item->title;                 $url = $menu_item->url;                 $menu_list .= '
' . $title . '
';             }              $menu_list .= '
';          }          echo $menu_list;      http://codex.wordpress.org/Function_Reference/wp_get_nav_menu_items


Filter my args by the post 1st letter

I filter my `WP_Query` by this script:               $args = array (             'posts_per_page' => $posts_per_page,             'post_type' => $post_type,             'meta_key' => 'post_views_count',             'orderby' => 'meta_value_num',             'showposts' => 160,             'order' => 'DESC',             'paged' => $paged,                 'tax_query' => array(                    array(                        'taxonomy' => $term->taxonomy,                        'field' => 'slug',                        'terms' => $term->name)));      And I would like to add the filter `SUBSTRING(post_title, 1,1) ='z'`.   Is that possible to implement it?   what's the best practice to loop only post which start with letter X?


Users are being redirected to main site when trying to register on subsite of my Multisite network

I want to allow my clients on my network to have visitors register on their site. Currently, there is no link or button to allow visitors to access the signup page. This looks like default functionality for some bizarre reason. Anyone trying to reach "subdomain.mydomain.com/wp-signup" is redirected to "mydomain.com." Instead, visitors should be able to register on the subdomain, and remain there, without ever seeing my domain. So far in my research, others have recommended Multisite User Management, however this did not do what I needed. I don't want any manual involvement in the user registration process of my clients. Any help would be greatly appreciated. Thanks. WP: 3.4.2


Show ID's in main section of my own page

I've included wordpress in my own website and I use the main section of the blogs aswell as the sidebar. In the sidebar there are shortcuts that lead to Id's Cat=01 p=01 etc. Everytime I click them it opens a new wordpress site instead of opening in the main section off my own side. What code do I use to make sure that the link will link me to my main section? (I use header, sidebar left, main section, sidebar right, footer). ps. I've been searching for about a week now to find the code and I know it is out there but I probely don't know how to ask the question right. If someone can help me I'd be very thankfull! My website is http://www.volunteeringnews.com


Breadcrumbs stop working on a specific template file

I'm working on a theme and i use dimox's breadcrumbs to display breadcrumbs in the footer, so far so good, works almost flawlessly BUT there's one template file where i use 2 loops and i'm guessing this is what screws with the breadcrumbs... but i couldn't put my finger on it exactly... here's the code:
                    <?php if (have_posts()) : while (have_posts()) : the_post(); ?>          <?php $parent_title = $post->post_title; ?>     <?php $parent_content = $post->post_content; ?>     <?php $parent = $post->ID; ?>          <?php endwhile; else : ?>     <?php endif; ?>
         <img id="previewImg" src="<?php bloginfo("template_url"); ?>/images/spacer.png" alt="" />

<?php echo $parent_title; ?>

         <?php query_posts('posts_per_page=15&post_type=page&post_parent='.$parent); while (have_posts()) : the_post(); ?>            <?php $image_thumb = get_post_meta($post->ID, 'image-thumb', true); ?>
<a href="<?php the_permalink(); ?>" rel="<?php $src = wp_get_attachment_image_src( get_post_thumbnail_id($post->ID), medium, false, '' ); echo $src[0]; ?>"><?php the_title(); ?>
         <?php endwhile; ?>

           <?php print($parent_content);?>

          <?php get_footer(); ?>      Take a look at previewUL ...


WordPress built-in method to extract array of term IDs?

I'm querying a custom taxonomy for a post, hoping to get a list of all terms for that post and taxonomy. `get_the_terms($post_id, $taxonomy)` works, but gives this ungodly array of term objects that will require an extra layer of parsing before I can run the following code: `if (in_array($list_of_term_ids, $my_term_id)){ do good stuff... }` I'm looking to see whether anyone has come across a native WP function or method that extracts term ids into a flat list before rolling my own utility function, just so I can be using built-in best practices.


Multiple Blogs on one site. Best Practise

I've been tasked with adding a blog to an already up and running client site. The site uses wordpress as it's CMS already. So a blog install should be a relatively simply task and simply a matter of blending in the stylings of the blog to match the clients taste. However I get the sinking feeling that the client has already set up a "blog" with there testimonials page. I've not yet got the access passwords from the client to look under the hood but I thought I'd get an early start on my workload and do some research into my options. Theoretically I'm going to have to find a way to create another blog section within the site. I've come up with four options and I wanted the opinion of the wordpress community as to which one would be best. One of the key factors to bare in mind is that I would prefer to leave installing a second wordpress cms as that will end up causing confusion for the client, however I'm open to arguments if it turns out to be what the community think is best practice. So far my options as I see them are:   1. A second install of wordpress in a sub folder and then link through from the clients original site. This has all sorts of draw backs though as I'll be duplicating login credentials, having to replicate the theme, two sets of plugins to upgrade and maintain and may well be detrimental to the sites SEO if I have to start setting up redirects or fixing broken links ect. Like I say though if there is a strong argument for a second install that I'm missing then I'm open to suggestions.    2. Wordpress network site. This came up in a quick google search, I've never set up one before and I was wondering if anyone could list some pro's or cons. I'm not entirely convinced this is the right way to go, but again, I'm not an expert so this could be what I'm after. From what I've read (which at this point is limited to the codex) this would allow me to set up a second site but from the same install. Would this allow me to maintain one set of plug=ins/login details/theme but run two Blogs? Any idea what the affect on SEO mite be?    3. Using a plug in. This seems like the sound option and I've already earmarked a plug in that could do the job. However I'm worried about the long term support and don't want to be getting a frantic email from a client because the plug in is no longer supported in a future wordpress update. However the pro's (from what I've read) are that I can generate a template page and seperate the posts via the categories. Once the site is live I'll be managing the blog entries anyway so this would be beneficial. Also as the new blog will be built by inserting a series of codes into a template I shouldn't have to do too much in the way of styling as the css and layout from the theme should still apply (in theory :) . Any hoo, So far it looks like option three is the main contender, but I thought I'd throw it open to the forums to see if there are any reasons that options 1 or 2 would be better, or a possible option 4 that I'd not considered. Thanks in advance for any help guys.


get_option() filtering and getting out of recursion

`get_option()` provides couple of filters `'pre_option_'.$option` and `'option_'.$option`. However most times I tried to make use of these it usually explodes and not worth the trouble - either I need to check another option inside my filter, which triggers my filter, which triggers my filter... Another common case is that I need to get current option that I am filtering and I cannot do that because I am filtering it. Just curious - is there some practical logic to follow here? I know I could juggle my filter, but that is overhead that I don't like and filter removal is considered not too reliable by some. ;) For recent practical example - I want to filter `posts_per_rss` to my option, but provide WordPress value if my option is not set (for the record I know that recommended way to mess with it is via `post_limits`).


combine multiple feeds with fetch_feed and display blog titles for each item?

I'm trying to display multiple feeds using the fetch_feed function. Its working well thus far except I can't figure out why the title for each individual rss feed will not show up. Here is my code:               <?php // Get RSS Feed(s)     include_once(ABSPATH . WPINC . '/feed.php');     $rsslist = array(   'http://www.lt11.com/rss',                         'http://feeds.feedburner.com/climbingnarc'                     );     $rss = fetch_feed($rsslist);     if (!is_wp_error( $rss ) ) :      $maxitems = $rss->get_item_quantity(25);      $rss_items = $rss->get_items(0, $maxitems);      endif;     ?>         <?php if ($maxitems == 0) echo '
No items.
';         else         foreach ( $rss_items as $item ) : ?>
              <a href='<?php echo esc_url( $item->get_permalink() ); ?>'             title='<?php echo 'Posted '.$item->get_date('j F Y | g:i a'); ?>'>             <?php echo esc_html( $item->get_date('j/n/Y - g:i A') ); ?> -
<?php echo esc_html( $item->get_title() ); ?>
 - <?php echo esc_html($rss->get_title() ); ?>
         <?php endforeach; ?>              Its that list bit that calls for the title of the rss feed. If I only fetch one feed then the title shows up. When I fetch more than one feed as in the example above, the title does not show up. Any ideas on how to fix this? Thanks!


get facebook status

I'm looking for a good, simple PHP or JS function to get my latest Facebook status updates. Anyone have a good solution? I had a JS script but simply stop working. heres the code: view code Thanks in advance!


Loading scripts & styles from a meta box callback function

### Case: I got a set of classes that build form fields based on data from an input array. The class can build the following types of form fields:   * input (basic, hidden, password)   * textarea   * radio   * checkbox   * select   * colorpicker   * datepicker   * file upload _EDIT:_ The class uses `wp_register_script/_style` & `wp_enqueue_script/_style` to load the scripts & styles. The functions containing the actions are hooked inside the class like this: `add_action( 'admin_enqueue_scripts', array( &$this, 'enqueue' ) );`. ### Example: _(Inside`functions.php`)_               // meta box callback function     function test_meta_box_cb()     {            $input_args = array(              'type'         => 'color'             ,'id'           => 'color-id'             ,'label'        => 'Input Colorpicker Label'             ,'opt_name'     => 'abc_xyz'             ,'value'        => '009ee0'          );         new FormClass( $input_args, true );     }     // add the meta box     function add_test_meta_box()     {         add_meta_box( 'test_box', __('TestBox'), 'test_meta_box_cb', 'post', 'advanced', 'high' );     }     add_action( 'add_meta_boxes', 'add_test_meta_box' );      ### Problem: This way, my call for `wp_enqueue_script` & `wp_enqueue_style` doesn't work. I get the form fields rendered, but no scripts or styles. ### Situation & Backtracing of the problem: So far I could track down the problem to the wordpress core architecture:   * WP doesn't question what happens inside the callback function until `do_action('add_meta_boxes', $post_type, $post)` get's called (inside _edit-form-advanced.php_ ).    * That call happens long after _admin-header.php_ was called (which contains `do_action('admin_enqueue_scripts', $hook_suffix);`).   * Therefore the script & style can't get loaded (if I'm not wrong). ### Question:   1. How could i load styles before the meta box form fields get called?    2. How could i avoid repeating the same stylesheet over and over again - i want to use `wp_enqueue_style` & `wp_register_style`? I'm open to any answers including those who force me to rewrite my class architecture. _Note:_ I need to use this class in a lot of different szenarios, so bundling it to close together with the `add_meta_box` function is not good. I'm close to making an abstraction layer that divides the call for the meta box and the style/script part, but why would I want to add another layer above a core function?


Retrieving old forms in Contact Form 7

I recently was having trouble with some of my Contact Form 7 forms so I decided to install the latest version. I backed up (or thought I did) the old version by copying the old Contact Form 7 folder to my computer. Long story short, I had issues with the new version and have chosen to go back to the old. Unfortunately, now that I've copied my backup directory to the WP folder, the plugin works but only one of my old forms is still in the settings menu. Does anyone know where I can find the rest of the forms I had created? I'm really hoping they're stored somewhere in the directory I copied. Thanks.


Dropdown list of available posts for post editing

I have posts of two different categories that I can't easily relate. categories are: instructors and class categories (like aerobic, weights etc.) I would like to tie instructors to class posts NOT class types. Ideally from the **post edit screen** , I would like a dropdown of all instructors available from the class postings and then be able to select an instructor. Here is the class listing page http://howlingwolfmedia.com/site3/classes/classlist/ You can also see the instructor's listed under > classes > instructors I'd like the selected name to then show in the 'instructor' column. code for the classlist table: http://pastebin.com/tNScDVxW class postings fall under child cat 5-10 of parent cat id: 4 instructors cat id: 4 these are standard (not custom) post types This must in some way alter the admin part of the site and I'm not familiar with coding for that... nor am I well versed in mysql coding etc.


HTML inside __() or _e() language translation string

What is the proper approach to building translation strings? For example,               echo __( 'Hello ' . $first . ' you owe me money.' );     echo __( '

Top: ' . $t_margin . '
' . '
Bottom: ' . $b_margin . '

' )      Is it OK to add the strings and/or HTML or should it be done first and then run through translation like:               $html = '

Top: ' . $t_margin . '
' . '
Bottom: ' . $b_margin . '

';     echo __( $html );


Why won't the Jquery validation plugin work?

I am trying to use a Jquery validation plugin called bassistance. I have wp_enqueue_script the script. I have loaded Jquery as I understand it's built into wordpress. I have included the `<script>` tag so that I can `.validate()` it . I have added the rules by adding `class` to each field. This is all in one .php script, as I'm just learning. It doesn't seem to work. Please can someone advise? Has the `<style>` tag been used wrongly?               add_action( 'wp_enqueue_script', 'load_jquery2' );         function load_jquery2() {             wp_enqueue_script( 'jquery' );       }                    function add_my_css_and_my_js_files(){                 wp_enqueue_script('jquery-validate-min', plugins_url('activate/jquery_validate_min.js', __FILE__ ) );          }           add_action('wp_enqueue_scripts', "add_my_css_and_my_js_files");                          function mp_calcs_display() {     return '     <form name="calsinput" action="" method="post" id="calsinput" >
 Process

 operation type always robot

     Number of welds: <input type="number" name="numberofwelds" class="required digits" title="This field is required and must be a no."  >

     Number of construction welds: <input type="number" name="numberofconwelds" class="required digits"  title="This field is required and must be a no.">     <input type="submit" value="Calculate cycle time ">     </form>  ';     }


Want to add different text after each menu item

I want my main nav bar to display menu items with very short description of said menu under each item's title. To do this, I was hoping to just inject the menu item's 'title' attribute into the 'after' function below. Not quite sure how to do this:               // the main menu     function bones_main_nav() {         // display the wp3 menu if available         wp_nav_menu(array(             'container' => false,                           // remove nav container             'container_class' => 'menu clearfix',           // class of container (should you choose to use it)             'menu' => __( 'The Main Menu', 'bonestheme' ),  // nav name             'menu_class' => 'nav top-nav clearfix',         // adding custom nav class             'theme_location' => 'main-nav',                 // where it's located in the theme             'before' => '',                                 // before the menu             'after' => '',                                  // after the menu             'link_before' => '',                            // before each link             'link_after' => '',                             // after each link             'depth' => 0,                                   // limit the depth of the nav             'fallback_cb' => 'bones_main_nav_fallback'      // fallback function         ));     } /* end bones main nav */      I'm also worried about this interfering with drop-down functionality. Any help would be greatly appreciated.


How to hide "Comments are disabled"

is it possible to hide the string: "Comments are disabled" from everywhere? I mean also from posts list, and post page :) Thanks :) EDIT: sorry, the theme is Journal Cruch by Site5.com However I resolved using               if (comments_open())         comments_popup_link();      where the comments are displayed, but I don't like too much this solution :)


Instant install of wordpress

I just think about that... maybe it exist...you will tell me... Wordpressis a beautifull software, and the thing i like the most, is the instant install of the theme and plugin... So i though, why not have a onefile.html upload, and install wordpress ITSELF utomaticly fron the svn instead of having to upload a whole buch of file that take a looong time, and sometime failed... Maybe that file, will just select the language and the name of the folder... Or maybe, it exist ?... I know that the database must be done before... i do it, it's just the folder with 1000 files that weight 10 mg that bug me... autoinstall as plugin !


How to make multiple page out of one post

Suppose I write a long article and display products in one post but it is too long so I want to cut it and continue the next page in the same post? Can I do that in wordpress? I want to display many products so I want to build pages with in a post. One post but there is a navigation numbers like 1 2 3 -- like 3 page in one Post? How do I do that?


Hook into 'when user logs in' [persistent login]

I'm trying to create a persistent login mechanism in Wordpress (I can't find a plugin, but if there is one, let me know!). But I'm struggling to find a hook (add_action or add_filter) that runs when the user is initially authenticated by wordpress when logging in. Does anyone know of an appropriate way to execute code only once when a user logs into wordpress?


Deprecated function get_user_by_email($email)

I tried to find replacement function for get_user_by_email($email) but no luck. This function I am using to allow user to log in by email address or user id. Is there any replacement function or alternate way to do that?


Must I download entire WP directory for each separate instance/website that uses WP?

I'm no noob when it comes to website design or development. And am quite savvy with JQuery, XHTML and PHP. However, I admit I am quite noob-ish when it comes to WP... I already have the WP directory (folders for includes,admin,content and all the other php files it requires) uploaded to my root. Well, obviously in a subdirectory of the root (ex. root/wordpress). My question is, if I'm creating multiple (different clients) websites with WP yet stored on the same host, do I need to fully install the entire WP directory again? This time under a different pathname (ex. root/wordpress02)? I'm pretty damn sure the answer is yes, as each instance of WP has its own Dashboard and makes calls to its own PHP files. Unless I changed the target path of the plugins and other files I plan on sharing amongst my different WP sites, the answer is **yes**. I'm pretty sure I just answered my own question -- it's 1 am here. I've had a long day...   but I'm still kinda curious how you guys go about installing multiple instances of WP on your root. Just append a number to the different directories? (ex. root/wordpress01 , root/wordpress02 , root/wordpress03) **Thank you!**


Find relative post number in single post page

**My problem:** I need to find the relative post number (e.g 3rd of 10 posts) within a category. I can get the total amount of posts (10), like so:               $category = get_the_category();      $category[0]->category_count;       However, I am using a loop that only fetches 1 post (I only need to show the 1 post. It's the post number I need, in descending order). This is the loop that only retrieves 1 post:                   if ( have_posts() ):             while ( have_posts() ):                 the_post();     //content             endwhile;         endif; ?>      And the `$wp_query` request shows this:               [request] => SELECT   wp_posts.* FROM wp_posts  WHERE 1=1  AND wp_posts.post_name = 'another-hero-candy-etc' AND wp_posts.post_type = 'post'  ORDER BY wp_posts.post_date DESC       This means that `[current_post] => 0` and `[in_the_loop] => 1` are always the staying same (regardless if I go to **Next post ->** or not). My question: **How can I find the relative post number, if the loop is only fetching one post?**


Can't update an option when the publish_post action is fired.

I'm using Tom McFarlin's Plugin Boilerplate, and I'm facing this huge problem where I can't update an option when the `publish_post` action is fired. I have a function that hooks into the publish post action and all it does is update an option. This wasn't even my original task. What I wanted to do was call a private function from within the function mentioned above, that would update the option. That didn't work out so I got down to updating the option from within the public function itself. Here's the code, and if someone can help me out with not just this, but also how to use the private function it would really bail me out. P.S.: `the_content` filter works, but the `publish_post` action does not work. I've left the line which calls the private function commented out, so that you can test my two issues separately.               <?php     /*     Plugin Name: winkadoka on caffeine     Plugin URI: zilch     Description: blah blah blah     Version: 1.1.1     Author: richard madson               License:GPL v.2          /*--------------------------------------------*      * Constructor      *--------------------------------------------*/          /**      * Initializes the plugin by setting localization, filters, and administration functions.      */     function __construct()      {              // Load plugin text domain         add_action( 'init', array( $this, 'plugin_textdomain' ) );              // Register admin styles and scripts         add_action( 'admin_print_styles', array( $this, 'register_admin_styles' ) );         add_action( 'admin_enqueue_scripts', array( $this, 'register_admin_scripts' ) );              // Register site styles and scripts         add_action( 'wp_enqueue_scripts', array( $this, 'register_plugin_styles' ) );         add_action( 'wp_enqueue_scripts', array( $this, 'register_plugin_scripts' ) );              // Register hooks that are fired when the plugin is activated, deactivated, and uninstalled, respectively.         register_activation_hook( __FILE__, array( $this, 'activate' ) );         register_deactivation_hook( __FILE__, array( $this, 'deactivate' ) );         register_uninstall_hook( __FILE__, array( $this, 'uninstall' ) );              /*          * TODO:          * Define the custom functionality for your plugin. The first parameter of the          * add_action/add_filter calls are the hooks into which your code should fire.          *          * The second parameter is the function name located within this class. See the stubs          * later in the file.          *          * For more information:          * http://codex.wordpress.org/Plugin_API#Hooks.2C_Actions_and_Filters          */         add_action( 'publish_post', array( $this, 'on_publish_post' ) );         add_filter( 'the_content', array( $this, 'on_content_load' ) );          } // end constructor          /**      * Fired when the plugin is activated.      *      * @param   boolean $network_wide   True if WPMU superadmin uses "Network Activate" action, false if WPMU is disabled or plugin is activated on an individual blog      */     public function activate( $network_wide ) {         // TODO:    Define activation functionality here         //on activation --->see what akismet does.          } // end activate          /**      * Fired when the plugin is deactivated.      *      * @param   boolean $network_wide   True if WPMU superadmin uses "Network Activate" action, false if WPMU is disabled or plugin is activated on an individual blog      */     public function deactivate( $network_wide ) {         // TODO:    Define deactivation functionality here     } // end deactivate          /**      * Fired when the plugin is uninstalled.      *      * @param   boolean $network_wide   True if WPMU superadmin uses "Network Activate" action, false if WPMU is disabled or plugin is activated on an individual blog      */     public function uninstall( $network_wide ) {         // TODO:    Define uninstall functionality here     } // end uninstall          /**      * Loads the plugin text domain for translation      */     public function plugin_textdomain() {              // TODO: replace "plugin-name-locale" with a unique value for your plugin         $domain = 'plugin-name-locale';         $locale = apply_filters( 'plugin_locale', get_locale(), $domain );         load_textdomain( $domain, WP_LANG_DIR.'/'.$domain.'/'.$domain.'-'.$locale.'.mo' );         load_plugin_textdomain( $domain, FALSE, dirname( plugin_basename( __FILE__ ) ) . '/lang/' );          } // end plugin_textdomain          /**      * Registers and enqueues admin-specific styles.      */     public function register_admin_styles() {              // TODO:    Change 'plugin-name' to the name of your plugin         wp_enqueue_style( 'plugin-name-admin-styles', plugins_url( 'plugin-name/css/admin.css' ) );          } // end register_admin_styles          /**      * Registers and enqueues admin-specific JavaScript.      */     public function register_admin_scripts() {              // TODO:    Change 'plugin-name' to the name of your plugin         wp_enqueue_script( 'plugin-name-admin-script', plugins_url( 'plugin-name/js/admin.js' ), array('jquery') );          } // end register_admin_scripts          /**      * Registers and enqueues plugin-specific styles.      */     public function register_plugin_styles() {              // TODO:    Change 'plugin-name' to the name of your plugin         wp_enqueue_style( 'plugin-name-plugin-styles', plugins_url( 'plugin-name/css/display.css' ) );          } // end register_plugin_styles          /**      * Registers and enqueues plugin-specific scripts.      */     public function register_plugin_scripts() {              // TODO:    Change 'plugin-name' to the name of your plugin         wp_enqueue_script( 'plugin-name-plugin-script', plugins_url( 'plugin-name/js/display.js' ), array('jquery') );          } // end register_plugin_scripts          /*--------------------------------------------*      * Core Functions      *---------------------------------------------*/          /**      * NOTE:  Actions are points in the execution of a page or process      *        lifecycle that WordPress fires.      *      *        WordPress Actions: http://codex.wordpress.org/Plugin_API#Actions      *        Action Reference:  http://codex.wordpress.org/Plugin_API/Action_Reference      *      */     private function wj_check_entry_count($post_id)     {         $wj_check_option = get_option($post_id.'_wj_bentry_count',false);         if($wj_check_option===false)         {             $wj_entry_count = 1;             settype($wj_entry_count, "integer");              }         else         {             $wj_entry_count = $wj_check_option + 1;         }         $wj_update_option = update_option($post_id.'_wj_bentry_count',$wj_entry_count);         return $wj_entry_count;     }     public function on_publish_post($post_id)      {         //$this->wj_check_entry_count($post_id);         update_option('long_live_marlboro','heLLO');              // TODO:    Define your action method here     }   // end action_method_name          /**      * NOTE:  Filters are points of execution in which WordPress modifies data      *        before saving it or sending it to the browser.      *      *        WordPress Filters: http://codex.wordpress.org/Plugin_API#Filters      *        Filter Reference:  http://codex.wordpress.org/Plugin_API/Filter_Reference      *      */     public function on_content_load($content) {         return $content."hello world";         // TODO:    Define your filter method here     } // end filter_method_name          } // end class          // TODO:    Update the instantiation call of your plugin to the name given at      the class definition     $plugin_name = new winkadoka_111();


How to display custom post types AND regular posts separately on a shared taxonomy archive?

I've looked over numerous questions and answers on problems somewhat related to this but can't seem to find the same situation or solution. I have a custom taxonomy that needs to have an archive page that can display both custom post types and regular posts, but not in the same section. Basically there needs to be a clear difference between the CPT-posts and regular posts. For example, if "movie guides" is the custom taxonomy, "ben affleck" is a movie guide, and "Movies" are custom post types on: website.com/movie- guides/ben-affleck I would like that page to **also** have regular posts that are in the "ben affleck" movie guide taxonomy, but at the bottom of the page, in a different section for regular posts/post thumbnails. So part of the page would have Movies (posts from the CPT "Movies") with Ben Affleck, and after that would be post snippets from posts about Ben Affleck. I've found information to just pull both types of posts on the same page together, but wasn't sure how to separate them in the template which is what I'm really looking for. UPDATE: So far I've taken part of the theme's default category template and created taxonomy-{taxonomy_slugname}.php, which has pulled the CPTs onto the page, but now I can't figure out how to add posts since it's pulling the CPT's via "get post." My theme is Braxton, if that helps.


Hide content-box on specific pages (in admin)?

Is this possible to do somehow? In some pages i use a custom box plugin and i don't need to show the content box on some of those pages. Is it possible to hide it by page template? Or ID if template is not possible?


Checkbox in post not saving value

I have a checkbox above my metabox in a custom post. When I check it and publish/update the post, it become unchecked again meaning it's not saving it's value. Here is my code for the checkbox:               add_action('add_meta_boxes', 'my_meta_box');      add_action('save_post', 'save_postdata');        function my_meta_box() {         add_meta_box(             'movie_meta_box',             'Movie Meta Options',             'movie_options_meta_box_func',             'movie'         );     }     function movie_options_meta_box_func( $post ) {       wp_nonce_field( plugin_basename( __FILE__ ), 'movie_noncename' );       $mydata = get_post_meta($post->ID, 'movie', TRUE);       echo '<input type="checkbox" id="movie_abc" name="movie_abc" value="true" />';       echo '<input type="text" id="movie_xyz" name="movie_xyz" value="'.$mydata['movie_xyz'].'" size="60" />';     }     function save_postdata( $post_id ) {       if ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE )           return;       if ( !wp_verify_nonce( $_POST['movie_noncename'], plugin_basename( __FILE__ ) ) )           return;       if ( !current_user_can( 'edit_post', $post_id ) )           return;       $mydata = array();       foreach($_POST as $key => $data) {         if($key == 'movie_noncename')           continue;         if(preg_match('/^/i', $key))          {           $mydata[$key] = $data;         }       }       update_post_meta($post_id, 'movie', $mydata);       return $mydata;     }      Your help will be highly appreciated.


Best Practice For Querying Grandchildren?

**Objective:** Query and loop through a page's third-level "grandchildren" in a way that allows pagination. Here's the code that I'm using (pagination excluded):                       // Get the ID of the first generation             $gen1_ids = $post->ID;                  // Query for second generation IDs             $gen2 = $wpdb->get_col( "SELECT ID FROM $wpdb->posts WHERE $wpdb->posts.post_parent IN ($gen1_ids) AND $wpdb->posts.post_type = 'page' AND $wpdb->posts.post_status = 'publish' ORDER BY $wpdb->posts.ID ASC" ); // Test ordering by title                  // Implode the results for further use             $gen2_ids = implode( $gen2,', ' );                  // Now, query for third generation IDs using second generation IDs             $gen3 = $wpdb->get_col( "SELECT ID FROM $wpdb->posts WHERE $wpdb->posts.post_parent IN ($gen2_ids) AND $wpdb->posts.post_type = 'page' AND $wpdb->posts.post_status = 'publish' ORDER BY $wpdb->posts.ID ASC" );                  $args = array(               'post__in' => $gen3,               'post_type' => 'page',               'post_status' => 'publish',               'posts_per_page' => 5,               'paged' => get_query_var('paged')             );                  $results = null;             $results = new WP_Query( $args );                  if( $results->have_posts() ) {                  while ( $results->have_posts() ) : $results->the_post(); ?>
                         <a href="<?php the_permalink(); ?>" class="img">

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

...

             <?php endwhile;             } /* end if */ ?>               <?php wp_reset_query();  // Restore global post data stomped by the_post(). ?>      I've adapted the code from an answer to a support question two years back on the WordPress.org forums. The code is working. Is there a way that this can be done better?


Removing \\\ from Saved Data

I am saving some text to a setting field for use in an email template. So the text that is being put into the textarea to save looks like this...
some text [HERE]
      and after saving it looks like this....
some text [HERE]
      So what do I need to do to make it remove the `\\\\\` when I need to work with this data? * * * **UPDATE** I am saving the option/setting with this...               update_option('contact_record_client_template', $post_client_template);      So when I retrieve it with               $client_template = get_option('contact_record_client_template');      I just need to remove the `///`'s If I run `stripslashes()` on it, it removes 2 of the 3 `/`'s so it still leaves 1. I also tried using `str_replace( '///', '', $value );` but it just seems to add more or do nothing


Rearranging posts based on categories

Hey everyone on Stackexchange! I'm trying to find a way to prioritize posts based on a category in a loop, which is sorted by dates. All posts are grouped under their respective dates. The date labels appear once on top of posts of the same date like this: Date   * Post1   * Post2   * Post3 Date before that   * Post 4   * Post 5 etc I'm trying to achieve a result, where if a post belongs to a certain predetermined category (I would only be using 1 category), it would be moved above others under a date as such: Date   * Post3 (special category)    * Post1    * Post2 Date before that   * etc I've done research for a while on this topic and I can't figure out whether this would even be possible or not. Some query functions seem to serve a similar purpose, but I'm not certain and the date sorting makes it harder to figure out. Would I need multiple loops or something of that nature? My loop: http://pastebin.com/Pp0rA5j7 The loop and the sorting mechanism look like this in general (pastebin for a full code):               <?php $w_h = $w_d = $last = 0; ?>          <?php if (have_posts()) : while (have_posts()) : the_post(); ?>              <?php         if ( date('Yz') == get_the_time('Yz') ) {             if (!$w_d++) echo '
Today
';         } elseif ( date('Yz')-1 == get_the_time('Yz') ) {             if (!$w_h++) echo '
Yesterday
';         } else {             echo the_date('', '
', '
');         }; ?>          // post content              <?php endwhile; ?>         <?php endif; ?>                          <?php else : ?>      Sample site: http://goldenred.web44.net (I would like to move the post test 6 with the category "test" above others under February 3, 2013) I would be extremely thankful if anyone more experienced could help or at least point me towards a general direction. All comments are welcome.


Custom single-product page for product from category x

Is it possible to show a different single-product.php page for a product in a specific category?


Post Auto Draft Issue

I've made custom post type without title and editor and I use custom taxonomies, custom fields and attachments to form a post. My title is generated from custom taxonomies and custom fields (or "ID #" if nothing else is set). Here's title code (could use some polishing probably):               function custom_post_type_title ( $post_id ) {         global $wpdb;         if ( get_post_type( $post_id ) == 'cars' ) {             $autos = wp_get_object_terms($post_id, 'brand');                 $brand= '';                 $model= '';                     foreach ( $autos as $auto ) {                         if ( $auto->parent == 0) {                             $brand = ' '.$auto->name;                         } else {                             $model .= ' '.$auto->name;                         }                     }             $engine = get_post_meta($post_id, 'Engine', true);             if ($engine != '') { $engine = ', '.$engine.'l'; }             $title = $brand.$model.$engine;             if ($title == '') { $title = 'ID '.$post_id; }             $slug = sanitize_title('id-'.$post_id.$brand.$model.$engine);             $where = array( 'ID' => $post_id );             $wpdb->update( $wpdb->posts, array( 'post_title' => $title, 'post_name' => $slug), $where );         }     }          add_action('init', 'cars_save_post');     function cars_save_post($post_id) {             if ( ! defined( 'DOING_AUTOSAVE' ) && ! DOING_AUTOSAVE ) return;             add_action('save_post', 'custom_post_type_title', 100);             add_action('publish_post', 'custom_post_type_title', 100);     }      Problem is, if I attach an image and navigate away from the post, post will be saved, but won't apear as draft in my post list. The only way (that I know of) I can reach it - thru media's "attached to" link. Not sure if it's a bug or what, but I would like to see those posts in my Manage Posts list. Any solutions? **EDIT:** Maybe I wasn't clear enough. Just try this scenario:   * Add New Post (regular post will do);   * Upload an Image to it;   * Keep everything else empty;   * Do not save the post;   * Leave the page; Now if you'll check your Posts page, you won't find an "Auto Draft" in it. But if you'll check your Media page, image you uploaded just now, will be attached to "Auto Draft", which you can access from there. Even if you delete that image, that post will stay. I just want to keep my server clean, so if Author made a mistake and forgot to save his post, he should have an easy access to that post via Posts Page. So my question was, is this a bug and how can I fix it (display "Auto Drafts" in authors Posts page)?


Repository reporting incorrect plugin 'active version' stat

I released a new plugin to the .org repository about a month ago, and have committed several new versions since then, but the pie chart on the stats page has always stayed at 100% for an arbitrary version. For example, a week or so after 1.1 was released, it said that 100% of users had 1.0 installed, and recently it's been saying that 1.1.2 has 100%. I released 1.1.3 yesterday and it's gotten about 75 downloads so far, but the chart still says 1.1.2 has 100%. I realize there's probably some caching going on, but there's obviously a problem. It has around 1000 total downloads spread out over 5 releases, and we know that users don't update very frequently, so the chart should show the numbers spread out more. I'm guessing the next time it updates it'll say that 1.1.3 has 100%, like it's done for previous versions. Am I doing something wrong in my readme.txt or main PHP files? I've always had `Version: [current version number]` in the main PHP file and `Stable tag: [current version number]` in the readme.txt, and the readme.txt passes the validator.. You can browse through the different versions at http://plugins.svn.wordpress.org/basic-google-maps-placemarks/tags/. * * * **Update:** The File Header page in the codex has a specification, which can be helpful in debugging issues. * * * **Update 2:** Now it's stopped working again. ~~It might just take a couple releases with the fixed headers to work, though.~~. I finally fixed it; see my answer below.


Wordpress Theme Modification Help

I'm currently working with the 2010 theme and want to modify the nav bar so that when you click on a page that is listed on the navbar, it takes you to one of my categories pages (example, clicking on 'swag', will take you to the swag category page). How would I go about doing this? I've included my website: http://www.bro-campus.com Here is the code that deals w/ the navbar:               <?php /* Our navigation menu.  If one isn't filled out, wp_nav_menu falls back to wp_page_menu.  The menu assiged to the primary position is the one used.  If none is assigned, the menu with the lowest ID is used.  */ ?>                 <?php wp_nav_menu( array( 'container_class' => 'menu-header', 'theme_location' => 'primary' ) ); ?>             </div><!-- #access -->      Thanks for the help.


Multi-site vs seperate installs for just 3 blogs?

I'm new to Wordpress and in a few months will be attempting to set up three blogs. They most likely will be hosted on a Windows Server with IIS. (because the server is already there, and nobody else would know how to maintain Apache) The blogs will be unrelated and not share any common users. My question is, are there any benefits in this case to doing a multi-site setup, or would it be much simpler to have three separate Wordpress installs? If we'd go with separate installs now, would it be a hassle to combine them into one multi-site install in the future? I've read that multi-site on IIS doesn't work very well.


Create an Array of Specific Custom Post Meta

I'm having an issue thinking today and ran into a brick wall. What I'm trying to do it take 3 different custom field data for posts and combine them into an array that I can then json encode for use in some jquery. The three fields I want to use are the 'project title' and a custom field of 'latitude' and 'longitude'. And this is what I'm looking to get: Array ([0] => array ([0] => "project title", [1] => "latitude", [2] => "longitude"),[1] => array ([0] => "post title", [1] => "latitude", [2] => "longitude") I'm thinking i need a foreach loop, but just can't get it to work in my head. Any help would be greatly appreciated!


set_post_thumbnail_size in percent, not pixels?

I've created a new custom post type and I need the post thumbnails or featured images generated by the `get_the_post_thumbnail()` function to be set in percent, rather than pixels, as I'm using a fluid grid. Ideally I would only set the width (to 100%). Is there a way to do this? Potentially using `add_image_size()`?


Output data like WP's plugin installer/updater

I want to update my plugin and have proper feedback, like the WordPress update/upgrade mechanism. How is this effect done? Essentially I have a script I want to run that has lots of processing, and with each run through the loop, output another line to the screen. Is this done with the output buffer?


register_nav_menus() won't register menus

Please help with menu registeration: I have followed this guide (http://codex.wordpress.org/Navigation_Menus) step by step. Added the following code to functions.php:               function register_my_menus() {       register_nav_menus(         array('header-menu' => __( 'Header Menu' ) )       );     }          add_action( 'init', 'register_my_menus' );      But the guide says that this will make the menu appear in the Appearance -> Menus admin screen in the "Theme Locations" box as "Header Menu". When I go to Appearance -> Menus everything is greyed out and there is no option of "Theme Locations"


Proper syntax or method for keeping url in modified isotope / category links

I'm setting up a project gallery using isotope jquery plugin for layout and filterability. I've seen examples of how to add a list of category links and modify them to filter on click, but... I want to keep the url in the href attr, so that searchbots (or the theoretical non-js user) can click thru to project category pages. My code works until I set up the $link variable and try to insert it into the html. Yeah.... my php is weak. How do I add the link to the href attr?               /**      * Set up list of category links for gallery filter      */     function galleryFilterLinks() {         $categories = get_categories('exclude=1');         $link = the_permalink();         $html = '
';         $html .= '
All
';         foreach ($categories as $category) {             $html .= "
category_nicename}'>{$category->cat_name}
";            }         $html .= '
';         echo $html;     }


get_search_form() doesn't appear to take parameter into account

I am creating a menu manually and trying to include the search form. this is taken from the Wordpress Docs "Building a simple menu list" at http://codex.wordpress.org/Function_Reference/wp_get_nav_menu_items. I have added an additional
 element before completing the menu and added the search form.                           // Get the nav menu based on $menu_name (same as 'theme_location' or 'menu' arg to wp_nav_menu)                 // This code based on wp_nav_menu's code to get Menu ID from menu slug                      $menu_name = 'main-menu';                      if ( ( $locations = get_nav_menu_locations() ) && isset( $locations[ $menu_name ] ) ) {                          $menu = wp_get_nav_menu_object( $locations[ $menu_name ] );                          $menu_items = wp_get_nav_menu_items($menu->term_id);                          $menu_list = '
';                          foreach ( (array) $menu_items as $key => $menu_item ) {                         $title = $menu_item->title;                         $url = $menu_item->url;                         $menu_list .= '
' . $title . '
';                     }                     $menu_list .= '
' . get_search_form(false) . '
';                     $menu_list .= '
';                 } else {                     $menu_list = '

No Menu

';                 }                 echo $menu_list;      The problem is in the output.
               <form role="search" method="get" id="searchform" action="/">       <input type="text" value="" name="s" id="s" size="40" placeholder="Search" alt="Site Search">       <input type="submit" id="searchsubmit" value="Search">     </form>

Home

Sample Page

 Could someone tell me why the search is printing before the menu even though I specify echo = false?


add custom field in user register form

In my WordPress based site, I want to add a custom field (e.g. type of user - employee, investor) in the user registration form in the **admin side** , **without editing the core file**. Can anyone please suggest how can I do it, may be a plug-in or some script? I have already tried Cimi, Register Plus, CYC plug-ins but they all give facility to add custom field from front side registration form OR in the user edit form after the user is registered for first time from admin side. Is there any way we can do it in the user register form from admin side?


How to Filter Buddypress member by some of their profile fields

I am developing job site using Buddypress where people can search people, send friend request to them and become a friend. I am using user profile fields like name, email, phone, work location, Experience, Industry, Expected annual salary, Preferred Work days, etc. But my question is that, in members directory I want to let user can filters member(profile) by some of their profile fields like work location, Experiance,Indusstry, Expected annual salary, Preferred Work days ?


Add custom Facebook share link with share count and variable text

I'm trying to do this in a news site homepage. ![news site homepage](http://i.stack.imgur.com/eInPA.png) The part I'm struggling with is the Facebook share link text. It should:   * count the share/link of the specific post   * hide the number is it's 0   * write "share!" if it has 0 share   * write "shared 1 time" if it has 1 share   * write "n shares" if it has more than 1 shares. The text is arbitrary, I would like to be able to control it. I found this code to get the likes count:               function get_likes($url) {      $json_string = file_get_contents('http://graph.facebook.com/?ids=' . $url);      $json = json_decode($json_string, true);      return intval( $json[$url]['shares'] );     }       And I managed to use it to get the actual share count:               <a href="http://www.facebook.com/sharer.php?u=<?php the_permalink();?>&t=<?php the_title(); ?>">      <?php $url = get_permalink( $post_id ); echo get_likes("$url"); ?> shares      Now the difficult part would be how to control the text the same way it's controlled in "comments_number":               comments_number( 'no responses', 'one response', '% responses' );      Any hint?


Remove width and height attributes from [gallery] output

WordPress automatically adds the width and height attributes to [gallery] shortcode images. How to delete these attributes? Something like this but for [gallery] output.


Get posts from multiple tax terms

I'm trying to get related posts by taxonomy term. So a post tagged to 'London' would have related posts tagged to London. The code I have works if the post is tagged to a single taxonomy term only - in this case a single Location (entry_location is the taxonomy). But if I tag it to more than one (eg London and Paris), it returns no results. How do I make it accept multiple tax terms and display results from both? This is what I have so far. It works for posts tagged with one tax term only.               <?php     $this_post = $post->ID;     $query = new WP_Query(array(         'post_type' => 'dir_entry',          'posts_per_page' => 10,          'orderby' => 'date',          'order' => 'DESC',          'post__not_in' => array($this_post),          'entry_location' => get_the_term_list( $post->ID, 'entry_location' ))     );     while ($query->have_posts()) : $query->the_post();     ?>
         <a href="<?php the_permalink(); ?>" rel="bookmark"><?php the_title(); ?>
          <?php endwhile; wp_reset_query(); ?>      Thanks for any advice.


Looking For a Plugin to Limit User to Editing only one post or page and only on certain dates

I am creating a site for a sports tournament. There will be many teams involved. Each team needs to be able to amend a post updating their player roster, but they will not be allowed to do this 2 weeks before the game. Each team will be able to login to the site but should only have access to their team page. Is their a plugin or setting which would allow me to restrict a user to modifying only one page or post, and would restict them from editing on certain dates?


append stylesheet via shortcode

Wondering how I can add a stylesheet to wp_head section via shortcode, since shortcodes are parsed after wp_head, I've hearing about output buffering but I Am not sure. Any idea?


Featured image with the same height thumbs returns wrong thumb

I have 2 sizes thumbs for featured images with the same height:   * 300 x 200   * 540 x 200 I've checked the uploads folder and both thumbs with different sizes appear correctly:   * file_name-300x200.jpg   * file_name-540x200.jpg I'm trying to get the bigger thumb size (540x200) as following:               $width = 540;     $height = 200;     echo get_the_post_thumbnail( $post->ID, array($width,$height) );      However, the image markup that is returned is for the smaller thumb zise (300x200). Interestingly, the class is displayed with the correct domantions as 'attachment-540x200':               <img width="300" height="200" src="http://mysite.com/wp-content/uploads/file_name-300x200.jpg" class="attachment-540x200 wp-post-image" alt="file_name" title="file_name" />      Would really appreciate if anyone could explain what's happening and why the correct size thumb isn't returned. Many thanks, Dasha


Mysql query LIKE not working

I'm using this code.               $blog_list = $wpdb->get_results( "SELECT " . $extra . "blog_id, last_updated FROM " . $wpdb->blogs. " WHERE public = '1' AND archived = '0' AND mature = '0' AND spam = '0' AND deleted ='0' AND UPPER(blog_name) LIKE 'A%'" . $order . " " . $limit . "", ARRAY_A );      But that LIKE statement `AND UPPER(blog_name) LIKE 'A%'"` not working. Can anyone give me the solution? Thanks ## Update: Actually i'm using this code               $where = '';      if ($filter) {      $where = "AND UPPER(blog_name) LIKE '".strtoupper($filter)."%' ";      }      So i'll replace `AND UPPER(blog_name) LIKE 'A%'"` with `$where` later Note: I have 500+ blogs in my network. > I want to display all blog names with anchor link in a page. But I don't > want to load all the blog names. So I'm trying to achieve alphabetical > navigation. If the user click link "A" then the page should display Blog > names starts with "A". Likewise B, C, etc. Here is the full code if anyone interested


How to Send Group Name From MailChimp Plugin Sign Up Form

I am using the MailChimp WordPress plugin so that user's can sign up to a MailChimp mailing list. I want the signups to go into a specific group in my list. The plugin doesn't appear to work correctly with mailing list groups. Can I just dive into the plugin code and add a hidden field to force the users into a certain list? I tried digging around in there and it looks like the group is determined from an input called "interests". I have tried sending the form with a hidden field with this name having the value of the name of the group I want to use, like this:               <input type="hidden" name="interests" value="Group Name" />      But this does not work. Digging around on Google doesn't seem to offer much help either, as there only appears to be other confused users or not much interest in this particular aspect of the plugin. How can I do this?


In need of array of post tags

On the single-post page within the loop I need an array of the_tags() which is a string. and get_tags() gives me all of the tags not only this posts. Is there an easy way to get this?


how to get all the child category name in a specified category name?

Supposed the specified category name is "product", which has three layered sub-categories. The structure is like the following:   * product one      * product two        * product three          * product four I want to output all the subcategory names in the `sidebar.php` of my theme. How do I do? in my theme index.php i using: `<?php include("productHallofHome.php");?>` in productHallofHome.php i using code:               <ul class="productList_h">     <?php wp_list_categories( 'child_of=4&depth=0'); ?>         </ul>


how do i register global query in template

ok i think this is a basic php question but here goes: i have this working code:                 <!-- show the bands playing -->                                   <?php $child_posts = types_child_posts('my-intermediary');                                     foreach ($child_posts as $child_post) {                                     $band_id = wpcf_pr_post_get_belongs($child_post->ID,'album');                                         $band = get_post($band_id);                                         echo $band->post_title;                                         echo $band->the_post_thumbnail();                                                       }                                     ?>      what I want to do is access the $band->post_title; any where on the page so i'm guessing i need to cue this up globally on the page? adding this query to the header? so i would like to use some thing like `<?php echo $band(post_title); ?>` < example i hope that makes sense. thanks!


add image map script to post

when i add this script to my post html editor :
          <map id="wordlmap" name="wordlmap">     <area shape="rect" coords="845,267,929,324" href="/australia" alt="australia" title="australia"/>     </map>
      after updating post, i only get:

        can someone help me please, thanks in advance


High CPU & Memory Spikes?

I randomly get high spikes in CPU and Memory. I have deactivated nearly all plugins trying to find the culprit. I have been turning on a few at a time then waiting 30 minutes to see how if the server says it is okay. Which it always does. I didn't touch it for 3 hours tonight and when I returned I realized that my VPS randomly spiked at around 8PM and 9PM. But from 6PM-8PM no issues and from 930PM-1230AM no problems. It says my issue is with index.php. This randomly started on the 26th. No new plugins, no script change, no difference at all. How do I figure out what the issue is? **More Info:**   I have two wordpress installations on my VPS. One of which is my main site that me and about 3 other people write on and the other is kind of like a picture site where you submit pictures and I approve them and they get posted. I have about 330 people on that site. The subdomain (picture site) is the one I am having issues with. It is not the theme index file that is causing the problem but the WP index file. Between the two websites I get about 500k views a month (more on the main site than the picture site) **Server info:**   * Disk Space: 100gb   * Memory: 2GB   * Burst: 2GB   * Bandwidth: 1.5tb   * OS: CentOS 5.5 with Cpanel   * IP: 2   * Proccessor info:      * 8 proccessors     * GenuineIntel     * Intel Core i7 CPU 870 @29.93 GHz     * Speed: 2933.46 MHz     * Cache: 8192kb **Plugins (Currently activated)**   * Advanced Random Posts,   * bbpress integration,   * Custom Post Templates,   * GD Custom Posts and Taxonomies Tools,   * GD Star Rating,   * Gravity Forms,   * Members,   * Ultimate Category Excluder,   * Wordpress.com Stats,   * WP-Paginate,   * WP-PostRatings,   * WP-PostViews, On that note, all of these and others were turned on and worked just fine. Then all of a sudden it went to heck. All plugins are updated and I have the most recent wordpress.


Check if post type has term

Okay guys, I have a problem. Tomorrow(today) I have a deadline but I'm stuck with a problem and it seems that I can't figure out how to do. I have a custom post type, called `articles`. I've also created a taxonomy called `subject`. Each article has a subject, just like posts have categories. Now to the problem. When I'm on the `page-articles.php` (`page-slug.php`), it has to check which subject the article has. How can I do that?! I've been surfin' the web for days without finding any solution. What I'm thinking is that in some way I have to check the taxonomy subject if it matches a criteria. Like:               if (is_term('news, 'subject'){     // do this     }      But I really can't figure out how it works! The `is_term` doesn't do that, and I can't find any other function either.


header, stylesheet not being read

I'm working on a theme that doesn't seem to be reading the header and/or stylesheet. All of the code seems to check out correctly, so I'm a little confused as to why this is happening. Perhaps I've overlooked something. If you look at the live site, you can see that the loop/index.php is showing, but no header. header.php               <!DOCTYPE html>     <html <?php language_attributes(); ?>>                      <meta charset="<?php bloginfo( 'charset' ); ?>" />             <title><?php wp_title(); ?></title>             <meta name="description" content="<?php bloginfo( 'description' ); ?>">             <link rel="profile" href="http://gmpg.org/xfn/11" />             <link rel="stylesheet" href="<?php echo get_stylesheet_uri(); ?>" type="text/css" media="screen" />             <link rel="pingback" href="<?php bloginfo( 'pingback_url' ); ?>" />             <?php if ( is_singular() && get_option( 'thread_comments' ) ) wp_enqueue_script( 'comment-reply' ); ?>             <?php wp_head(); ?>

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

SITE

ABOUT

CONTACT

SEARCH

      index.php               <?php get_header(); ?>      <?php get_sidebar(); ?>
         <?php if (have_posts()) : ?>               <?php while (have_posts()) : the_post(); ?>

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

<?php the_time('F jS, Y') ?>

             <?php the_content('Read the rest of this entry »'); ?>             <img src="<?php bloginfo('template_directory'); ?>/img/dots_small.png" class="divider" alt="post divider">             <?php endwhile; ?>

<?php next_posts_link('« Previous Entries') ?>

<?php previous_posts_link('Next Entries »') ?>

               <?php else : ?>
Not Found

Sorry, but you are looking for something that isn't here.
               <?php include (TEMPLATEPATH . "/searchform.php"); ?>           <?php endif; ?>
           <?php get_footer(); ?>


Is including the loop necessary for page.php?

**QUESTION:** Is it necessary to include the wordpress loop in page.php? If it is not necessary, why do many themes (including the wordpress 2013 default theme) include it? I noticed this discussion on the wordpress forums, but I didn't understand the final answer. furthermore it is stated, > You use The Loop in your template files to show posts to visitors. ( > **Source:**http://codex.wordpress.org/The_Loop_in_Action) **BACKGROUND:** I am attempting to develop special page templates, and I realized that I don't quite understand what the benefit is of including the loop for pages.php, because after all, pages don't care about posts, that is something that concerns index.php.


htaccess problem not being able to overwrite previous rules

so guys, what i need to do is: whenever someone ask for this url: dev.site.com/noticias/id/tittle-for-the-news ( dev.site.com/noticias/([0-9]+)/([A-Za-z0-9-]+)/ ) it needs to get this: dev.site.com/noticias/?_escaped_fragment_noticias=id/tittle-for-the-news so i go ahead and set this function (i've done some googlign for this but not quite sure if its ok)               function add_url_rewrite() {              add_rewrite_rule('noticias/([0-9]+)/([A-Za-z0-9-]+)/', 'noticias/?_escaped_fragment_=noticias=/$1/$2', 'top');     }     add_action( 'init', 'add_url_rewrite' );      but ofcoruse, this didnt work at all and that's why im here trying to find out.. how do i do an .htaccess rewrite rule for wordspress. thanks in advance!


CMS: Making complex pages editable by the end user

I have been tasked with re-creating a small-ish corporate Web site (maybe a dozen static pages and a blog section) using WordPress. I have no troubles with the actual Web design, nor with the PHP itself. However, i am struggling to figure out how to set it up so that end users can edit the static pages with more complex layouts without HTML knowledge. For instance, the front page of this site will use the incredibly familiar pattern of a Jumbotron/slider at the top, three little 'highlight' boxes below that, and then a few distinct sections running down the remainder of the page, probably with images floated to alternating sides. (Kind of like this.) All of these components are actual content, so they need to be easily editable by the user. When a new version of the product comes out, they need to be able to change the headline in the Jumbotron, to describe the new features in the little highlight boxes, to update the alternating images in the sections, &c. The methods i have considered include using either widgets or something like Advanced Custom Fields to create separate editable areas for the Jumbotron, &c., but these don't seem very robust or elegant. I have also looked into using shortcodes to create simplified wrappers around these page components, but WordPress has a thousand little bugs that screw with the contents of shortcode blocks (extraneous line breaks, stray opening and closing tags, &c.). I have seen WordPress sites that use page structures like i've described, but i haven't been able to find any free themes/plug-ins that show how they manage it. Are the methods i mentioned above what these sites generally use, or is there some basic WordPress feature that i'm not understanding here?


Show login greeting above sub-menu links?

I'm using WordPress' built-in menu system to output my Main Menu Structure. I have one sub-menu, and it has two links currently, "Tracking" and "To-Do List". I want the following login greeting to show above those two links:               <?php global $current_user; if ( is_user_logged_in() ) { echo 'Welcome, '.$current_user->first_name.''; } else { echo 'Welcome, visitor'; } ?>         •     <?php add_modal_login_button( $login_text = 'Login', $logout_text = 'Logout', $logout_url = '', $show_admin = false ); ?>      The output looks like this if no one is logged in: `Welcome, visitor • Login` How can I show this output above the two sub-menu links?


Why images are disappearing on WordPress web site?

I had this problem on 2 web sites (different versions of WP, different web hosts, different plugins), once in a while some images are disappearing from media library. Is it plugin-related issue, database, web host?


Use the same date-based permalink structure for all post types

Is there a way to use exactly the same date-based permalink structure for all (non-hierachical) post types on a site, including posts and custom post types? I'd like all post types to have the format `/%year%/%monthnum%/%day%/%postname%/`, so the post type does not appear in the URL. With the default custom post type permalink structure, the following code successfully strips out the post type from the permalink (at the risk of causing problems with clashing post names, but I can live with that), but I can't figure out what I need to do to set the permalink to use the date structure.               class simons_permalinks {              function __construct() {                  add_action( 'pre_get_posts',  array( $this, 'pre_remove_slug' ) );             add_filter( 'post_type_link', array( $this, 'remove_slug' ), 10, 3 );              }              function pre_remove_slug( $query ) {                  if ( ! $query->is_main_query() )                 return;                  if ( 2 != count( $query->query ) or !isset( $query->query[ 'page' ] ) )                 return;                  $types = array( 'page', 'post', 'feature', 'opinion' );                  if ( ! empty( $query->query[ 'name' ] ) ) {                 $query->set( 'post_type', $types );             }              }              function remove_slug( $link, $post, $name ) {                  $types = array( 'post', 'feature', 'opinion' );                  if ( 'post' != $post->post_type and in_array( $post->post_type, $types ) and 'publish' == $post->post_status ) {                 $pto = get_post_type_object( $post->post_type );                 $link = str_replace( '/' . $pto->rewrite[ 'slug' ] . '/', '/', $link );             }              return $link;              }          } // class      Thanks, Simon


Change path of the page's template

It's possible to create templates for pages with that: `<?php /* Template Name: Contact */ ?>` This templates are located on the theme folder, right? Is possible to change the default path where WP search for those templates? If I want to make a lot of templates, can I create a folder to put them? Thanks


How to get media-button on front-end

I am using wp_insert_post to allow non-logged-in users to add post, and would like to have 'add-media' button as well on front-end. I tried wp_editor, but I don't want the text editor, just the add-media button, and that doesn't allow add-media for non-logged-in users. How can I achieve this?


Split a Multisite Into Single WordPress Websites

I am using wordpress export/import feature to slpit a multi site into single wordpress site. It is exported all the post but not extract the user. How can I export the user. Thanks, Alex


Tiny MCE custom styles, and preview in the backend

I've added the styles dropdown list to my TinyMCE editor in Wordpress. If I select the style, and preview it on the front end, it looks exactly like I expect it to. However, I'd like to preview it in the editor as well. By adding my '.blue-button' class to /wp- includes/js/tinymce/themes/advanced/skins/wp_theme/content.css, I was able to preview it like I want to, but this seems hackish and will probably break upon a TinyMCE update. Is there a filter to do this? So far I have the following:               add_filter('tiny_mce_before_init', 'customizeWYSIWYGToolbar' );     function customizeWYSIWYGToolbar($init) {         $init['theme_advanced_buttons2_add_before'] = 'styleselect'; // Adds the buttons at the begining. (theme_advanced_buttons2_add adds them at the end)         $init['theme_advanced_styles'] = 'Blue Button=blue-button';         $init['theme_advanced_disable'] = 'underline, justifyfull, charmap, pasteword';         return $init;     }          add_filter( 'mce_css', 'tdav_css' );     add_editor_style('css/admin.css');          add_action('init', 'WYSIWYGCSS');     function WYSIWYGCSS(){         wp_enqueue_style( 'wysiwygStyles', get_bloginfo('stylesheet_directory').'/css/admin.css', ",",'all' );      }      Thanks!


Changing document title only on a custom page template

Hi can anyone help with the below, please? I want to be able to change the contents of my HTML `<title>` tag only, so need to write an if / else statement. I'm getting myself a bit muddled as my PHP isn't great... but basically something along the lines of the below but combined...               <?php if ( ! is_page_template('boatDetails.php') ) { ?>     <title><?php bloginfo('name'); ?><?php wp_title('|'); ?></title>     <?php } ?>     <?php if ( is_page_template('boatDetails.php') ) { ?>     <title>I'm the boat details page</title>     <?php } ?>      Thanks :)