Copying custom field value in to title

I'm using wordpress as a cms, so on my custom post types, I don't need the title and only use custom fields. The title however is still used, and receives the value "Auto Draft", which I don't want - even if I won't use the permalink for now. The quickest and easiest solution would be to copy the value from my custom field "ref._nr." to the title, as this will be my unique identifier, and it will serve better in case I need to make changes later. Unfortunately, I have no idea as to where to start with this. In case you want to contribute code, the custom post type is called "listing". All input is much appreciated!


Shortcode empty attribute

Is there a way of creating an empty attribute for a shortcode? Example:               function paragraph_shortcode( $atts, $content = null ) {             return '
' . do_shortcode($content) . '
';     }          add_shortcode('paragraph', 'paragraph_shortcode');       User types > [paragraph] something [/paragraph] and it shows `<p class="super-p"> something </p>` How to add an empty attribute functionality to my first code? So when user types > [paragraph last] something [/paragraph] It will output:
 something
      I believe adding a:               extract( shortcode_atts( array(                 'last' => '',             ), $atts ) );      is a good start, but how to check if user used the "last" attribute while it doesn't have a value?


htaccess redirect dynamic posts

Probably not the correct fora to ask, but.. Also probably a simple question.. We are changing our site to Wordpress, and need to redirect old posts. Previously structure: `http://url.com/art/12345.html` Needs to go to `http://url.com/?p=12345`


Add google org chart to wordpress page

How do I display this page in a Wordpress site? What do i need to add or remove? This is for a static page not a blog post. (FYI: I want to use this to display a family tree on my website). I'm a wordpress beginner so please explain this at a beginner level if possible thanks

                  * * * edit Ok so I've been researching custom page templates. I think I need something like this                   <?php         /*         Template Name: GoogleOrgChart         */         ?>              <?php get_header(); ?>          <?php wp_enqueue_script( GoogleOrgChartScript, 'https://www.google.com/jsapi'); ?>

              <?php get_footer(); ?>      Is this correct? * * * so is this what it should look like?                   <?php             /*             Template Name: GoogleOrgChart             */                       add_action('wp_print_scripts','chart_data');             add_filter('the_content', 'chart_content');              function chart_data() {              ?>                            <?php         }              function chart_content() {                  return '

';         }     ?>              <?php get_header(); ?>              <?php the_content(); ?>              <?php get_footer(); ?>


Display products based on sub-categories

We need to display products in WooCommerce which are under the respective category in the sidebar of respective category pages, like this:               E-Books Categories     ------------------------------------------------------       -Product1     -------------------------------------------------------       -Product2


How to remove Google Analyticator in Wordpress site?

I have issues in uninstalling Google Analyticator. Should I just ignore it and install Google Analytics for Wordpress instead?


How to allow PHP In WordPress text widget

I want to add a text widget to my new WordPress website, but in the text widget there are some PHP snippets and I am finding it difficult to do it. Please help me Guys.


Modifying Page-Links <!--nextpage--> format

I'm developing a mobile theme and need to change the format of posts that are using the tag. Can I add something to functions.php to change the format? Ideally i'd like to make each page a list-item then display all inline on one page versus an individual pages, is that possible?


Sending out WP Posts as MailChimp Newsletters

I have the functioning signup MailChimp plugin/widget working great on my customer's WordPress site. But what I REALLY want to do is send out new posts (from WordPress Dashboard) as the MailChimp designed Newsletters. Is it possible to do this? If so, does it happen in the Dashboard or the MailChimp admin site?


I'm a super admin and I want to give an admin the ability to add new users...?

How can I do that? So far the admin can only add exisiting users.


Enqueue Style for a page/pages only

it is causing problem because i did not do it before. I am trying to enqueue style or may be scripts depending on page. But it not working. Here is the code:               add_action('init', 'my_enqueue_styles');          function my_enqueue_styles(){         if(is_page('Add Event')){ // also tried slug, page id and wp_reset_query(); bot not worked              wp_deregister_style( 'jquery-ui-custom-flick' );         wp_register_style( 'jquery-ui-custom-flick', get_bloginfo('template_directory') .'/styles/jquery.ui/ui.custom.flick.css');         wp_enqueue_style( 'jquery-ui-custom-flick' );         }          }      I am not doing the conditional right. The script works without the conditional. Thanks! ## **RESOLVED:** The problem was with the `init` action hook. the conditional `is_page()` is false when `init` is called. After adding the style to the hook `wp_print_styles` it worked perfectly.


Sidebar widgets - dynamic CSS : problem with widget-title

Fortunately or unfortunately without much studying I made a dynamic sidebar widget area for my client's website. My `functions.php` codes are:               ...     register_sidebar( array (         'name' => 'Left Widget Area',         'id' => 'primary_widget_area',         'before_widget' => '
',         'after_widget' => '

',         'before_title' => '
',         'after_title' => '

',       ) );       ...      and the sidebar is called with:
     <?php if ( is_sidebar_active('primary_widget_area') ) : ?>        <?php dynamic_sidebar('primary_widget_area'); ?>     <?php endif; ?>
      Thing is nicely done, BUT...in two conditions: ### When widget-title is active ...it loads...

widget title...

             widget contents here...

      ### When widget-title is blank ...it loads...

          widget contents here...

      Now with my CSS the look of the dynamic widgets are like:   ![my dynamic widgets](http://i.stack.imgur.com/XVuwA.png) As I identified the problem is: in `register_sidebar()` function there are only 4 options:   1. before_widget   2. after_widget   3. before_title   4. after_title With these there can be only two conditions:   * Widget Title Active: Load 1,2,3,4   * Widget Title Absent: Load 1,2 only So with my `functions.php` code, the `<div class="widget-content"></div>` completely missed when the title field remains blank. And so, without 4-sided- padding the content of the widget area looks bordered and looks ugly. ### PROBLEM If I put `padding: 3%;` in `.widget`, it changes the widget-title's look and take padding around it, and it too looks bad.   ![dynamic widget with padding in .widget](http://i.stack.imgur.com/GipQL.png) But it solves the widget-title-less widgets' look. ### PROBABLE SOLUTION So, I thought about a solution, if I can make a conditional CSS, like:               <?php     if( active_widget_title() ) : ?>          <?php else : ?>          <?php endif; ?>      But alas! there is NO SUCH THING like _`active_widget_title()`_ as per as I know. So, without that, **how can I solve this very minute problem of designing the dynamic widgets?** ## EDIT: And the most shocking problem is: when the title is absent, there is a `<div>` malfunction, because the structure happened there looks:

          widget contents here...

      An end-div (`</div>`) without a starting one. That's making a massacre to the template. :(


How can I get my Custom Post Types to appear in nav-menus.php 'Menu'?

I am having a bit of a problem with my custom post types. I can create them fine in my theme, but I cannot get them to show up in the 'Menu' screen ... at least not by default. I have tried adding menu and UI flags to my code (see below), but no dice. Interestingly enough, when I enable the Custom Post Types UI plugin, the custom post types appear fine (sometimes) in the 'Menu' screen. This seems to suggest to me that there is a step that I am missing somewhere, and that somehow, the Custom Post Types UI plugin sets that flag, and allows my custom post type, and taxonomies to appear in the nav-menus.php 'Menu' screen. edit:: The bit above has been answered. Thank you Milo. I should have been turning them on in the 'Screen Option' tab. On a related note, is there a way of getting the custom post type available as a menu item without using a taxonomy? I'll try and explain. In this instance, I created a portfolio post type. a. When it does appear in the nav-menus.php, I can select individual pages to add to the menu. This is not ideal. b. Alternatively, I can assign the portfolio pages to a category (let's call it Widgets), and all pages assigned to widgets appear on the archive page. This raises another question, can I force the assigning of every new portfolio page to at least one default category, like the 'Posts' behave in WP? This solution works most of the time, till someone forgets to assign a category to a new portfolio page ... c. The third option, is to use the rewrite slug, and just create a custom menu item, point to (in this case) '/portfolio/'. This works fine with my permalinks. However, WordPress does then not add '.current-post-item', or '.current-menu-parent' or '.current-post-parent' classes to this menu item when viewing a portfolio page, meaning that I cannot use CSS to highlight the 'Portfolio' menu entry when viewing portfolio pages, like I can with all the other pages/subpages and posts on the site. While this is not an overly big deal, it does mean a less than consistent UI experience for site visitors. Here is my code for registering the custom post types. As you can see, I have been adding a ton of the 'show_in_...' flags, but to no avail. I have tried removing the flags, adding them one at a time and testing (with a clean database each time), but to no avail. As I pointed out above, that the Custom Post Types UI plugin seems to enable this behaviour (most of the time), seems to suggest that I am missing a step outside this registration code. Thank you in advance.               add_action( 'init', 'toshihiro_register_portfolio_content_type');     function toshihiro_register_portfolio_content_type(){         register_post_type('tosh_portfolio',         array(              'labels' => array (                  'name' => 'Portfolio Pages',                  'singular_name' => 'Portfolio Page',                  'menu_name' => 'Portfolios',                  'add_new' => 'Create Portfolio Page',                  'add_new_item' => 'Create New Portfolio Page',                  'edit' => 'Edit Portfolio Page',                  'edit_item' => 'Edit Portfolio Page',                  'new_item' => 'New Portfolio Page',                  'view' => 'View Portfolio Page',                  'view_item' => 'View Portfolio Page',                  'search_items' => 'Search Portfolio Pages',                  'not_found' => 'No Portfolio Pages Found',                  'not_found_in_trash' => 'No Portfolio Pages found in Trash',              ),             'description' => 'Portfolio or product or project pages',             'supports' => array('title', 'editor', 'excerpt', 'revisions', 'thumbnail'),             'public' => true,             'show_ui' => true,             'show_in_menu' => true,             'show_in_nav_menus' => true,             'query_var' => true,             'has_archive' => true,             'hierarchical' => false,             'can_export' => true,             'menu_icon' => trailingslashit(TOSH_IMAGES_URI) . 'toshihiro_icon.png',             'menu_position' => 33,             'rewrite' => array('slug' => 'portfolio'),         )     );     register_taxonomy('tosh_cat_port',array (0 => 'tosh_portfolio',),array( 'hierarchical' => true,                                                                 'label' => 'Portfolio Categories',                                                                 'singular_label' => 'Portfolio Category',                                                                 'show_ui' => true,                                                                 'query_var' => true,                                                                 'show_in_nav_menus' => true,                                                                 'rewrite' => array('slug' => 'portfolio_cat'),                                                                  ) );     register_taxonomy('tosh_tag_port',array (0 => 'tosh_portfolio',),array( 'hierarchical' => false,                                                                 'label' => 'Portfolio Tags',                                                                 'singular_label' => 'Portfolio Tag',                                                                 'show_ui' => true,                                                                 'show_in_nav_menus' => true,                                                                 'query_var' => true,                                                                 'rewrite' => array('slug' => 'portfolio_tags'),                                                                  ) );     }


WP E-Commerce WPEC 3.8 Sort Categories

I'm running Wordpress 3.1, with the WP E-commerce plugin (3.8.2) with Gold Cart 2.9.1. I posted this question a while back on the getshopped.org forum, with no solution unfortunately... I have a list of product categories on my store products page (not the category widget), and I would like to change the order to sort the categories by their ID, not their names. At the moment, they are sorted alphabetically. I found a possible solution here http://getshopped.org/forums/topic.php?id=7200 I have tried all these fixes to no avail, particularly the "order_by" fix by leewillis77 about a year ago. I have just realised the structure of the database of version 3.8 has completely changed too, so I expect this is the reason this fix isn't working. Ideally, I would like a fix that doesn't edit any core files so when the next update comes along nothing changes. I can't share my site as it's local at the mo Hope someone can help! Many thanks Paul PS My PHP skills are pretty limited, as is my experience with MYSQL so dumbdown solutions a bit please ;-)


Pagination Not Displaying on Custom Term Archive

I am trying to achieve pagination on a custom template I have that displays on an archive of terms. It appears to be working because when I navigate to `mysite/taxonomy/page/2/` or 3,4,5 etc. the pagination works. It also shows the correct number of terms per page. However, there are not any actual pagination links showing on the bottom of my page and it sounds like there is supposed to be. I am following this tutorial as well as the Codex instructions, but I have to be missing something. Can someone please help figure out what? My simplified code is below.               <?php get_header(); ?>

Index Post Type Archive

         <?php              if ( get_query_var( 'paged' ) )         $paged = get_query_var('paged');     else if ( get_query_var( 'page' ) )         $paged = get_query_var( 'page' );     else         $paged = 1;          $per_page    = 12;     $number_of_terms = count( get_terms( '100list' ) ); // This counts the total number terms in the taxonomy with a function)     $offset      = $per_page * ( $paged - 1) ;              $libargs=array(           'orderby'           => 'name',              'order'             => 'ASC',             'hide_empty'        => 0,             'exclude'           => array(16, 20, 22,25, 27, 28, 30, 4, 42, 7, 43 ), //* Enter ID's of parent categories to exclude from list             'taxonomy'      => '100list',             'parent'               => '',             'number'       => $per_page,             'offset'       => $offset,                  );                    $libcats=get_categories($libargs);                    $i = 0;                  foreach($libcats as $lc){                      if( $i % 4 == 0 ) {                  echo '

';                 }               $i++;                 echo '
';                      $termlink = get_term_link( $lc->slug, '100list' );             ?>

<?php echo  $lc->count  ?>

 Symbols

 <a class="label label-default" href="<?php echo $termlink; ?>"> View Group

                                  <?php                     $attachment_id = get_field('taximage', '100list_'.$lc->term_id);                     if ($attachment_id) {                         $image = wp_get_attachment_image_src($attachment_id, 'industrygroup-img');                         if ($image) {                             ?>                             <img class="img-responsive" src="<?php echo $image[0]; ?>" />                             <?php     } }                 else { ?>     <img class="img-responsive" src="http://www.runningalpha.com/wp-content/uploads/2014/08/RA_logo_300px_groups.jpg" alt="<?php the_title(); ?>" />          <?php } ?>

 <a href="<?php echo $termlink; ?>"> <?php echo $lc->name; ?>
                <?php  echo '
'; } ?>              <?php  if (function_exists("pagination")) {     $big = 999999999; // need an unlikely integer         echo paginate_links( array(             'base'    => str_replace( $big, '%#%', esc_url( get_pagenum_link( $big ) ) ),             'format'  => '/page/%#%',             'current' => $paged,             'total'   => ceil( $number_of_terms / $per_page ) // 20 items per page              ) );     }         ?>

           <?php include("sidebar100list.php"); ?>

     <?php get_footer(); ?>


Restrict function call to page load but not ajax call

I use the following to stop Subscribers (and Customers) from accessing the admin area of my site:               /**      * Redirect back to homepage and not allow access to WP admin for Subscribers.      */     function xcsn_redirect_from_admin(){         if ( ( ! current_user_can( 'edit_posts' ) ) && ( ! is_checkout() ) ){             wp_redirect( site_url() );             exit;         }     }     add_action( 'admin_init', 'xcsn_redirect_from_admin' );      It works great except that it interferes with an ajax call that my checkout page is making (WooCommerce). The call stalls and the checkout can't proceed unless you have 'edit-posts' privileges, which defeats the purpose, obviously. **My question:** is it possible to set a conditional that will work with an early call like `admin_init` that will allow the ajax calls to get through but _won't allow_ the admin backend to be loaded as a page? (Sorry if the title is unclear - it was hard to fit into a single sentence!)


Using get_post_meta with new_to_publish

I'm trying to read the custom fields set by the user when publishing a new post:               function doSomething($post) {             $meta = get_post_meta($post->ID);             error_log("post meta: ".print_r($meta, true));          }          add_action("new_to_publish", "doSomething", 999);     add_action("draft_to_publish", "doSomething", 999);     add_action("pending_to_publish", "doSomething", 999);      The custom fields are there for draft_to_publish but not for new_to_publish. If I use save_post it seems to work every time, but I need it to only run when the status is set to publish for the first time...


include plugin folder directly in theme folder to load faster page n wp

include plugin folder directly in theme folder to load faster page in wp? Load jquery in the footer and the jquery load from plugin installed also.


First post outside of loop, homepage only?

Because of the way my templates are structured, I need to pull the first/sticky post from the site outside of the standard loop, just on the homepage. I'm using _s (underscores.me) as a base, so the current loop on the index look like this:                   <?php if ( have_posts() ) : ?>            <?php /* Start the Loop */ ?>       <?php while ( have_posts() ) : the_post(); ?>              <?php           /* Include the Post-Format-specific template for the content.            * If you want to overload this in a child theme then include a file            * called content-___.php (where ___ is the Post Format name) and that will be used instead.            */           get_template_part( 'content', get_post_format() );         ?>            <?php endwhile; ?>          <?php elseif ( current_user_can( 'edit_posts' ) ) : ?>            <?php get_template_part( 'no-results', 'index' ); ?>          <?php endif; ?>      What do I have to do to query the first post (I'd like to use the same get_template_part construct if possible), on the homepage only, and not have it interfere with counts for paging past the homepage? Thanks, **UPDATE** Next part of the question; I now want to add a custom query inbetween the separated first post, and the continuation below, that only pulls a few posts in from specific categories. My query doesn't seem to do anything - what's wrong with it? Are those two main loops interferring with it somehow?                   <?php     $args = array(         'cat' => 6521,//(int) - use category id.         'category_name' => 'featured', 'dossier', 'destacado',     );         $featured_posts = new WP_Query( $args );          // The Loop     if ( $featured_posts->have_posts() ) :          while ( $featured_posts->have_posts() ) : $featured_posts->the_post();       echo '
';       the_title();       echo '
';     endwhile;          endif;          // Reset Post Data     wp_reset_postdata();     ?>      Thanks,


Encryption of Wordpress Posts

I've been looking into making a completely private Wordpress blog and have found useful blogs/tutorials along the way that have helped such as David Hewsons pretty detailed walkthrough. I currently have a system in place (online) that is nice and private and requires login credentials to access the blog, now here-in lies the problem. I'm worried that if my web server is hacked in some way (I'm not going to be ignorant to the fact that this may occur) and my database accessed then all of my posts will be viewable - thus defeating all of the front-end privation work. I've looked for pre-built solutions to encrypt the posts themselves but nothing exists yet, what I need is a helping hand in the right direction for writing a Wordpress plugin as I haven't a clue where to start in relation to coding plugins in Wordpress, any help/tutorial links would be appreciated. I do have quite extensive knowledge of PHP/MySQL albeit not in the Wordpress fashion of API's etc.


Ajax comments not working

I followed a tutorial to 'ajaxify' wordpress comments where it does not reload the page:               jQuery('document').ready(function ($) {         $('#commentform').each(function () {             var commentform = $(this); // find the comment form             commentform.prepend('

'); // add info panel before the form to provide feedback or errors             var statusdiv = $('#comment-status'); // define the infopanel                  commentform.submit(function () {                 //serialize and store form data in a variable                 var formdata = commentform.serialize();                 //Add a status message                 statusdiv.html('
Processing...
');                 //Extract action URL from commentform                 var formurl = commentform.attr('action');                 //Post Form with data                 $.ajax({                     type: 'post',                     url: formurl,                     data: formdata,                     error: function (XMLHttpRequest, textStatus, errorThrown) {                         statusdiv.html('
You might have left one of the fields blank, or be posting too quickly or your comment was too short.
');                     },                     success: function (data, textStatus) {                         if (data == "success") statusdiv.html('
Thanks for your comment. Refresh the page to see it.
');                         else statusdiv.html('
Please wait a while before posting your next comment
');                         commentform.find('textarea[name=comment]').val('');                     }                 });                 return false;             });         });     });      .. it works, but just for the first #commentform it finds. On my homepage, several posts are displayed and each has a #commentform enabled. I tried .each as you can see but it doesn't seem to have any effect.


Wordpress plugin url for form submit

I am creating a custom plugin that has dynamic forms and I wanted to ask on how I can create a dynamic form action url. Example is Contact Form 7, how did cf7 create the form action url without creating a new page or a file for submission? Please share any idea on how to do something like that for plugin. Thanks


WooCommerce store with ~30,000 products

I'm investigating WooCommerce as a potential e-commerce solution, however my immediate concern (which I haven't been able to find information on) is the number of products. The proposed store needs the ability to house ~30,000 different products.   * Is there any technical limitation on the number of products that WooCommerce can handle?   * Would the limit simply be the same as the number of posts I could safely/practically handle in WordPress?   * Are there other issues that would make managing something like this _just a bad idea_? (experiences with WooCommerce)


Use proxy to bypass JSON restricion

I'm trying to pull content from an API that does not allow JSONP using jQuery and AJAX. Obvisouly I'm running into cross domain problems. The only work around for this seems to be using a proxy on my host's server, like in this example: http://blog.edwards-research.com/2012/10/cross-domain-ajax-a-simple- workaround/. My problem is that I can't seem to get this working. I think my main problem is I don't know where to stick the proxy.php file, and I don't know how to edit the code to point to that location. Would it go in the theme folder, the wp-content folder, the public_html folder, or the home folder? Any help would be greatly appreciated.


Multisite on Windows with wildcard subdomains

I want to create a local network on a Windows machine using subdomains. I do not want to edit the `hosts` file for each new subdomain. But Windows does not support wildcard subdomains, and the Codex doesn’t say anything useful about this topic. What should I do?


How to get shortcode to work inside a foreach loop called within a shortcode?

My plugin, WP Coda Slider, uses a shortcode to `get_posts` and add them to the slider. If one of the posts contains shortcode the shortcode in that post will not work.               $my_wpcodaslider = new wpcodaslider();     class wpcodaslider{              var $shortcode_name = 'wpcodaslider';         var $pattern = '';         var $posts_content = '';              function wpcodaslider() {             add_shortcode( $this->shortcode_name, array( &$this, 'shortcode' ) );             add_action( 'the_posts', array( &$this, 'wpcodaslider_scripts' ) );         }              // insert the shortcode in any page ie: [wpcodaslider id=slidername cat=4 show=3] will show first three post in category with id of 4         function shortcode( $atts, $content = null ) {             extract( shortcode_atts( array(                 'cat' => null,                 'id'  =>  null,                 'show' => null,                 'args' => null             ), $atts ) );                  //Make sure there is a query and name             if (! $cat || ! $id)                 return 'Could not load slider. Mallformed shortcode.';         $o = '

';                  $posts = get_posts('post_type=post&order=desc&cat= '. $cat . '&numberposts= ' . $show . '');             foreach($posts as $post){                      $o.=                 '
ID . '">

' . $post->post_title . '
                         ' . $post->post_content . '

';             }                       $o.='

                      ';                       return $o;         }      It also does another foreach loop to check for its shortcode before enqueing the scripts.               function wpcodaslider_scripts($posts) {                       if (empty($posts)) return $posts;                  $shortcode_found = false; // use this flag to see if styles and scripts need to be enqueued             foreach ($posts as $post): {                 if (stripos($post->post_content, 'wpcodaslider')) {                     $shortcode_found = true; //shortcode found so lets load the scripts                     break;                 }             }                  if ($shortcode_found) {                 //enqueue scripts                 wp_enqueue_script('coda_slider', WP_PLUGIN_URL . '/wp-coda-slider/js/coda.slider.js',                 array('jquery'));                      //enqueue style sheet                 wp_enqueue_style('coda_slider', WP_PLUGIN_URL . '/wp-coda-slider/css/coda-slider-2.0.css');             }                  return $posts;         }          }      Any ideas on how I can get shortcodes within the posts to work? I have tested it with the `[gallery]` shortcode and a few others from various plugins.


problem using $var for shortcode attr value

I am trying to pass a variable value to a shortcode attribute. I can't get it to work. Is the following supposed to work, or must values be literal?               $mycat = 'books';     $myshortcode = '[products category="'.$mycat .'"]';          echo do_shortcode($myshortcode);      The above outputs nothing. If I replace it with               $myshortcode = '[products category="books"]';          echo do_shortcode($myshortcode);      Then it produces the expected result. I'm placing this code in a 'Custom Code Block' in the HeadWay Theme's Visual editor. I'm trying to find out, if the problem I have has to do with the way HeadWay parses the content of the custom code block, or if it is indeed not possible to construct a string for use with do_shortcode() like this.


using post_type with meta_query

I'm setting up a basic slideshow and want to loop through the custom post type “Projects” and display _only_ projects with a photo attached -
             <?php $args = array( 'post_type' => 'project', 'meta_query' => array('key' => 'homepage_slide','value' => 'true'));             $loop = new WP_Query( $args );             while ( $loop->have_posts() ) : $loop->the_post(); ?>
                   <img src="<?php the_field('homepage_slide'); ?>" alt="slide" />
                  <?php endwhile; ?>
      Unfortunately this code is trying to include slides for _all_ projects. Is there anything I'm doing wrong?


Default sub-pages on Wordpress Multisite

I'm currently using this code to create some default pages in my Wordpress Multiste...               function default_pages( $blog_id )     {     $default_pages = array(         'Contact'     => "This is your 'Contact' page. Enter in your content here.",         'Information' => "This is your 'Information' page. Enter in your content here.",         'About'       => "This is your 'About' page. Enter in your content here.",         'Home'        => "This is your 'Home' page. Enter in your content here.",     );          switch_to_blog( $blog_id );          if ( $current_pages = get_pages() )         $default_pages = array_diff( $default_pages, wp_list_pluck( $current_pages, 'post_title' ) );          foreach ( $default_pages as $page_title => $page_content ) {                 $data = array(             'post_title'   => $page_title,             'post_content' => $page_content,             'post_status'  => 'publish',             'post_type'    => 'page',         );              wp_insert_post( add_magic_quotes( $data ) );     }          restore_current_blog();     }          add_action( 'wpmu_new_blog', 'default_pages' );      I was just wondering whether it was possible to create subpages/child pages as well? For example to have 'Information' as a child page of 'About'. Thanks guys!


Facebook stream to WordPress/website

What is the current best practice for adding a Facebook stream to your website? I have seen several different techniques, most of them are outdated, and the Facebook developers' site gives me no info on what I need from them to pull it off. any thoughts?


Customize Edit Post screen for Custom Post Types?

What's the best way to completely customize the Edit Post admin screen for a specific custom post type? I have customized it to an extent already on creation of the custom post type - adding additional fields etc, but I want to remove many of the elements such like permalinks, preview post, disable quick editing etc


Wordpress pagination error - next page giving 404 error

I have following codes to list all attachments with pagination,                           <?php                 $paged = (get_query_var('page')) ? get_query_var('page') : 1;                   $args = array(                 'paged'     => $paged,                 'orderby'   => $sortorder,                 'order'     => $orderacdc,                 'post_type' => 'attachment',                 'post_per_page' => $numberposts, // posts_per_page doesn't work for get_posts!                 'post_mime_type' => 'audio',                 'post_status' => 'any',                 'post_parent' => $post->ID,                 'meta_key' => $metakey,                 'tax_query' => array(                 array(                 'taxonomy' => 'category',                 'field' => 'slug',                 'terms' => $c_term->slug                 )                 )                 );                      ?>                 <?php $wp_query = new WP_Query($args);  //print_r($wp_query); ?>                      <?php if ( $wp_query->have_posts() ) :  while ( $wp_query->have_posts() ) : $wp_query->the_post();                  the_title(); the_category();                 endwhile; endif;                 ?>                      <?php                 $big = 999999999; // need an unlikely integer                      echo paginate_links( array(                 'base' => str_replace( $big, '%#%', get_pagenum_link( $big ) ),                 'format' => '?paged=%#%',                 'current' => max( 1, get_query_var('page') ),                 'total' => $photos->max_num_pages                 ) );                 ?>      every thing works fine even it shows pagination links, the problem is when I click on the 2nd page link it gives 404 error. the page url for 2nd page pagination becomes; http://www.mysite.com/category/subcat1/subcat2/page/2/ but when I try; http://www.mysite.com/category/subcat1/subcat2/?page=2 I have tried all possible codes, plugins, functions, but could not solve it. any help would be appreciated. thanks


Create subpages in default Wordpress menu

I've got this code below working to create a default menu. I was wondering how I would create sub-items/subpages...               // Check if the menu exists     $menu_exists = wp_get_nav_menu_object('Main Menu');          // If it doesn't exist, let's create it.     if( !$menu_exists){         $menu_id = wp_create_nav_menu('Main Menu');                 // Set up default menu items              wp_update_nav_menu_item($menu_id, 0, array(             'menu-item-title' =>  __('Home'),             'menu-item-type' => 'post_type',             'menu-item-object' => 'page',             'menu-item-url' => get_permalink($pageId),             'menu-item-status' => 'publish'));     }      [edit] Sorry all! I forgot to mention that I was implementing this menu on every installation of a Wordpress multisite. So when you do a new installation this default menu would already be in place.


How to fix missing function in wp-cron?

One of my sites consistently fails to publish scheduled posts. I've tried disabling plugins, using Twenty Twelve, etc. with no luck. I installed the Core Control plugin and noticed that there is no function associated with the publish_future_post hook. On my other sites, there is a hooked function check_and_publish_future_post() but it's missing on this particular site. My questions are (1) how the heck did this happen and (2) how do I fix it? I've tried a clean install of Wordpress (other than wp-content) with no change. I've reached the limit of what I'm comfortable doing without some guidance, so I'm hoping someone here can help.


Facebook Like - Display counter starting at Zero?

I got frustrated with the number of "Like" plugins available, so I went straight to Facebook for a direct implementation. I want my like button to look like how how its displayed on Techcrunch (example: http://techcrunch.com/2011/03/09/report-paypals-express-checkout- helps-bump-sales-by-18-percent/) - Notice the Facebook Like button - The word like, then a box to the right with the "like count". I've copied the code and modified it as follows:               <iframe src="http://www.facebook.com/plugins/like.php?href=<?php the_permalink(); ?>&layout=button_count&show_faces=false&width=80;&action=like&font&colorscheme=light&height=20" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:80px; height:20px;" allowTransparency="true"></iframe>      The code above displays the "Like" button, but without the counter (I want it to display, even at zero). I may be missing something simple - Any ideas?


What's the Best Way to Structure a Multi-Content Blog?

# A Little Background I've been running a blog for 4 years that discusses just about anything I feel like writing. My car, backpacking trips, my church, marketing strategy, WordPress code, movies I see on the weekend, etc. I have also been running a separate blog for a little over a year focused primarily on creative writing. I have a _third_ blog that serves as my professional portfolio. I realized the other day that this is a huge convoluted mess, and I want to clear things up. # The Problem Some people come to my main site looking for WordPress tutorials. Others come looking for spiritual essays. Others come because they can't remember the link to my portfolio and are trying to find my resume. It makes it hard to attract feed subscribers when my content seems to be all over the place, but offering category-based subscriptions feels too limiting. # Ideal Endgame What I'd love to to is build a kind of personal network of microsites. My three blogs are already a Multisite network, that's not the issue. But I think I need to split them into _more than three_ sites. Maybe one site for tech stuff, one site for religion, one site for personal stuff, one site for fiction, one for showing off my portfolio, etc. I'd also like to fully integrate my Facebook interactions and my Twitter community ... without duplicating content in multiple places (my last attempt at Twitter interaction re-created all my Tweets as custom post types within WordPress ... too much clutter). # The Question What is the best way to structure a blog network with a single author that covers so much disparate content? It needs to be as easy as breathing to move from one part of the network to another - making content discoverability high. Completely separate WP sites don't quite lend themselves to that, but spinning off categories doesn't keep the content separate enough. Should I add other domains to the mix and try to push visitors from one domain to another, or is that too much distinction between the sites? Think of CNN, where you have a landing page that mashes up everything, but iReport, the tech page, the political blogs, and local pages are almost their own websites. The interaction between Gizmodo, Lifehacker, and their other sites is also a great example of the idea I want to accomplish ... but a horrible example of the design behind it (not a fan of their new designs).


Proper use of wp_get_attachment_image?

I have two images attached to a page. One is being used as the featured image, and I want the other to automatically be displayed at the designated spot in the template (within the loop) at full size. The image I want is the first image attachment, so as I understand, I should be able to simply use:               <?php echo wp_get_attachment_image(1, 'full'); ?>       But, this is returning nothing. What am I missing?


Using next/previous_posts_link with customised search

I have a few different searches on my website:   * "Species profiles" (custom post type search)   * "Glossary" (custom post type search)   * Generic, site-wide search Currently I'm using `search.php`; `$_POST["type"]` to determine which search has been used and and `$_POST["s"]` for the query term:               <?php         if (isset($_POST["s"])) {             $search_term = $_POST["s"];         }              if (isset($_POST["type"])) {             switch ($_POST["type"]) {                 case "profile" :                     $post_type = "species";                     break;                 case "glossary" :                     $post_type = "glossary";                     break;                 default :                     $post_type = array( 'post', 'species' );                     break;             }         } else {             $post_type = array( 'post', 'species' );         }              $args = array(             's' => $search_term,             'post_type' => $post_type         );     ?>          <?php get_template_part('searchresults'); ?>      This works well enough, however when I then try to use `next_posts_link` or `previous_posts_link`, it doesn't work. The URL changes to `mywebsite.com/page/2/` and displays a `Sorry, you're looking for something that isn't here` message as per standard 404 on my site. * * * **EDIT** I've now updated my code so that it includes `$paged` as follows (I've also tried changing `get_query_var` to `'paged'` rather than `'page'` but it makes no difference):                   $paged = (get_query_var('page')) ? get_query_var('page') : 1;              $args = array(             's' => $search_term,             'post_type' => $post_type,             'paged' => $paged         );      However, the same problem is occurring. * * * Here is the code from `searchresults.php` for @MarkDuncan               <?php global $args; ?>          <?php $query = new WP_Query ( $args ); ?>          <?php if ($query->have_posts()) : ?>              <?php if ($s) : ?>
Search results for ‘<?php echo $s ?>’
         <?php else : ?>
Search results:
         <?php endif; ?>              <?php while ( $query->have_posts() ) : $query->the_post(); ?>             <div class="post" id="post-<?php the_ID(); ?>">                 <?php                     if (get_post_type() == "species") {                         get_template_part('list', 'species');                     } else {                         get_template_part('list', 'index');                     }                 ?>
         <?php endwhile; ?>
<?php next_posts_link('« Previous Entries') ?>     <?php previous_posts_link('Next Entries »') ?>
          <?php else : ?>              <?php get_template_part( 'notfound' ); ?>          <?php endif; ?>      * * * Is there a way of resolving this issue? Thanks in advance,


Custom Post Type and Labels

I was wondering if there is a way to edit the default field labels on a custom post, for example instead of the author field saying "author" have it say "keynote speaker" I found one solution listed below, but this obviously edits it across the entire backend.               add_filter( 'gettext', 'change_author_to_keynote' );     add_filter( 'ngettext', 'change_author_to_keynote' );          function change_author_to_keynote( $translated )      {           $translated = str_replace( 'Author', 'Keynote Speaker', $translated );         $translated = str_replace( 'author', 'keynote speaker', $translated );         return $translated;     }      Thanks in advance, Pete


strtotime and custom field value

I have a custom field of Due and am trying to display the date. It is stored as 20131209. I am using               <?php echo date_i18n( get_option( 'date_format' ), strtotime( $Due ) ); ?>      but it just throws out December 1, 2013


I'm trying to Add a new Buddypress menu tab and it is not showing up

question: I am trying to create a new sub nav item for the groups on buddy press I am using `bp_core_new_subnav_item` to do it and passing the `screen_function`, but the tab is not displaying on the group page Any ideas where I should be looking on this? Heres our code.               bp_core_new_nav_item( array(       'name' => 'Document List',       'slug' => 'group-document-list',       'parent_url' => $bp->loggedin_user->domain . $bp->groups->slug . '/',       'parent_slug' => $bp->groups->slug,       'screen_function' => 'group_document_list_function_to_show_screen',       'position' => 55 ) );            function group_document_list_function_to_show_screen() {             //add title and content here - last is to call the members plugin.php template        add_action( 'bp_template_title', 'group_document_list_function_to_show_screen_title' );        add_action( 'bp_template_content', 'group_document_list_function_to_show_screen_content' );        bp_core_load_template( apply_filters( 'bp_core_template_plugin', 'members/single/plugins' ) );     }     function group_document_list_function_to_show_screen_title() {         echo 'Documents for this group';     }     function group_document_list_function_to_show_screen_content() {        display_group_document_list();     }


Export posts with postmeta without ID?

I have some select posts on one database that I need to export and import into a different database. Because both databases are operating independently, there is overlap with post IDs so I can't export the ID from wp_posts. I can successfully export and import the posts, but the post meta is dropped. And, since I'm not exporting the ID, I can't export the wp_postmeta without referencing the appropriate (NEW) ID. Any ideas on how I can transfer only some posts to a different site and keep the post_meta while ditching the ID?


wordpress prevent multiple shortcodes

I created a wordpress plugin and I added shortcode feature to it. but i want to execute only one shortcode and prevent applying of multiple shortcodes if the administrator did so.


Report spam button

I can't find any plugin or script to place a "report as spam" button in my comments section. The button could simply: - open a form to report a spammy or problematic comment to the admin - send an email or store in the db the problematic comment ID ready for being checked/deleted by admin. I have a lot of comments that are not really spam, but people trying to advertise products/services where they shouldn't (akismet of course doesn't work for them). It could add an extra layer of spam fighting with the direct help of users. Any ideas on how to achieve that?


Numbering only parent comments

I am actually displaying a number beside my comments putting `$counter = 0;` before wp_list_comments in comments.php and               global $counter;     $counter++;       inside the comments callback function in functions.php Now this is working fine, but since I'm using threaded comments, my numbers are looking strange (1,4,10,14) because it's counting also the child comments. Is there a way to count only parent comments (1,2,3,4,5...)? Thanks


Linking thumbnail to full size image

I use a function in my blog (getImage) to call thumbnails in the loop (it calls the 1st image on the post) but instead of link to the post, i would want the thumbnail to link to its full image src. The function is this one:               function getImages($num) {     global $more;     $more = 1;     $link = get_permalink(); -> NO IDEA IF HAS ANY SENSE BUT I ALREADY TRIED TO CHANGE THIS ONE TO GET_ATTACHMENT BUT NO LUCK     $content = get_the_content();     $count = substr_count($content, '<img');     $start = 0;     for($i=1;$i<=$count;$i++) {     $imgBeg = strpos($content, '');     $postOutput = substr($post, 0, $imgEnd+1);     $postOutput = preg_replace('/width="([0-9]*)" height="([0-9]*)"/', '/width="150"/',$postOutput);     $postOutput = preg_replace('/alignright/', 'aligncenter',$postOutput);     $image[$i] = $postOutput;     }     if(stristr($image[$num],'<img')) { echo ''.$image[$num].""; }     $more = 0;}      Does anyone has some clue how can i do this? or other function to achieve this? Thanks


How to search for categories and/or tags?

I have a search function on my blog. If I enter a value, say 'fruits' in the search box and it doesn't match in any of the posts but it is the name of a category in the blog then I want the posts that belong to that category to be displayed. Is it possible to amend the search functionality so it covers the searching of all categories and possibly tags in the blog too? Many thanks.


WooCommerce New Order Check if Paid

I am creating a press release system, where I want to check if the new order has been paid or not, and accordingly I will set the post meta. I am using the following code, but it's not working, maybe I am using the wrong approach ?               function add_pr_to_db($order_id) {          $session = WP_Session::get_instance();     $title = $session['title'];     $desc = $session['desc'];          $new_post = array(         'post_type'     => 'press_release',         'post_title'    => $title,         'post_content'  => $desc,         'post_status'   => 'pending'     );          $prid = wp_insert_post( $new_post );          $image_url = $session['image'];     $upload_dir = wp_upload_dir();     $image_data = file_get_contents($image_url);     $filename = basename($image_url);     if(wp_mkdir_p($upload_dir['path']))         $file = $upload_dir['path'] . '/' . $filename;     else         $file = $upload_dir['basedir'] . '/' . $filename;     file_put_contents($file, $image_data);          $wp_filetype = wp_check_filetype($filename, null );     $attachment = array(         'post_mime_type' => $wp_filetype['type'],         'post_title' => sanitize_file_name($filename),         'post_content' => '',         'post_status' => 'inherit'     );     $attach_id = wp_insert_attachment( $attachment, $file, $post_id );     require_once(ABSPATH . 'wp-admin/includes/image.php');     $attach_data = wp_generate_attachment_metadata( $attach_id, $file );     wp_update_attachment_metadata( $attach_id, $attach_data );          set_post_thumbnail( $prid, $attach_id );          add_post_meta( $prid, 'order_id', $order_id );          $terms = get_the_terms( $order_id, 'order_status' );     foreach ( $terms as $term ) {         $term_name = $term->name;         if ($term_name == 'processing') {             add_post_meta( $prid, 'pay_status', 'Paid' );         } else {             add_post_meta( $prid, 'pay_status', 'Not Paid' );         }      }     }


All links in my site start with localhost?

This is my website `http://173.214.165.83/`. The home page shows, but all links start with localhost/wordpress, rather than the current address, which is 173.214.165.83. The server is windows and runs IIS 7. Wordpress is in C:\inetpub\wwwroot\wordpress. Wordpress is installed by Web Platform Installer. I'm new to IIS. How should I fix the link problem? I hope I don't have to reinstall wordpress.


Merging two wp_posts tables while avoiding duplicates

Is there a simple way to merge two wp_posts tables while avoiding duplicates?


How to display an icon when a new post is published and then remove it when a specific time past?

Every time i publish a new post i want to display an icon like a badge ( _NEW_ ) and after a specific time it will disappear. Lets say i publish a new post and i want to display that it is a new post. So i want to insert an icon that for example a star, in each new post in the blog list view into the metadata of the posts. Also i want to be removed after a specific time will pass. Lets say in one day or 24 hours the icon should be removed automatically. How can i do this?


Automatically Marquee Code scrolling with recent post title?

I want Automatically Marquee Code scrolling with recent post title in Header. any one can tell me. my marquee code
<marquee width="820">any text here </marquee>
      how i can do i. anyone can tell me? my site http://news1.techjagot.com/


Cannot find Home link in Pages on Dashboard

I cannot see the Home page link in the WordPress menus section. Here's how the Pages box look like this: ![screenshot](http://i.stack.imgur.com/PUFwN.png) How can I get the link of Home?


Codex Version Focus on Production or Nightly?

The function get_users_of_blog() is to be deprecated in WP 3.1.0 but the current production release is 3.0.5. Does it make since to have the documentation reflect a nightly change when the production version of get_users_of_blog() is still the primary function used to fetch a list of users? Or is it fine so long as the version it is deprecated is listed on the article? I reverted the page back to reflect that it was not deprecated but it was reverted quickly back to it's original state. I'm probably just missing something and was hoping someone would shed some light on this. **EDIT**   @kaiser pointed out that the codex is a wild-west of sorts, some articles are up-to-future to 3.1, up-to-date with 3.0.5, and others are very outdated. Refocusing my question, what should be the best practice for documentation on a popular framework like Wordpress that does have public nightly builds?


What are some good Apache settings to use with wordpress?

My server has 756m of RAM. Every few days I get [error] server reached MaxClients setting, consider raising the MaxClients setting


Admin Bar menu item that executes Javascript but does not reload the page?

I added a menu item to the Admin Bar that executes some Javascript to show debug information. The problem is that clicking this item also reloads the page. How can I prevent this? I was trying to speed up my debug & dev stuff and wanted to add a class to my main wrapper div using jQuery. ### Step 1: Add styles to your head               function my_admin_bar_script_def( $script ) {     $script = '         jQuery(document).ready( function() {             jQuery("li#wp-admin-bar-showdebug").click( function() {                 jQuery(".wrap").toggleClass("showdebug");             } )         } );     ';          return print $script;     }     add_action( 'wp_head', 'my_admin_bar_script_def', 11 );      ### Step 2: Add a admin bar menu item:               function my_admin_bar_class_switch() {     global $wp_admin_bar;          $wp_admin_bar->add_menu(          array(               'parent'   => 'theme_options'             ,'title'    => __( 'showdebug', TEXTDOMAIN )             ,'href'     => '' // **interesting problem over here**         )      );     }     add_action( 'admin_bar_menu', 'my_admin_bar_class_switch', 70 );      ### Problem: Every time you trigger your toggle function you'll fire up the link and reload the page. Therefore you'll get the initial trigger again. Replacing the link is not possible, because in the `$args` array for the `add_menu()` function you only define the `href` and the link will be printed anyway. Filters or hooks? Not available.


Allowing members to upload photos to their profile

I am looking for a little bit of direction. I am building a membership site that will allow the user to upload multiple photos for their profile. My question is: Is their a membership plugin that will allow them to do this. Also, this feature needs to be front end accessible. I do not want the members to ever see the back end. Thanks in advance.


Query Posts By Post Publish Date, but sort by Custom Meta Key

I'm trying to show the most popular (recent) posts on my blog. I have made a special formula for this. I am querying for these posts like so:               $args = array(     'post_type'     => 'post',     'post_status'   => 'publish',     'meta_key'      => '_post_popularity',     'meta_query'  => array(         array(             'key' => 'post_date',             'value' => date("Y-m-d H:i:s", strtotime('-30 days')),             'compare' => '>',             'type' => 'DATETIME'         )     ),     'orderby'       => 'meta_value_num',     'order'         => 'DSC');     query_posts( $args );       I don't think that is correct however, as WP is interpreting "key" as a meta_key, whereas I want to use the Publish Date in the post table. Taking out "meta_query" works fine, I can see the most popular posts, but it doesn't restrict it to the most recent ones. I check the documentation but post_date is not mentioned as a way to "filter", only sort. Is this possible? Thanks.


echo the value of a a meta select box

How can I echo the value of a meta select box into my template? Here is how I have setup my meta boxes:               // Add the Meta Box     function add_custom_meta_box() {         add_meta_box(             'custom_meta_box', // $id             'Custom Meta Box', // $title             'show_custom_meta_box', // $callback             'post', // $page             'normal', // $context             'high'); // $priority     }     add_action('add_meta_boxes', 'add_custom_meta_box');               // Field Array     $prefix = 'custom_';     $custom_meta_fields = array(         array(             'label'=> 'Map Icon',             'desc'  => 'A description for the field.',             'id'    => $prefix.'select',             'type'  => 'select',             'options' => array (                 'one' => array (                     'label' => 'Option One',                     'value' => 'http://localhost:8888/wp-content/uploads/2012/06/black_Marker.png'                 ),                 'two' => array (                     'label' => 'Option Two',                     'value' => 'two'                 ),                 'three' => array (                     'label' => 'Option Three',                     'value' => 'three'                 )             )         )     );          // The Callback     function show_custom_meta_box() {     global $custom_meta_fields, $post;     // Use nonce for verification     echo '<input type="hidden" name="custom_meta_box_nonce" value="'.wp_create_nonce(basename(__FILE__)).'" />';              // Begin the field table and loop         echo '
';         foreach ($custom_meta_fields as $field) {             // get value of this field if it exists for this post             $meta = get_post_meta($post->ID, $field['id'], true);             // begin a table row with             echo '
                     '.$field['label'].'	                     ';                     switch($field['type']) {                         // case items will go here                         // select                         case 'select':                             echo '<select name="'.$field['id'].'" id="'.$field['id'].'">';                             foreach ($field['options'] as $option) {                                 echo '<option', $meta == $option['value'] ? ' selected="selected"' : '', ' value="'.$option['value'].'">'.$option['label'].'</option>';                             }                             echo '</select>
'.$field['desc'].'';                         break;                     } //end switch             echo '
';         } // end foreach         echo '
'; // end table     }          // Save the Data     function save_custom_meta($post_id) {         global $custom_meta_fields;              // verify nonce         if (!wp_verify_nonce($_POST['custom_meta_box_nonce'], basename(__FILE__)))             return $post_id;         // check autosave         if (defined('DOING_AUTOSAVE') && DOING_AUTOSAVE)             return $post_id;         // check permissions         if ('page' == $_POST['post_type']) {             if (!current_user_can('edit_page', $post_id))                 return $post_id;             } elseif (!current_user_can('edit_post', $post_id)) {                 return $post_id;         }              // loop through fields and save the data         foreach ($custom_meta_fields as $field) {             $old = get_post_meta($post_id, $field['id'], true);             $new = $_POST[$field['id']];             if ($new && $new != $old) {                 update_post_meta($post_id, $field['id'], $new);             } elseif ('' == $new && $old) {                 delete_post_meta($post_id, $field['id'], $old);             }         } // end foreach     }     add_action('save_post', 'save_custom_meta');        Basicly I want to echo the data from the select box "Map Icon" in to here like this:               marker : new google.maps.MarkerImage('<?php echo get_custom.select(); ?>', new google.maps.Size(20, 34) )


How do I put up a splash page and have all WordPress links redirect to this page?

I would like to put up a splash page and have all site links (posts, pages, etc.) to redirect to this splash. I know there are a number of ways to create a splash (i.e. page template in WordPress and set the front page as this template or even create an index.html file at the root of my WordPress install and rename the index.php file.) What's the best way to accomplish this? Are there particular .htaccess commands that would be better option?


Set first image (external) as featured image / thumbnail

I've read through a lot of code snippets now and it seems like wether I'm to stupid or there is no solution for this. I have a setup where some information for a product is loaded via amazon API if I enter the ASIN code in a meta box when creating a post. When I save the post, the Amazon product image is automatically shown in the post. But it isn't attached to the post. It loads from the amazon site. Now I want the featured image / thumbnail be set automatically. The two options I can think of are: Option 1. When I save the post, the productimage is uploaded / attached to the post and then somehow set as featured image. or Option 2. When the post is published, it is scanned and the first element in -tags is set as featured image. I really don't know where to start here! (obviously I'm also open to other approaches) Edit: I found this code but don't know where to start with it. Does it look right to you? And where do I put it?               /** Set Featured Image **/     // required libraries for media_sideload_image          function featuredimagesetter($post_id)     {      require_once(ABSPATH . 'wp-admin/includes/file.php');      require_once(ABSPATH . 'wp-admin/includes/media.php');      require_once(ABSPATH . 'wp-admin/includes/image.php');           $post_id == how do I set this?;     $image_thumb_url == 'http://www.examplesite.com/exampleimage.jpg';          // load the image      $result = media_sideload_image($image_thumb_url, $post_id, 'image_thumbnail');           // then find the last image added to the post attachments      $attachments = get_posts(array('numberposts' => '1', 'post_parent' =>     $post_id, 'post_type' => 'attachment', 'post_mime_type' => 'image', 'order' => 'ASC'));                if(sizeof($attachments) > 0){          // set image as the post thumbnail          set_post_thumbnail($post_id, $attachments[0]->ID);      }      add_action('save_post','featuredimagesetter');     }      This might set the featured image to the image I set. But if this works I guess it won't be a big deal to set the image to a variable instead of the imagepath. But still I don't know how to set the $pot_id correctly and if the whole code should work and where I have to put it.


How to retrieve posts from parent category, splitting them per children when displayed?

I have a Wordpress database with three categories: ID 3 : Europe   ID 4 : France (child of 3)   ID 5 : Paris (child of 4) I now need to display all posts under their respective category, like this: **EUROPE**   Post 1   Post 2   Post 3 **FRANCE**   Post 1   Post 3 **PARIS**   Post 3   * Post 1 was published under France   * Post 2 was published under Europe   * Post 3 was published under Paris Can you please confirm I am doing it right like this?               <?php         $args = array('cat' => 3);         $category_posts = new WP_Query($args);     ?>               <?php         while($category_posts->have_posts()) : $category_posts->the_post();             the_title("
");         endwhile;     ?>                         <?php         while($category_posts->have_posts()) : $category_posts->the_post();             if (strpos(get_the_category()[0]->cat_name,'France') !== false)                 the_title("
");         endwhile;     ?>               <?php         while($category_posts->have_posts()) : $category_posts->the_post();             if (strpos(get_the_category()[0]->cat_name,'Paris') !== false)                 the_title("
");         endwhile;     ?>                  * HTML formatting omitted from above code. In poor words, I am calling WP_Query only once and then I loop, checking for the category name "France" and "Paris" for the France and Paris blocks. Is there a better way to do it? Would I cause any performance issues if I call WP_Query three times instead? Thank you!


wp_verify_nonce not working

I'm working on an ajax request, I have several ajax requests on my functions.php. And all are working, but this: On my php I have this:               add_action("wp_ajax_fb_points", "get_fb_points");     add_action("wp_ajax_nopriv_fb_points", "get_fb_points");          function get_fb_points(){         if ( !wp_verify_nonce($_REQUEST['nonce'], 'fb_points_nonce')) {             exit('No naughty business');         }         echo 'yeah';         die();     }      On the footer.php I have this:               FB.Event.subscribe('edge.create',         function(response) {             if(response == '<?php echo get_facebook_profile('link'); ?>') {                 $.ajax({                     url: '<?php echo admin_url('admin-ajax.php'); ?>',                     data: { action: 'fb_points', challenge : 2, nonce : '<?php echo wp_create_nonce('fb_points_nonce'); ?>' },                     async: false,                     success: function(data){                         console.log(data);                     }                 });             }         }     );      But I don't know why it isn't working the request response is "No naugty business". Can anyone help me to find out what is wrong?


Check if a class exists within a method

I'm new to OOP and I'm writing my first plugin. I want to check if the Facebook plugin has already been activated. If so, I want to skip some code:               class MyClass {     ...         function fb_js_sdk_setup() {             // Check if Facebook plugin is activated              if ( class_exists( 'Facebook_WP' ) )                 return;             // Continue if Facebook plugin is not active             ...         }          }      My `if (class_exists())` statement isn't working. Appreciate any advice and pointers. Thanks!


Wordpress get from single.php back to the right category page

in my **single.php** i have a link back to the category: `$category_id = get_the_category(); $category_link = get_category_link( $category_id[0]->cat_ID );` If i am now coming from **page 2** to the single, is there a way to go directly back to the second page? * * * Edit is there a better way than using the js `history.back()` method?


Force Users To Relogin

I need a solution that i can use to force a user to logout via the admin panel of word press any help on this would be appreciated.


Display an author's posts on his own author page

I have a blog that publish articles of any philosophers.Each philosopher has a special page that includes information about him. I've created a post type called _philosopher_. I want to display the title of each philosopher's articles under his page, but because every philosopher has many articles, I only want to display 10 articles and show the other articles on another page.


get_the_terms - but only show 4 Posts

I am using this code to load related posts with a custom taxonomy term slug:               <?php     global $post;     $terms = get_the_terms( $post->ID , 'topics', 'string');     $do_not_duplicate[] = $post->ID;          if(!empty($terms)){         foreach ($terms as $term) {             query_posts( array(             'topics' => $term->slug,             'showposts' => 4,             'caller_get_posts' => 1,             'post__not_in' => $do_not_duplicate ) );             if(have_posts()){                 while ( have_posts() ) : the_post(); $do_not_duplicate[] = $post->ID; ?>      But I always get more than 4 posts. How can I really set this query to just 4 posts? Thanks! AD


Create a registration form with a PayPal checkout fee?

My client is looking to start taking online registration for their many conventions and events. Previously they handled this all offline with PDF documents and in person payment. I'm looking for either a plugin or a detailed FAQ that will help me integrate an online registration plus payment system into their Wordpress site. I'm open to both free and paid services. Any and all help will be greatly appreciated. On a related note (just for some background on the scope of the project), ideally the user would have their own account on the Wordpress site. And they would register for one or multiple events at any given time throughout the year. This may or may not be difficult to implement. It's something they'd like to have, but if it's too hard I think we might just go without it. Thank you!


how to include page content to specified length & then "read more" link

I'm pretty new to WP, so please forgive any stupid questions and/or coding! I'm using the following code in my index.php file to include content from another page:
                 <?php                  $page = get_page_by_title('Today\'s Menu');                  $content = apply_filters('the_content', $page->post_content);                  echo $content.'ID).'">more>...';;                 ?>
      It's working fine, but I'd like to truncate the content to say, 100 chars and include 'read more' at the bottom. I've tried using excerpt rather than content, but I need the html tags/formatting to be included. I also can't use the quicktag `<\--!more-->` on the 'Today's Menu' page as the site is going to be updated by various people who may not regularly use the internet and so are unlikely to be familiar with WP and its workings. Specific assistance would be much appreciated as I'm quite new to WP! MTIA.


Magic Fields 2 custom post type disappeared

You can see the highlighted custom post type `'Learning Civilization'`, but it seems to have disappeared from the magic fields menu. I have uninstalled and re-installed the plugin, thinking it was a glitch, but the settings remain the same. ![enter image description here](http://i.stack.imgur.com/kz75B.png) Anyone run into this issue?


wp set object terms vs wp set post terms

Examining the following sample code snippet from the WP codex,               $post = array(       'ID' => [ <post id> ] //Are you updating an existing post?       'post_author' => [ <user ID> ] //The user ID number of the author.       'post_category' => [ array(<category id>, <...>) ] //Add some categories.       'post_content' => [ <the text of the post> ] //The full text of the post.       'post_date' => [ Y-m-d H:i:s ] //The time post was made.       'post_title' => [ <the title> ] //The title of your post.       'post_type' => 'post'       'tags_input' => [ '<tag>, <tag>, <...>' ] //For tags.       'tax_input' => [ array( 'taxonomy_name' => array( 'term', 'term2', 'term3' ) )      );        I see that only the categories take their input by IDs. For some reason, ( which I'd like to know the history behind it as to why), tags and custom taxonomies takes their input differently. Here, we are looking at 3 different ways to set the taxonomy terms; For cats, use               'post_category' => [ array(<category id>, <...>) ]      for tags, use,               'tags_input' => [ '<tag>, <tag>, <...>' ]      and finally for CT's, use               'tax_input' => [ array( 'taxonomy_name' => array( 'term', 'term2', 'term3' ) )       With this 3 different ways, I think things are getting complicated. It's not that it cannot be done but programmatically, it seems more complicated than it should be. I thought why don't I just use the Uncategorized Cat ID of 1 here ( within the post wp_insert_post ) just to get the post in, and then take care of the proper cats , tags and custom taxonomies, all using the same function call. With that in mind, I have 2 choices; `wp set object terms` and `wp set post terms` I'd like to know if one is better than the other and why we have two different but very similar ( almost like a subset vs superset ) type situation here. Which one is recommended to use when managing thousands of posts, and cats, tags programmatically - especially in a migration phase?


Wordpress -> PHPBB look a like

I want to create an online forum. From my server settings I have two option of smf and phpbb. I hate both of them!. Is there any solution to turn the wordpress to a full blown online forum?


Use get_posts() with 'post' and 'page' queries at the same time?

I'm trying to grab all posts which are 'posts' and not in category '3' and '5' and which aren't 'pages'. Is this possible to do using one single `get_posts()`? Because I'm querying both actual posts and pages at the same time...


Remove attachment fields from custom media uploader

I've got a custom media uploader setup and trying to remove attachment fields from only this uploader, while leaving the fields intact for the default WP post/page media uploader. Everything works great except getting the fields to be excluded behaves oddly. Here's a bit of code on how it works: First, open uploader thickbox with this js `tb_show(box_title, 'media- upload.php?post_id=0&custom_uploader=1&TB_iframe=1' );` Next, add the custom_uploader value to the form action URL               function upload_request_hook( $form_action_url, $type ) {         $form_action_url = $form_action_url . '&custom_uploader=1';              return $form_action_url;     }      The iframe url for my custom uploader now looks like: `media- upload.php?type=image&tab=type&post_id=0&custom_uploader=1` and the form action is something of the same. So it's all good there. For testing purposes, I'm removing all attachment fields               function image_attachment_settings( $form_fields, $post ) {         unset( $form_fields );              return $form_fields;     }      Then adding the filter and action:               function image_upload_options() {         add_filter( 'media_upload_form_url', 'upload_request_hook', 10, 2 );     }          if ( isset( $_GET['custom_uploader'] ) || isset( $_POST['custom_uploader'] ) ) {         add_action( 'admin_init', 'image_upload_options' );     }      So I'm trying to use the `if ( isset( $_GET['custom_uploader'] ) || isset( $_POST['custom_uploader'] ) )` to only apply the filter/action for my custom uploader, based on the form action. But here is the first odd bit. It works how I'm expecting if I use the HTML upload method. If I use the Flash uploader, none of the fields are removed. And the second odd bit ... If I remove the IF statement, where it basically removse the attachment fields for every upload type (custom and default WP), it works with both the flash and HTML uploader. But thats defeating the purpose. The question here is; what can I setup here to exclude the attachment fields for only the custom uploader, where it works with the Flash and HTML uploader? Any type of IF statement to apply? Any other hooks I could setup or latch on to? Appreciate any help that could be given here. Thanks!


How to show private flickr group on a Wordpress site?

I have been trying to embed a flickr group within a Wordpress site for our camera club using a plugin such as slicker flickr or awesome flickr gallery. I have no problems with showing a set of thumbnails of my own photo stream, galleries, sets, or of a group I am a member of. However, I cannot seem to display the originally private flickr group, changed to a public flickr group, that I am an admin for. Any help appreciated.


Custom Post Type URL Rewriting?

I setup a custom post type for my portfolio projects. The main URL for this is located at /projects/ Now I've also setup my blog posts permalink to /articles/*/ for the permalink structure. This means when I go to view a portfolio project the URL changes to /articles/projects/project-name/ I know there must be a way to rewrite permalinks ONLY for my projects custom post type. But I'm unfamiliar with the syntax in declaring the URL slug - would appreciate any help I can get!


Detect where custom post type is declared

In a plugin that I'm developing I'd like to be able to display a list of all custom post types currently enabled. Is there any way to detect where a post type has been initiated? For example, if it was created by a plugin, is there a way to detect that and then report the plugin or file where it was initiated?


Include custom fields into the content of a regular page

Here's my setup:   * Parent "Gallery" page: _regular page, not custom type or anything _   * Several "Project" child pages (could be as few as 1, unlimited   number): _also normal pages_ Child pages will either have meta boxes or custom fields for entering stuff into my pre-formatted areas. I don't care if it's meta boxes or custom fields, whatever is figure-outable! I'm using standard WP-provided code to show Child page titles and `the_content` on the Parent page.                   <?php         $mypages = get_pages( array( 'child_of' => $post->ID, 'sort_column' => 'post_date', 'sort_order' => 'desc' ) );              foreach( $mypages as $page ) {         $content = $page->post_content;         if ( ! $content ) // Check for empty page         continue;              $content = apply_filters( 'the_content', $content );     ?>

                                          <?php echo $content; ?>
                 Click to enlarge and view project gallery

<?php echo $page->post_title; ?>

Goal: <?php echo get_post_meta($post->ID, 'ecpt_goal', false); ?>

Challenge: <?php echo $ecpt_challenge; ?>

Solution: <?php echo $ecpt_solution; ?>

Results: <?php echo $ecpt_results; ?>

                       <?php     }        ?>      None of the custom areas are showing up on the Parent page. I have no idea how to filter them, and _ideally_ would like to include the custom fields OR metaboxes into `the_content`.
Goal: <?php echo get_post_meta($post->ID, 'ecpt_goal', false); ?>

Challenge: <?php echo $ecpt_challenge; ?>
      Both of these lines work to pull the meta box info into the individual Child page, not sure what the difference is, including just for reference. Alternatively, if you know how to include custom fields into the_content, here's what I'm using with ACF:
<?php the_field(client_title_1); ?>
     Goal: <?php the_field(goal_1); ?>     Challenge: <?php the_field(challenge_1); ?>      ETC. Thank you very much in advance! EDITED TO ADD: Is there a way to add my custom meta boxes or fields to the default set so they would automatically be included into `the_content` without filters and hooks?


install.php Custom Taxonomy Term not being added to custom post

So I am stuck on this problem that I am facing when creating a custom taxonomy term in a install.php file. So I am running a WP multisite, and upon new blog creations, I am trying to auto create posts and taxonomy terms. The taxonomy and CPT are already created via a plugin that is Network Activated. Here is a snippet of what is inside the install.php file:                   // Sample Category         $cat_name = __('Sample Category');         /* translators: Default category slug */         $cat_slug = sanitize_title(_x('Sample Category', 'Default category slug'));              if ( global_terms_enabled() ) {             $cat_id = $wpdb->get_var( $wpdb->prepare( "SELECT cat_ID FROM {$wpdb->sitecategories} WHERE category_nicename = %s", $cat_slug ) );             if ( $cat_id == null ) {                 $wpdb->insert( $wpdb->sitecategories, array('cat_ID' => 0, 'cat_name' => $cat_name, 'category_nicename' => $cat_slug, 'last_updated' => current_time('mysql', true)) );                 $cat_id = $wpdb->insert_id;             }             update_option('example_product_cat', $cat_id);         } else {             $cat_id = 99;         }              // Sample Post         $now = date('Y-m-d H:i:s');         $now_gmt = gmdate('Y-m-d H:i:s');         $post_guid = get_option('home') . '/sample';              $wpdb->insert( $wpdb->posts, array(                                     'post_author' => $user_id,                                     'post_date' => $now,                                     'post_date_gmt' => $now_gmt,                                     'post_content' => '',                                     'post_excerpt' => 'Sample Text Excerpt ',                                     'post_title' => __('Sample Name'),                                     /* translators: Default post slug */                                     'post_name' => sanitize_title( _x('sample-name', 'Sample Name') ),                                     'post_modified' => $now,                                     'post_modified_gmt' => $now_gmt,                                     'guid' => $post_guid,                                     'post_type' => 'custom_post_type',                                     'comment_count' => 0,                                     'to_ping' => '',                                     'pinged' => '',                                     'post_content_filtered' => ''                                     ));         $wpdb->insert( $wpdb->postmeta, array( 'post_id' => 4, 'meta_key' => '_sample_meta', 'meta_value' => '19' ) );       $wpdb->insert( $wpdb->term_relationships, array( 'term_id' => 99, 'object_id' => 1) );      So the Taxonomy term is created, and so is the post, which both are viewable in the backend. The problem is, the term is not connected to the post that is created The meta_value does not also display on the WP_List_Table, but displays on the update post page. When I click "update post", than it shows on the WP_List_table. Is there any clue on why the taxonomy term is not added to the post, and also why the meta_value displays in the Update Post page, but not on the WP_List_Table? Thanks! Roc.


Error : "Language is already enabled or invalid! " in wordpress plugin qTranslate

When trying to enable newly added language in **qTranslate Configuration ** I get a message **Language is already enabled or invalid!** All the languages that come with qTranslate are ok. Wordpress 3.13 Any ideas? thanx


File Not Found, Nginx + Multisite Subdomain

Here is my configuration http://paste.ubuntu.com/6392996/ (domain name have been replaced). I currently have some files uploaded to `wp- content/blogs/dir/3/files/2013/11/`, where 3 is the Blog ID of my site. I can view the file using `http://example.com/wp-content/blogs/dir/3/files/2013/11/filename.mp4`, but not `http://training.example.com/files/2013/11/filename.mp4`


How important are WordPress tags for SEO purposes?

Am I missing out SEO-wise by not including any tags in general when I write posts on my blog? How do they help a site rank better?


How to display lastest post date in the homepage?

I'm looking forward to display, somewhere in the homepage of a WP site, a legend saying: > **Last updated:** XX/XX by grabbing the date from the most recent post, but not showing any of its content, just the date. Is there any quick way to do this?


Using JQuery to check for Rel Attribute of Image before Overriding It

My Wordpress theme (when enabled) overrides the rel value of the link of all images with rel="lightbox" using the following code: http://pastebin.com/Bsh739QY How can I edit the JQuery to check for the rel value first? If the rel value is already set to "lightbox[xyz123]" or "lightbox[xyz-123|abc]" or "lightbox", then the rel value will not be over-written. Thanks!


Woocommerce shipping plugin: create checkout error based on validation

I'm writing a shipping plugin for Wordpress and I need the ability to display an error to the user and disable the checkout process based on the results of custom validation. I've been using the sample shipping method here as a basis for the plugin: http://docs.woothemes.com/document/shipping-method-api/ I'm not sure how to add a validation check that would be able to accomplish all that.


Custom Post Type Order Index Loop

I have created a custom post type called 'events'. On the index page, I want to amend the loop to list all posts (standard and events). However, I want to order standard posts by the date it was posted, and I want to order events by a custom field which contains the date of the event. Example:               Standard Post  (Posted on 12th May 2014)     Standard Post  (Posted on 11th May 2014)     Event Post     (10th May 2014)     Standard Post  (Posted on 9th May 2014)     Event Post     (8th May 2014)     Event Post     (7th May 2014)     Standard Post  (Posted on 6th May 2014)      I have added these parameters for query_post on the index.php               <?php        query_posts( array(          'post_type'   => array( 'events', 'post'),         'meta_key'    => 'date_of_event',         'orderby'     => 'meta_value',         'order'       => 'asc',         'meta_query'  => array(             'key'     => 'date_of_event',             'value'   => date("Ymd"),             'compare' => '>=',                       'type'    => 'DATE'                    )         )       );     ?>      At the moment I only have events being returned


Clean URL link for page without number

This is probably a really noob question, but I can't figure out how to change it. I've created a page called "Photos" and my url link shows:               http://mysite.com/photo-7/      What's with the **-7** and how do I remove this so it is just _photo_?


Pull in custom content types into page template

I've looked everywhere for a solution, but have yet to find one. Here is the situation. I've created a custom content type using the plugin `Custom Content Type Manager` and now have need to use these custom post types within pages that I've created in WP. So I created a page called "Photos" and use a template php file to configure the layout / styles of the page. The plugin generated a sample template for me in order to get the custom fields that I've put in. It looks something like this:               get_header(); ?>     <?php if ( have_posts() ) while ( have_posts() ) : the_post(); ?>
<?php the_title(); ?>
             <?php the_content(); ?>             <?php the_author(); ?>
Custom Fields
               Image: <?php list($src, $w, $h) = get_custom_field('image:to_image_array');?>                  <img src="<?php print $src; ?>" height="<?php print $h; ?>" width="<?php print $w ?>" />
          <?php endwhile; // end of the loop. ?>      **The Problem:** When I use "the_content();" and the other php methods, they pull the content from the page called "Photos", and not the content from the custom content type created with this plugin. Is there something I can override / rewrite so that the_content(); from the custom content type shows up instead of the pages' content? Is there a better way I should be doing this other than creating WP pages and using custom templates? I am fairly new to this whole WP programming business..


Update content of multiple pages/posts at once?

Is this possible? using shortcodes? Custom post type? Custom Fields? CSV upload? Unique content per page. Do not need to create new pages, Just update body of them. Seems like a tough one? Also can this be scheduled. * * * Specifically there are a dozen Horoscope pages, with a paragraph of text. I'd like to update each Horoscope paragraph (replace) with new text daily but leave page intact. Also would be great to schedule these updates.


Single reusable value for post meta: Custom Taxonomy or Post Meta?

Suppose I have a post meta like "Region" it will contain values like "Region 1", "Region 2" etc. But it should only contain ONE value. Also I would like it to have an archive page. If I use custom taxonomy, users can select more than 1 value. Is it possible to have a drop down type selection instead?


Make view count for pop up post

I'm using SimpleModal to allow users to click on a post excerpt on my homepage and popup a box showing the full post. However it doesn't count for an actual view of the post when this happens. Is there a way to make wordpress recognize it as a view? I'm using wp-postviews to track view counts.


Unable to upload data to Media Libary

I uploaded wordpress to my server. Everything works fine so far. But when I try to upload data to my media libary nothing happens. Doesn't matter if I click the "Select Files" or "browser uploader" just nothing happens. I never had those kind of problems before. The permission for the wp-content/uploads/ folder is on 777. I have absolutely no conclusion what could be the problem here? Any suggestions? Regards, Nils


How to split <p> text text text </p> into array

I like to output and style in a shortcode, but the content that is get is the content of a page, so it's style like that
2012-12-12

2012-6-23

2012-7-3
      i like to be able to have ONLY the value date in a array to be able to output it in a unorder list after how do i do that (strip the p and get it into an array ? some code :               //Add a SHORTCODE to get date listing     add_shortcode ('getdate','get_date_listing');        function get_date_listing ($att) {            $req_id = 901;            $post = get_page($req_id);             $content = apply_filters('the_content', $post->post_content);                 $contentarray = explode( '\n', $content );            echo ($contentarray[0]);            //var_dump ($contentarray);            //return $content;        }


My custom query not detecting the correct category

For category.php my custom query code isn't displaying the posts from the correct category. I have a parent category called 'Blog' and it can have any number of unknown children. With that in mind I'm trying to automate my loop so it can detect the category and display just the articles for that category (even though the name of which is unknown).

                  <?php             global $paged;             global $post;             $do_not_duplicate = array();             $categories = get_the_category();             $category = $categories[0];             $cat_ID = $category->cat_ID;             $myposts = get_posts('category='.$cat_ID.'&paged='.$paged);             $do_not_duplicate[] = $post->ID;             $c = 0;             ?>                  <?php foreach($myposts as $post) : setup_postdata($post); $c++;                 if( $c % 2 == 0) {                     $style = 'even animated fadeIn';                     $c = 0;                 }                 else $style='animated fadeIn'; ?>                      <article id="post-<?php the_ID(); ?>" <?php post_class($style) ?>>                         <a class="article-block" href="<?php the_permalink(); ?>">                         <?php if ( has_post_thumbnail() ) { ?>
                             <?php $category = get_the_category(); echo $category[1]->cat_name;?>

                                             Read more

                                                               <?php the_post_thumbnail('full'); ?>
                         <?php } ?>

<?php the_title(); ?>
                             <?php the_content('Read more'); ?>

                  <?php endforeach; ?>

Loading Posts...
                 <button class="load-more button">Load More</button>


Trying to wrap <span> around first word of multiple word strings with a widget_title() filter, only works on two word strings and not more than two

I am trying to wrap a around the first word of multiple word widget titles. I have used the answer from here: http://stackoverflow.com/questions/10263792/revised-wordpress-function-to-put- a-span-around-the-first-word-of-the-title and adjusted it to look like:               function add_label_to_post_title( $title = '' ) {         $ARR_title = explode(" ", $title);              if(sizeof($ARR_title) > 1 ) {             $first_word = "".$ARR_title['0']." ";             unset($ARR_title['0']);             return $first_word. implode(" ", $ARR_title);         } else {             return $title;         }     }          add_filter( 'widget_title', 'add_label_to_post_title' );     add_filter( 'the_title', 'add_label_to_post_title' );      and it works great on two word titles. However 3 or more word titles are not affected. I tried modifying the code with:               preg_replace('/(?<=\>)\b\w*\b|^\w*\b/', '$0', $string);      from here: http://stackoverflow.com/questions/10833435/wrap-b-tag-around-first-word-of- string-with-preg-replace and had the same result, works great on two word titles but three or more are not affected. Does anyone have any idea why? I am also using this for:               the_title();      And it works xactly as expected. Also if I use:               echo add_label_to_post_title('any multiple word string with more than two words');      it also works exactly as expected. I tried using:               add_filter('widget_title', my_title);          function my_title($title) {     // Cut the title to 2 parts     $title_parts = explode(' ', $title, 2);          // Throw first word inside a span     $title = ''.$title_parts[0].'';          // Add the remaining words if any     if(isset($title_parts[1]))         $title .= ' '.$title_parts[1];          return $title;     }      from Insert a span inside widget title to give a different color to the second word and I had the same result, it worked for up to 2 word strings but 3 or more words it does not work. Does any one know what it is about the:               widget_title();      that is making this function act funny?


Is that possible put a whole POST in a list ,<li>

I want a whole post content into a list. The result i want like this:

the fist Post

the second Post

the third Post

      I try several times, just doesn't work. here is my php for get posts:               <?php if (have_posts()) : while (have_posts()) : the_post(); ?>         <div <?php post_class() ?> id="post-<?php the_ID(); ?>">
<a href="<?php the_permalink() ?>"><?php the_title(); ?>

                 <?php the_content(); ?>

                 <?php the_tags('Tags: ', ', ', '
'); ?>                 Posted in <?php the_category(', ') ?> |                  <?php comments_popup_link('No Comments »', '1 Comment »', '% Comments »'); ?>

     <?php endwhile; ?>     <?php else : ?>
Not Found
     <?php endif; ?>      Thanks a lot :)


SSL not working for checkout

i configured an ssl certificate (geotrust through namecheap) for apache on amazon ec2 following instructions at http://splittingelectrons.wordpress.com/2012/02/24/how-to-configure-an-ssl- certificate-for-apache-on-amazon-ec2/ , but then when i try to access the checkout page (the only page that's set up to have https), the page simply says "This webpage is not available" (we are using woocommerce). the rest of the site navigates fine, it's just when i try to go to the checkout page that nothing is loading. any help would be much appreciated!


Is there a way to force Featured image to show as attachement?

When adding an image as a featured image to a post - if the image is an existing image in the Media Library, then the image is not added as a true attachment but as a thumbnail, shown like this in the JSON feed:               "attachments": [],     "comment_count": 1,     "comment_status": "open",     "thumbnail": "http://sitename.com/wp-content/uploads/image.png"      but if the image is not added from the Library, but uploaded then it is added as an attachment and a thumbnail - shown like this:               "attachments": [                     {                         "id": 8,                         "url": "http://sitename.com/wp-content/uploads/image.png",                         "slug": "evac",                         "title": "evac",                         "description": "",                         "caption": "",                         "parent": 1,                         "mime_type": "image/jpeg",                         "images": {                             "full": {                                 "url": "http://sitename.com/wp-content/uploads/image.png",                                 "width": 1280,                                 "height": 720                             },                             "thumbnail": {                                 "url": "http://sitename.com/wp-content/uploads/image-150x150.png",                                 "width": 150,                                 "height": 150                             },                             "medium": {                                 "url": "http://sitename.com/wp-content/uploads/image-300x168.png",                                 "width": 300,                                 "height": 168                             },                             "large": {                                 "url": "http://sitename.com/wp-content/uploads/image-1024x576.png",                                 "width": 625,                                 "height": 351                             },                             "post-thumbnail": {                                 "url": "http://sitename.com/wp-content/uploads/image-624x351.png",                                 "width": 624,                                 "height": 351                             }                         }                     }                 ],     "comment_count": 1,     "comment_status": "open",     "thumbnail": "http://sitename.com/wp-content/uploads/image-624x351.png"      Any suggestions why this would be and if there is a solution to have the feature image shown the same way in either circumstance? This is a clean install, and the only plugin i am using is the JSON API plugin. **Edit:** Also noticed that when selecting a post Featured image that is already loaded into the Media Library, that image show "Unattached" in the "Uploaded to" column in the Media Library - I think this is where the discrepancy starts. Whereas when uploading it, it shows it being attached to that specific post.