Previous/Next Link by Meta Value in CPT

I'm using the following code to paginate between custom post types and it doesn't seem to be using the meta_key or meta_value_num and I can't figure out why. The CPT is set-up to have hierarchal => true and the Capability type is a page. This is the code I'm using for paging (which doesn't seem to make a difference --I tried using orderby=menu_order and that didn't work either).               <?php if     (get_adjacent_post(false, '', true))     {  echo previous_post_link('%link' , '');  }     else     { echo previous_post_link('%link' , '');     $newest_post = get_posts('post_type=employee-bios&posts_per_page=1&order=DESC&meta_key=display-order&orderby=meta_value_num');  $newest_post_id = $newest_post[0]->ID;     echo '     '; }      ?>          <?php if     (get_adjacent_post(false, '', false))         {  echo next_post_link('%link' , ''); }     else         { echo ''; $eldest_post = get_posts('post_type=employee-bios&posts_per_page=1&order=ASC&meta_key=display-order&orderby=meta_value_num');  $eldest_post_id = $eldest_post[0]->ID;     echo ''; } ;      ?>      And this is my WP_Query (which doesn't seem to matter in the scheme of things either--I'd started off just using while have posts and when that didn't work, I tried the WP_Query)               <?php     $paged = get_query_var( 'paged' ) ? get_query_var( 'paged' ) : 1;     $args = array(         'post_type' => 'employee-bios',         'posts_per_page' => 1,         'orderby' => meta_value_num,         'meta_key' => 'display-order',         'order' => 'ASC',         'paged' => $paged     );     $my_query = new WP_Query( $args );     ?>      My client wants to be able to select the order of the employee bios on a landing page and they should paginate in the order they've been placed on the landing page (which is why I tried using both menu_order and a custom field meta value for sorting). I've also tried changing the Capability type from page to post and that doesn't seem to make a difference either. Any help would be much appreciated. Thanks!


Show featured image in sidebar

I'm adding a widget on my sidebar but the Featured Image isn't shown. this is the code of my side bar:               <?php     /**      * The Sidebar containing the main widget areas.      *      * @package PowerMag      * @since PowerMag 1.0      */     ?>         <div id="sidebar" <?php if ( of_get_option('pm_sidebar_position') == 'sidebar-content' ) { echo 'class="span4"'; } ?> >
                  <?php do_action( 'before_sidebar' ); ?>                           <?php                           //Select wich sidebar will be display                     $selected_sidebar_replacement = 'sidebar-1'; //Default Sidebar                          //If is page or single.                     if(is_singular()){                              global $wp_query;                         $post = $wp_query->get_queried_object();                         $selected_sidebar_replacement = get_post_meta($post->ID, 'sbg_selected_sidebar_replacement', true);                              //If default selected                         if($selected_sidebar_replacement == '0' || $selected_sidebar_replacement == ''){                             $selected_sidebar_replacement = 'sidebar-1';                         }                              // Reset the global $the_post as this query will have stomped on it                         wp_reset_query();                          }                                 if (function_exists('dynamic_sidebar') && dynamic_sidebar($selected_sidebar_replacement)) : else : ?>
You selected an empty sidebar, try populating it with some awesome widgets!
                      <?php endif; // end sidebar widget area ?>


Wordpress updater conflict

I have created a theme named "landscape" and it's still on version 1.0 but I am getting notified in wordpress updates dashboad that there is a new version 1.0.3 If I click on update the free theme on wordpress theme directory overwrite my own theme. I don't understand this conflict .. I renamed the theme in style.css but I am still encountering the same issue. Please help.I don't want to rename the folder name of the theme. is there a way to prevent the updates from wordpress.org api? Thank You


Remove duplicate attachments

Here is the situation: I have an automated script that upload attachments and link each attachment to a specific post. By mistake, the script run multiple times and I have the following   1. More than one attachment post in the Media library for a single file (the different attachment posts have the same File URL).   2. One of these attachment is actually attached to the post. What I want to do is obviously is clean up the media library. I need to remove the attachment post without removing the file, and also make sure that I don't remove the ones that are actually attached to their posts. Any ideas?


3.9 Galleries & Thumbnails

I'm using WP 3.9.1 and have added a gallery (Add Media ->Create Gallery -> pick images -> Gallery Settings: Link to Media File.) That works, almost. The problem is that I need the gallery to use the custom size thumbnails I specified in my functions file. So I go into the text editor and change the gallery shortcode from               [gallery link="file" ids="672,540,537,556,557,541,558,535,555"]      to               [gallery size="thumbnail" link="file" ids="672,540,537,556,557,541,558,535,555"]      Adding the "size=thumbnail" works. However, it is not easy to do from the Media Manager / Gallery Editor. Am I missing something? I can't ask a client to remember to add this everytime. And what's worse is that any time you ADD photos (or otherwise edit the gallery), you have to switch to the Visual editor to make changes and when you click Update Gallery, it overwrites the "size=thumbnail" that was added. Is there a snippet of code I can add to my functions file to force the size?


Per theme plugins?

I'm building a plugin that heavily modifies the commenting section of a blog page. It think that I cannot do this in a way that works with all themes — some CSS has to be tweaked, depending on the particular theme in use. I'd guess that in the future, the plugin will also store some data in the database. So I suppose it should be a plugin, not a theme. (?) Hence these questions:   1. Is it possible to in some way indicate that a plugin works with only this and that theme?   2. And then release some fairly simlar versions of the plugin, each version tweaked for a specific group of themes?   3. Or are plugins supposed to work well with... all themes in existance?   4. Can you think of some solution other than per-theme-plugins and/or forking-and-modifing-existing-themes? Perhaps child themes? But, no, then it would not be possible for users-of-my-child-theme to create their own child themes?


wordpress permalinks tweeks

I am getting following permalink structure after creating any post... http://domain.com/wp/postname As per Permalink Settings.... Post name: http://domain.com/wp/sample-post/ This permalink is fine for pages, but how can i add blog as prefix like following.... http://domain.com/wp/ **blog** /postname http://domain.com/wp/ **blog** /category/postname Let me know if you need more information Please help, thanks.


Get current logged in user under 3.1, re: remove "Howdy"

I use this in functions.php to change "howdy" to "Logged in as...." But now under 3.1 I get "Logged in as Your Profile" rather than "Logged in as `<current user>`" What needs to be changed so that "user" below (commented below as `//get current user?)` returns the current user in 3.1?               if (is_admin()) {         add_action('init', 'better_howdy_h');         add_action('admin_footer', 'better_howdy_f');              function better_howdy_h() {             wp_enqueue_script('jquery');         }              function better_howdy_f() {     ?>     <script type="text/javascript">     /* <![CDATA[ */         var user = jQuery('#user_info p a:first').text();         var howdy = jQuery('#user_info p')             .html()             .replace(/<.+>/ig,'')             .replace(/\ \|\n/ig,'');         jQuery('#user_info p')             .html(                 jQuery('#user_info p')                     .html()                     .replace(user,'My Profile')             .replace(howdy,'Logged in as ' + user + ' | ') //get current user?                     .replace('!',' |')                     .replace('| |','|')             );     /* ]]> */     </script>     <?php          }      }


register_sidebar ignores 'id' and 'class'

I am using the following to register a widget area:               if ( function_exists('register_sidebar') )         register_sidebar( array(         'name' => __( 'Footer Widgets', 'hex'),         'id' => 'footer-widgets',         'class' => 'footer-widgets',         'description' => __( 'Widgets will appear in the blog, between the end of content and footer', 'hex' ),         'before_widget' => '
',         'after_widget' => '
',         'before_title' => '
',         'after_title' => '
'     ) );      And both `id` and `class` are ignored, what I get is only the widgets themselves - the top element in the widget area is the `<li>` I know I can simply wrap it in the `index.php`, where the widgets show, with a div, but isn't this suppose to do it?


Which files can be replaced in a child theme?

I have a website which is using a child theme of Twenty Twelve.   As part of the design process, I had to edit `/twentytwelve/css/ie.css`. Is it possible to save this file in my child theme, and keep twentytwelve's version as it was by default? This would ensure if Twenty Twelve is ever updated, I won't lose the changes I made to `/twentytwelve/css/ie.css`.


I'm having several WP issues, especially with missing images

My site is at http://www.aviewtoathrill.net. I have deactivated all of my plugins in the hopes of getting my images to show up on the site. Since it is a travel site, images are crucial. I think the problem began when I installed w3 total cache because the site was very slow. That plugin caused me to have lots of problems with redirection. I installed disable canonical url plugin which helped temporarily until the whole site crashed. I uninstalled both of those plugins. Also, I switched hosts from fatcow to stablehost, so I'm not sure if that may have affected things. Additionally, I upgraded my wordpress from 2.9 to 3.1. Secondly, I realize with all of my images, I need external storage. I have started an amazon s3 and cloudfront account. However, I can't figure out how to transfer the files/folders. Please feel free to ask for clarification. I'm sure it sounds like I'm rambling, I just want to find someone who can fix my problem completely for once and for all. Oh, I just reinstalled my broken links plugin and it says that 534 image links are broken....just thought that I would add that. Thank you! Renee


wp_list_categories link to first post of category instead of calling taxonomy template

I'm using wp_list_categories to give me a list of links to categories (no surprise there) Is it possible to get Wordpress to link to the first post of a given category instead of calling the taxonomy template which displays links to all posts in that category?


Recommend plugins for member's only e-commerce website

I welcome recommendation from the gurus for my ecommerce website - I want to make a ecommerce website and I want it to be for members only. I want to restrict members from visiting the dashboard. I want guest-visitors to land on a login page , and once they login to my website they would be able to provide billing address, contact information, they would be able to shop, track orders status. Can anyone suggest me what plugins and theme (free and premium both) would be best for my website ? I would sell T-shirts and Canvas shoes . The extra (must) features I want for my ecommerce website:   1. members only website (only login page visible to non-logged in visitors)   2. members will have a profile page where they can update the billing and shipping information, which will be used in future for all shopping transactions they make, with a confirmation during finalising the order.   3. HTML Email and Newsletters P.S. - I have tested eshop (Wordpress Plugin). I liked it. But the only two problems with this plguin is that   1. the orders can only be tracked from the dashboard, and I have asked the developer about the code to make order tracking system a frontend page, but the developer said thats not possible.   2. No members profile page to update and save billing and shipping address (Shoppers have to fill in the personal infomations every time they order something which is annoying). Isn't there any solution at all?


a featured content slider like this

I have seen one of the best featured content slider here: http://www.elegantthemes.com/preview/Polished/ Can you recommend me a plugin to replicate it in my own wp theme? Thanks!


Where is the submitted $_POST array stored after an option page submission?

What happens, when I click `Save Changes` on a option page, which was created by `add_menu_page()`? Where is the submitted data stored _before_ the database transmission? A `print_r($_REQUEST)` returns only the two `$_GET` parameters `page` and `settings-updated`. I've checked the manual for `add_settings_field` and there is only the following hint: > ... the saving will be done behind the scenes. ## Background I'd like to optimize my process of creating a plugin settings page. I've already jumped on the WP Settings API with `add_settings_section` and `add_settings_field` long time ago, but it feels a bit uncomfortable to create a new callback function every time. So instead of creating the specific field/section code inside a callback, I'd like to create the complete settings page with `Zend_View`. All input fields would be created with `Zend_Form` and also attached to the view. In the end, the callback of `add_menu_page()` will return the rendered View-Object instead of the normal HTML output. The HTML is stored inside a View-Template, located in `views/pages/admin/` (e.g. `default.phtml`). The basic principle is already working I'm very happy with the result. Due to the use of `Zend_View`, I've to do the saving on my own. But WordPress seems to delete the submitted $_POST array. If I debug the output after a successfull form submission, only the two `$_GET` params above are set. I've also attached the output of the function `settings_fields()` to the view, which generates the required hidden fields (`option_page`, `action`, `_wp_nonce`). Any ideas?


Page permalink rewrite

I added the following code which allows categories on my 'Page' post type.               add_action('init', 'edit_page_type');     function edit_page_type()      {         register_taxonomy_for_object_type('category', 'page');     }      Now i realize the permalinks dont exactly match... How can i rewrite the page permalinks to act like the post permalinks? (which include the category before the page title)


How to set up multiple taxonomies for groups of posts

I have a site that has several types of posts, with categories for each: a News section (categories: Local, International, Breaking), a Video section (categories: Music, Kids, Holidays), and a Photo section (categories: Wedding, Portrait, Landscape). Unfortunately out-of-the-box, Wordpress is set up for a group of posts. But I need a way to present the various sections/categories in the admin (and set up in my code) in a simple clear way. I think I should set up custom post types for each of the main types of posts (News, Video, Photo) and then custom taxonomies assigned to each of those... is that right? Just want to find the most flexible, correct way to accomplish what I'm trying to do. The user should always be able to edit the categories for each type of post, and ideally I'd like the flexibility for the user to add new types of posts if possible. Thank you.


Link name in comments to Author page? Comment Author Meta in Comments?

I wasn't exactly sure how to word the question, so I'm sure that's why I cannot find what I need when searching Google either. I want to link all commenter names to their author.php page if they have `edit_posts` capability (Authors, Editors and Admins), otherwise link to the website they have listed in their profile. I am not experienced with using `comment_author`. Thanks.


Query a custom taxonomy for certain posts

I am trying to show some posts on a template based on their custom taxonomy. Here is my template code:               <?php $field = get_field('newsletter_date'); ?>                     <?php                      $args = array (                     'orderby'                => 'rand',                     'taxonomy' => 'newsdates',                     'field' => 'id',                     'terms' => "$field",                     'post_type' => 'post',                     );                          $queryarticles = new WP_Query( $args ); ?>                          <?php while ($queryarticles -> have_posts()) : $queryarticles -> the_post(); ?>
<a href="<?php the_permalink() ?>" class="nound"><?php the_title(); ?>
                                                   <?php the_content(); ?>                                               <?php endwhile;?>                     <?php wp_reset_postdata(); ?>      and here is what is in my function.php:               // Register Custom Taxonomy     function newsdates_taxonomy()  {              $labels = array(             'name'                       => _x( 'Newsletter Dates', 'Taxonomy General Name', 'text_domain' ),             'singular_name'              => _x( 'Newsletter Date', 'Taxonomy Singular Name', 'text_domain' ),             'menu_name'                  => __( 'Newsletter Date', 'text_domain' ),             'all_items'                  => __( 'All Newsletter Dates', 'text_domain' ),             'parent_item'                => __( 'Parent Date', 'text_domain' ),             'parent_item_colon'          => __( 'Parent Date:', 'text_domain' ),             'new_item_name'              => __( 'New Date', 'text_domain' ),             'add_new_item'               => __( 'Add Newsletter Date', 'text_domain' ),             'edit_item'                  => __( 'Edit Date', 'text_domain' ),             'update_item'                => __( 'Update Date', 'text_domain' ),             'separate_items_with_commas' => __( 'Separate dates with commas', 'text_domain' ),             'search_items'               => __( 'Search dates', 'text_domain' ),             'add_or_remove_items'        => __( 'Add or remove dates', 'text_domain' ),             'choose_from_most_used'      => __( 'Choose from the most used dates', 'text_domain' ),         );         $args = array(             'labels'                     => $labels,             'hierarchical'               => false,             'public'                     => true,             'show_ui'                    => true,             'show_admin_column'          => true,             'show_in_nav_menus'          => true,             'show_tagcloud'              => true,         );         register_taxonomy( 'newsdates', 'post', $args );          }          // Hook into the 'init' action     add_action( 'init', 'newsdates_taxonomy', 0 );          }


add_actions called from functions.php not returning good values

I am trying to add some security/acccess prevention to my site via the functions.php. However whenever I try to add through functions.php (instead of as a plugin, which I've done in the past) it fails (always returns false). For example:               add_action("parse_query", checkaccess());  // in functions.php      and               function checkaccess() {         $allowAccess = false;              if(is_admin()||is_front_page()||is_home()||current_user_can('administrator'))             $allowAccess=true;              if($allowAccess)             echo 'whatup'; //do something here          }      even if i try something basic - eg `global $wp_query; var_dump($wp_query);` I can't get the query var, its all NULL. Any advice? Is there some kind of walled sandbox the fuctions.php file operates from that it can't get any of these?


Custom post rewrite rule not working

I'm adding a custom post type like so (names have been altered to protect the innocent):               add_action('init', 'my_post_types');     function my_post_types() {            register_post_type('publication',         array(           'labels' => array(...),           'rewrite' => array(             'slug' => 'publications/%year%',             'with_front' => true             ),           'public' => true,           'menu_position' => 21,           'supports' => array('title', 'editor', 'author', 'excerpts', 'revisions', 'thumbnail'),           'show_ui' => true,         ));     }      I would expect with these settings that the URL of a given publication would be:               /publications/2012/name-of-publication      However, the URLs produced by `get_permalink()` are coming out as:               /publication/name-of-publication      The desired URL pattern is recognised by WordPress, but simply redirects to the lower URL. This URL does display the desired page. I've tried the commonly suggested solutions:   * Making sure that `register_post_type` is called on the `init` action, so it isn't created too late.   * Flushing the rewrite rules by visiting the Permalinks settings page. I also tried doing this on every page using `$wp_rewrite->flush_rules()`, but that would be pointlessly expensive in reality.   * Changing the value of `with_front` has no effect. I wouldn't expect it to since the site is at `/`, not in a subfolder.   * Taking out the `%year%` part of the slug has no effect either, so it isn't causing the rewrite rules to fail.   * I don't have the Redirection plugin installed. It's a known troublemaker with URLs. If necessary, I can intercept WordPress' routing and force it to deliver the right page, and use filters to return the right URL from `get_permalink`, but that seems like the wrong solution. Setting the rewrite rules when I register the post type is the right solution. Is there something I'm doing wrong?


Using Multiple Queries of "home_url" vs. Calling a Variable Multiple Times

## Question Since I am using multiple instances of `home_url()` in one page template, I was curious if the following method would speed up my page load time. My method is to store the output of `home_url()` within a variable and then call that variable each time, rather than using `home_url()` each time. ## Motivation The reason I thought echoing a variable would be speed up the page load time, is because (if my understanding is correct) echoing a variable wouldn't require querying the database, each time I called that variable. ## Method A

<a href="<?php echo home_url(); ?>/category/blue">Blue Items

<a href="<?php echo home_url(); ?>/category/green">Green Items

<a href="<?php echo home_url(); ?>/category/red">Red Items

<a href="<?php echo home_url(); ?>/category/orange">Orange Items

<a href="<?php echo home_url(); ?>/category/purple">Purple Items

<a href="<?php echo home_url(); ?>/category/gray">Gray Items

      ## Method B               <?php $my_home_url = home_url(); ?>

<a href="<?php echo $my_home_url; ?>/category/blue">Blue Items

<a href="<?php echo $my_home_url; ?>/category/green">Green Items

<a href="<?php echo $my_home_url; ?>/category/red">Red Items

<a href="<?php echo $my_home_url; ?>/category/orange">Orange Items

<a href="<?php echo $my_home_url; ?>/category/purple">Purple Items

<a href="<?php echo $my_home_url; ?>/category/gray">Gray Items


Adding class to next/prev image link in attachment.php

Is it possible to add a class or ID to next/prev image links in `attachment.php`? I tried like this but it didn't work:               <?php next_image_link( false, 'Next', array('class' => 'next')); ?>


Most efficient way to search for values from CPT in Post content

I have a Glossary CPT. Title, editor, slug and featured image. I would like to add a filter to Post content (and content of my other CPT "species") which looks through all of the content in each post and replaces any words found in the Glossary with a link to the glossary entry. For example... _Glossary entry_ : test _Post content_ : `<p>This is a test post to explain what I mean.</p>` _Outcome after filter_ : `<p>This is a <a href="/glossary/t/test/">test</a> post to explain what I mean.</p>`. There may be up to 2000 glossary entries at any given time however, so I'm worried about efficiency. * * * **EDIT: THIS CODE NEEDS SOME REWORKING!** I've started to use code as suggested by Matthew Boynes. I have adapted it somewhat, as I was receiving an error with my `$wordlist` variable. More information on said error is available here.               function add_glossary_links($content) {         global $wpdb, $wordlist;         if ( !$wordlist && !$wordlist = get_option('wordlist') ) {             mysql_query('SET SESSION group_concat_max_len = 100000');             $wordlist = $wpdb->get_var('SELECT GROUP_CONCAT(DISTINCT post_title SEPARATOR "|") AS list FROM '.$wpdb->posts.' WHERE post_status="publish" AND post_type="glossary" AND post_parent>0');             add_option('wordlist', $wordlist);         }              $wordlist = str_replace(array(" ", "'", ".", "/"), array("\s", "\'", "\.", "\/"), $wordlist);              $content = preg_replace_callback(             '/\b('.$wordlist.')\b/i',             create_function(                 '$matches',                 'return "" . $matches[0] . "";'             ),             $content         );              return preg_replace('/(<[^<]+)(.*?)<\/a>/si','$1$2', $content);     }          add_filter( 'the_content', 'add_glossary_links' );      The function above works, to an extent. I now have two issues:   1. The function is linking _everything_ : `[caption id="attachment_542" align="alignleft" width="125" caption="Amazonas Magazine - now in English!"]<a href="http://www.seriouslyfish.com/dev/wp-content/uploads/2011/12/Amazonas-English-1.jpg"><img class="size-thumbnail wp-image-542" title="Amazonas English" src="http://www.seriouslyfish.com/dev/wp-content/uploads/2011/12/Amazonas-English-1-288x381.jpg" alt="Amazonas English" width="125" height="165" /></a>[/caption] <p>Edited by Hans-Georg Evers, the magazine ‘Amazonas’ has been widely-regarded as among the finest regular publications in the hobby since its launch in 2005, an impressive achievment considering it’s only been published in German to date. The long-awaited English version is just about to launch, and we think a subscription should be top of any serious fishkeeper’s Xmas list…</p> <p>The magazine is published in a bi-monthly basis and the English version launches with the January/February 2012 issue with distributors already organised in the United States, Canada, the United Kingdom, South Africa, Australia, and New Zealand. There are also mobile apps availablen which allow digital subscribers to read on portable devices.</p> <p>It’s fair to say that there currently exists no better publication for dedicated hobbyists with each issue featuring cutting-edge articles on fishes, invertebrates, aquatic plants, field trips to tropical destinations plus the latest in husbandry and breeding breakthroughs by expert aquarists, all accompanied by excellent photography throughout.</p> <p>U.S. residents can subscribe to the printed edition for just $29 USD per year, which also includes a free digital subscription, with the same offer available to Canadian readers for $41 USD or overseas subscribers for $49 USD. Please see the <a href="http://www.amazonasmagazine.com/">Amazonas website</a> for further information and a sample digital issue!</p> <p>Alternatively, subscribe directly to the print version <a href="https://www.amazonascustomerservice.com/subscribe/index2.php">here</a> or digital version <a href="https://www.amazonascustomerservice.com/subscribe/digital.php">here</a>.</p>`   2. This may be a pushing my luck, but would it be possible to make this code case-sensitive, i.e. content only matches wordlist if case is the same, unless it's the first word of a sentence? Thanks in advance,


Post_count only shows the number of results per page

I have a wp_query `$wp_query = new WP_Query($args);` but for some reason the `$wp_query->post_count` only shows the amount of posts on each page. So if I set `'showposts' => '10'` and 12 results are found, page one will say '10 results found' and page 2 shows '2 results found'. Why is this? I can't figure it out.               $paged = (get_query_var('paged')) ? get_query_var('paged') : 1;     $args = array(       'post_type' => 'post',        'showposts' => '10',       'paged' => $paged     );     $wp_query = new WP_Query($args);     echo "Search found ".$wp_query->post_count."results";     if ($wp_query->have_posts()) : while ($wp_query->have_posts()) : $wp_query->the_post();     // the loop


How Can I Access a PHP Variable in Another PHP Function

I'd like to use the $atts variable from the lax_google_map_maker() function in lax_google_map_init(). How do I access it? I tried to 'globalize' it, but for some reason it didn't work.               function lax_google_map_init() {         wp_enqueue_script('google-maps', 'http://maps.googleapis.com/maps/api/js?sensor=false');         wp_enqueue_script('lax_google_map_script', plugins_url('js/lax_google_map_script.js', __FILE__), array('google-maps','jquery'));              $params = array (            'latitude'=>  '39.01',            'longitude'=> '-76.02'             );              wp_localize_script('lax_google_map_script', 'lax_map_params', $params);      }          add_action('init', 'lax_google_map_init');               function lax_google_map_maker($atts,$content=null) {               $atts = shortcode_atts( array(             'latitude'=>'38.9205',                    'longitude'=>'-77.04505920410156'),             $atts);              $output .= '

';              return $output;     }                add_shortcode('lax-google-map', 'lax_google_map_maker');      * * * My goal is to set the $params variable using the shortcode's $atts. As I understand it, I have to keep the $params variable in the same function as the wp_enqueue_script line and the wp_localize_script line. Otherwise, I would break it out into a new function and pass in the $atts as a parameter. If there were a way to pass in $atts to function lax_google_map_init, I would be golden. I've tried everything that I can think of. Looking forward to hearing your good ideas.


Shortcode for tables which can include comma and linebreaks

Is it possible to make a shortcode for table which can include commas and linebreaks for its content? I've been trying to output something like this with shortcode: ![enter image description here](http://i.stack.imgur.com/ue4N1.png) But it seems difficult. I tried Google and found **this** and **there**, but what given there don't seem to allow commas within the content (as it is separated by comma) and can't seem to have linebreaks. Is this actually possible? Or is there any viable alternatives to achieve this? **I'm avoiding using plugin, only tried to mingle around with functions.php**. Thanks a lot for the help. :)


call user func array error after moved the site to new server

my wordpress site moved to a new server with cpanel. now after logged into wp- admin an error is showing.               call_user_func_array() expects parameter 1 to be a valid callback, function 'showEntry' not found or invalid function name in /home/mysite/public_html/wp-includes/plugin.php on line 406      can anybody please tell me why this is showing and how to solve this? ok..i found out there this is related to a plugin. but i don't know the reason. please help me to find the reason why this is showing. the plugin part that contains this function is listed below: the plugin name is clinic clinic.php               add_action('admin_print_scripts', 'showEntry');      appointment-book.php               <select name="eemail_subject_drop" id="eemail_subject_drop" onchange="showEntry(this.value)">                     <option value="">Select Email template</option>       <?php echo $eemail_subject_drop_val; ?>                 </select>      settings.js               function showEntry(id)     {                jQuery(document).ready(function($) {          var data = {         action: 'template_action',         id: id          };          // since 2.8 ajaxurl is always defined in the admin header and points to admin-ajax.php     jQuery.post(ajaxurl, data, function(response) {         //alert('Got this from the server: ' + response);          jQuery('textarea#mail_contents').text(response);          });          });         }      view-subscriber.php               <select name="eemail_subject_drop" id="eemail_subject_drop" onchange="showEntry(this.value)">                     <option value="">Select Email template</option>                     <?php echo $eemail_subject_drop_val; ?>                 </select>      what is the error in these files. this warning happens when the site is moved to a new server with cpanel. please help me to solve this.


Starter Theme vs Parent Theme? Pros and cons

I'm building a theme to be used as an example for other websites for the company I'm working. In another project we used the Hybrid Parent Theme and was really easy to build, but REALLY hard to maintain the website. I prefer the Starter Theme approach, which another developer copy the theme and create from it. The Parent->Child gives too much freedom for the developer mess the code. For example I didn't know if something was being called on the child or on the parent. I would like to hear from you:   * When a Parent theme is better?    * When a Starter Theme is better?    * What are the pros and cons for each of them? Thanks.


How to adjust the Cartpress e-commerce plugin?

Has anyone used Cartpress before that could give me some pointers? I've installed the plugin but struggling to find all the templates it uses to display everything. I'm using the default theme in WP and have set everything up in that. Things I want to include are:   1. Display 3 top products on the homepage.   2. Adjust the look of how all the products are displayed.   3. Tailor the look of checkout process.   4. Display a basket. I've tried using Dukapress and wpStoreCart but Cartpress seems the easiest to adjust. It's easy enough to change to a different plugin as I'm only just starting out.


I want to remove top admin bar from wordpress. How to?

whenever admin or any other user logs in a top bar menu ads up. Now I made login for everybody, so I do not want this bar. first I added display:none to admin-bar.css, but the main problem is that wordpress is still adding a white line on the top with: html { margin-top: 28px !important; } how to remove this as this is causing some design flaws. Thanks!


WordPress 3.2.1: jQuery is not defined, breaks Admin panel

I've fresh-installed a WordPress 3.2.1 on my server yesterday. Unfortunately, installing 3.2.1 breaks all the jQuery scripts and I can't click on "Collapse menu", "HTML" in the editor, "Fullscreen" - basically, everything that's loaded with jQuery. I've tested with Safari, Firefox and Chrome on a MAC OS X. I downgraded on 3.2.0 and jQuery is working properly on this version, but when I upgrade back to 3.2.1. everything breaks. If you think it's related to JSON, JSON is working properly with PHP, too. I also don't have any plugins installed, except Akismet and the theme installed with the default one: Tweenty Twelve or smtg. Can anyone help me? Thank you.


use of 10 new WP_Query : loading too slow (with url)

i use almost 10 new WP_Query() in my main page, but the loading is quite slow : do you know what i could do for that? each "new WP_Query()" ends up with a "endwhile" : is that enough? is there anything like reset query possible with WP_Query() ? you can check my website here : www.pondb.com : it's not finished (and some of the text is missing) but you can see the time to load it, and the source code. edit: some code from the index.php : (i might erase 1 or 2 queries, but the load time is still like 10 seconds on my computer...)

                 Contact                      <?php $my_query = new WP_Query('category_name=bio');                 while ($my_query->have_posts()) : $my_query->the_post(); ?>
<?php echo get_the_title(); ?>

<?php the_content(); ?>
                  <?php endwhile; ?>

News
                 <?php query_posts('category_name=news&showposts=3'); ?>                  <?php while (have_posts()) : the_post(); ?>
<?php echo the_title(); ?>

Posté le <?php echo the_time('j F, Y'); ?>

<?php the_excerpt(); ?>
                 <?php endwhile; ?>                 <?php wp_reset_query(); ?>
                     Lire les news

             Contact             <?php             $my_query = new WP_Query('category_name=news&showposts=8');             while ($my_query->have_posts()) : $my_query->the_post(); ?>              <?php $category = get_the_category();                 if ($category[0]->cat_name <> $sav_category){                     echo "
".$category[0]->cat_name.":
";                     $sav_category = $category[0]->cat_name;                 }?>

<?php echo get_the_title(); ?>

Posté le <?php echo the_time('j F, Y'); ?>

<?php the_content(); ?>

                      <?php endwhile; ?>

             <?php $my_query = new WP_Query('category_name=concert');             while ($my_query->have_posts()) : $my_query->the_post(); ?>
<?php echo get_the_title(); ?>

<?php the_content(); ?>
              <?php endwhile; ?>

      Thanks for your help


Wordpress - thumbnail image from youtube (function and loop)

Hi :D i need show thumbnails from youtube in homepage, i have a code for wordpress in function and the loop but not working thumbnail from youtube. What can be wrong with the code? Function Code:                 function get_thumbnail_fromyoutube( $size = 0 ) {           global $post, $posts;           $youtube = '';           $get_url = preg_match_all('//i', $post->post_content, $matches);           $youtube = $matches[1][0];           if(preg_match('/^(http:\/\/www.youtube.com)/', $youtube))           {             $youtube = preg_replace('/(.*?).embed\//', '', $youtube);             $youtube = preg_replace('/\?.(.*?)$/', '', $youtube);             echo 'post_title . '" />';           }              }      LOOP CODE:               <?php     $args = array(         'tax_query' => array(             array(                 'posts_per_page' => 1,                 'order' => 'DESC',                 'taxonomy' => 'section',                 'field' => 'slug',                 'terms' => 'video'                       )         )     );     $query = new WP_Query( $args );     if ( $query->have_posts() ) {         while ( $query->have_posts() ) {             $query->the_post();                   ?>               <img src="<?php echo has_post_thumbnail() ? the_post_thumbnail('thumbnail') : get_thumbnail_fromyoutube(); ?>" alt="<?php the_title(); ?>"/>     <?php                                  }                           }                              wp_reset_query();  // Restore global post data stomped by the_post().                         ?>


wp_tiny_mce function not found

I am trying to add the embedded TinyMCE editor to content area using the code:               add_action( 'comment_form_after', 'tinyMCE_comment_form' );          function tinyMCE_comment_form() {              wp_tiny_mce(false, array(             'mode' => 'exact',             'elements' => 'comment',             'height' => 200,             'plugins' => 'inlinepopups,wpdialogs,wplink,media,wpeditimage,wpgallery,paste,tabfocus',             'forced_root_block' => false,             'force_br_newlines' => true,             'force_p_newlines' => false,             'convert_newlines_to_brs' => true         ));          }      defined in **functions.php** of my theme. For some reason if I load a page with comments there it returns the error **wp_tiny_mce is not found**. Do you know how to fix it? Maybe I chosen the wrong action?


Swatch Internet Time for article timestamps

The date and time when the article was published is shown below the article title. How do I show Swatch Internet Time there instead of local time?


Custom taxonomy not appearing in menu administration panel

I am unable to see custom taxonomy box in the wordpress new menu system. I can see the post types but custom taxonomies are not available. I saw the screen options aswell custom taxonomies are not listed there. I am using more taxonomy plugin to create taxonomy.


Getting the WordPress custom menu titles and outputting them in a theme

I have created a number of custom menu slots in my WordPress theme, and the output of the links into them has been very easy. Unfortunately I cannot find a way to output the _user entered_ title for the menu above the list in each menu slot. This doesn't seem to come with the default WordPress function. I am wondering if there is a simple and efficient way to grab the user entered name of the menu that is currently in a slot in my theme. [Somewhat like the way the widgets function allows you to chose whether you want to show the title of the specific widget.] Thanks in advance. **EDIT: Still looking for help!**


Different post sort order within different categories

I need to give _each_ post a _unique_ post order for multiple Categories (per post) it is in. I can imagine a solution using custom fields whereby for each Category there is a corresponding custom field for the order. E.g. Categories: Playlist1 Playlist2 Playlist3 Custom fields for the post: Playlist1_Order Playlist2_Order Playlist3_Order This method is obviously not easily scalable though so I would like to know if anybody has a more elegant solution. ## Background I am setting up a site to accompany a 24/7 broadcast. The playlist for the broadcast is a 12hr loop that is modified once per week. **Some shows are added & removed and the order of some shows is re-arranged.** I intend to define a custom post type of Shows and custom taxonomy of playlist. **Each show will be added to one or more playlists. It must be possible for the show to have a unique order in each playlist.** (I decided to keep the question limited to posts & categories rather than post-types & taxonomies to avoid confusion). ## UPDATE To clarify, consider this example. There's a post called "Rod's Radio Roundup." It's in the categories "Tuesday Lineup" and "Wednesday Lineup." On Tuesday it's the third show and Wednesday it's the 7th show. Later, it leaves Wednesday but moves to the 1st slot on Thursday and the 5th slot on Saturday. And there are 40 other posts like this. The essential question: How do you maintain multiple orders, one per category, for a single post?


wp_ajax_nopriv_xxx is not firing on one site, works on all others. -1 for logged out users

my plugin uses add_action for `wp_ajax_cl_ajax` and `wp_ajax_nopriv_cl_ajax` in it's code and on the few thousand sites that are using it, it is fine but one site is not working for logged out users a logged in user is fine, the code sends a request to ajax and everything gets returned fine. on other blogs, a logged out user is fine but just on this one blog a -1 gets returned for the ajax request. I have added debug code to the plugin to die at the do_ajax function with a message but it doesn't even get to that function. here's the action for the logged out user ajax `add_action('wp_ajax_nopriv_cl_ajax','do_ajax');` the function has this               function do_ajax(){         if(isset($_REQUEST['debug'])){           die('in ajax function');        }     }      I just change the ajax url to have a var for debug (..../wp-admin/admin- ajax.php?debug=true) on my test sites it dies, for a logged in user it dies but for a logged out user, it just returns -1 which tells me the action is not even being triggered. I added more debug code to the function that adds the actions for `has_filter` and it returns 1 so i know the action is added, just not fired. I've tried changing the theme but no joy there the site is using wp 3.2 does anyone have any experience with wp_ajax_nopriv_xxx not firing? what caused it for you? as I said, it is working fine on other blogs so I know it isn't a case of a typo or missing code. what other things can I do to determine what is causing the action not to fire?


SQL query add only posts with custom field to array

I have this SQL query which is building an array of wordpress posts...               $query = "select $wpdb->posts.* from $wpdb->posts,$wpdb->terms,$wpdb->term_taxonomy,$wpdb->term_relationships where $wpdb->terms.term_id in (".$catId.") and $wpdb->terms.term_id = $wpdb->term_taxonomy.term_id and $wpdb->term_taxonomy.taxonomy = 'pcategory' and $wpdb->term_taxonomy.term_taxonomy_id = $wpdb->term_relationships.term_taxonomy_id AND $wpdb->posts.post_status = 'publish' and $wpdb->term_relationships.object_id = $wpdb->posts.ID and $wpdb->posts.ID != ".$post->ID." group by $wpdb->posts.ID order by $wpdb->posts.ID LIMIT 0 ,$limit";      I need to modify this to allow me to add a condition that only posts with a specific custom field value, say 'Apple' are included in the array. Can anyone point me in the right direction? ## UPDATE I have tried to modify it to this....               $query = "select $wpdb->posts.* from $wpdb->posts,$wpdb->terms,$wpdb->term_taxonomy,$wpdb->term_relationships where $wpdb->terms.term_id in (".$catId.") and $wpdb->terms.term_id = $wpdb->term_taxonomy.term_id and $wpdb->term_taxonomy.taxonomy = 'pcategory' and $wpdb->term_taxonomy.term_taxonomy_id = $wpdb->term_relationships.term_taxonomy_id AND $wpdb->posts.post_status = 'publish' and $wpdb->postmeta.meta_key = 'fruit' and $wpdb->postmeta.meta_value= 'apple' and $wpdb->term_relationships.object_id = $wpdb->posts.ID and $wpdb->posts.ID != ".$post->ID." group by $wpdb->posts.ID order by $wpdb->posts.ID LIMIT 0 ,$limit";      I was assuming that this would narrow down the search to only the posts that have a value of 'apple' for the custom field named 'fruit' but its not working


Using AJAX to run sql statement and populate dropdown

I am trying to create a search where the user select two different bit of data from databases and it them prints some results that meet requirements. I know I need to use ajax or something similar but I have little idea how I should be doing it. The first drop down box works fine as that doesn't depend on anything here is the code for that.               <select name="raceTrack2" onchange="">                 <?php                 $postids = $wpdb->get_col("SELECT trackName FROM " . $trackTableName . ";");                      foreach ($postids as $value) {                     echo '<option>' . $value . '</option>' ;                      }                 ?>             </select>      That works fine now the next step I need to do is where it start to get complicated I need to take the value of the first selection box and add it into the sql query of the next one then run that query when the first selection box changes using onchange.               <select name="raceDate">             <?php                  $postids2 = $wpdb->get_col("SELECT DISTINCT raceDate FROM " . $tableName . " WHERE trackName = '" . $track . "';");                      foreach ($postids2 as $value2) {                     echo  $value2  ;                         }                 ?>             </select>         Then I need to take the value of both of these dropdowns and use it in this final query to display the results.               $postids = $wpdb->get_results("SELECT driverName, driverClass, driverPosition FROM " . $tableName . "WHERE trackName = '" . $track . "' AND raceDate = " . $date . ";");                      foreach ($postids as $value) {                     echo '
';                     echo '' . $value->driverName . '	';                     echo '' . $value->driverClass . '	';                     echo '' . $value->driverPosition . '	';                      echo '
';                 }                   }      Any suggestions would be appreciated.


Change the class of wordpress menu

I have problems with wordpress menu level classes.               <?php wp_nav_menu( array( 'theme_location' => 'primary' ) ); ?>      this is the code i used to generate my menu, First level menu id is > ul id="menu-home" second level class is > ul class="sub-menu" but my third level menu also has same class as second level > ul class="sub-menu" is there any way to change the class of third level or some other solution??? please help.. thankyou


Have different search results template depending of custom post type searched

I have a site with different custom post types, I have two "index pages" for each one of these (where I query the posts and show) and also I include a search form on both of them. So the thing is that search forms goes by default to the search.php template, to filter search and show results only for that custom post type I'm using a hidden field on form: `<input type="hidden" name="post_type" value="staff" />` but then on the search I'd like to provide a "back" link to allow the user to go back to the index page, the thing is that I can't find an if statement that works to show different "back to" links depending of the custom post type searched. Example: If I search for News then I'd like to have a back to News index button If the search is on Staff the button shown has to be back to Staff index. I appreciate any help guys!   Thanks!   Juan.


Unschedule a post

I have some posts scheduled for tomorrow. I want instead to remove the scheduled date and simply publish them manually when I am ready. I can't find anything about this. Does just setting them to "Draft" accomplish this? When I change the status from "scheduled" to "draft", the date remains.


Adding Tag On Single Post from bbpress (Tewenty Ten) Themes

i want adding tag on my single post, currently now i am using bbpress (Twent Ten) Themes, What i want is include Taged With : on a single post. Thank You, RA


custom cron interval is not working

I am trying to create custom interval for cron schedule with below code but it is not working,               function cronschedules($schedules) {     $schedules['custom'] = array(     'interval' => 36000, // seconds        'display'  => __('Custom Interval')              );       return $schedules;      }     add_filter('cron_schedules', 'cronschedules');     wp_schedule_event(time(),'custom','ACPdailyevent');      here is the debug log:               [15-Apr-2014 12:02:12 UTC] PHP Notice:  Undefined index: custom in C:\wamp\www\wp\wp-includes\cron.php on line 111          [15-Apr-2014 12:02:12 UTC] PHP Stack trace:          [15-Apr-2014 12:02:12 UTC] PHP   1. {main}() C:\wamp\www\wp\wp-cron.php:0          [15-Apr-2014 12:02:12 UTC] PHP   2. call_user_func_array() C:\wamp\www\wp\wp-cron.php:87          [15-Apr-2014 12:02:12 UTC] PHP   3. wp_reschedule_event() C:\wamp\www\wp\wp-cron.php:87


How to call a plugin function from index.php

I have created a function in my plugin `myplugin` with the name `foo`, how to call it from the frontend?                e.g. index.php?


How to enable commenting system in Wordpress

I am learning how to create custom Wordpress theme from this page   and everything is working except commenting system because they haven't described how to enable it (they only used `<?php comment_form(); ?>` to insert form into template). I can see my comment in the backend but not in the page itself (I can see a link showing **1 comment** but when I click it nothing happens). Obviously I need some PHP code to show my comments but have no idea where to start! I am stuck because I just started to learn Theme Development and my PHP knowledge is limited.   Can anyone give me a suggestion or a solution for that problem? It would a mean a lot to me. Index php looks like this:               <?php get_header(); ?>
         <?php if(have_posts()) : ?><?php while(have_posts()) : the_post(); ?>

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

                  <?php the_post_thumbnail(); ?>                 <?php the_content(); ?>
                 <?php _e('Filed under:'); ?> <?php the_category(', ') ?> <?php _e('by'); ?> <?php  the_author(); ?>
                 <?php comments_popup_link('No Comments »', '1 Comment »', '% Comments »'); ?> <?php edit_post_link('Edit', ' | ', ''); ?>

              <?php endwhile; ?>
         <?php posts_nav_link(); ?>
              <?php endif; ?>
         My Wordpress page HERE   Thank You!!


Rewriting Image URLs from dynamic to original

Here's the deal: My plugin automatically watermarks images from the WP gallery on the fly using the GD library wherever these images appear. So, I have a physical copy (in wp-uploads) of these attachments, and also a watermarked, dynamic copy of the image which I replace the image source on the page using Simple HTML DOM. So now, I have an image on my page that points to a URL like this: `http://localhost/wp- content/plugins/pluginname/image.php?original=http%3A%2F%2Flocalhost%2Fwp- content%2Fuploads%2F2012%2F09%2FPenguins-300x225.jpg&username=&wmtext=localhost&wmsize=14&wmcolor=%23000000&wmpos=top- center&pin_hoveron=1&pin_hoverimg=http%3A%2F%2Flocalhost%2Fwp- content%2Fplugins%2Fpluginname%2Fadd-to- etc.png&followimg=&pin_on=1&follow_on=1` What I want to do is make the image source APPEAR like it is the original version, but display the dynamic image instead. I've attempted to mess around with rewrite rules, but it never seems to do _anything_ , no matter what I try. The rules get added to .htaccess, but nothing changes. Here's what I was messing around with:               add_action('generate_rewrite_rules', array( $this, 'addRewrites' ) );          public function addRewrites( $content ) {         global $wp_rewrite;         $new_rules = array(             'img/(.*)'      => plugins_url( 'image.php', __FILE__ ) . '?etc=$1',         );         $wp_rewrite->non_wp_rules += $new_rules;     }      Now if I visit an image URL or a page with an image, NOTHING happens. =/ I'm a newbie when it comes to rewrite rules, so this is a bit beyond me.


Problem with wp_create_category

I have simple code:               add_action('init', 'categoryTransfer');          function categoryTransfer(){     //some code         for($i=0; $i < count($categories); $i++)             wp_create_category($categories[$i]->name);     }      But when it executes i get:               Fatal error: Call to undefined function wp_create_category() in /Users/noname/Sites/wp-content/plugins/my_plugin/my_plugin.php on line 95      Where is a problem?


Adding body class when post contains a specific shortcode

**Simple shortcode function :**               function my_shortcode_function($atts,$content=null){       // Do something       return $content;     }     add_shortcode('my_shortcode','my_shortcode_function');      I wonder how to add more extra body class when user use this shortcode in contents. **I can't do something like :**               function my_shortcode_function($atts,$content=null){       // Do something       add_filter('body_class','my_body_class');       return $content;     }     function my_body_class($classes) {        $classes[] = 'foo';        return $classes;     }     add_shortcode('my_shortcode','my_shortcode_function');      Any idea ?


Gravity Forms After Submission - GFFormsModel::update_lead_field_value?

I am working with Gravity Forms. This code works with a couple issues :               add_action('gform_after_submission_14', 'post_contract_update', 10, 2);     function post_contract_update($entry, $form) {         $form ='3';         $lead = $entry['4'];         $statusvalue_update = 'Under Contract';         GFFormsModel::update_lead_field_value($form, $lead, '', '', 154, $statusvalue_update);     }      After form 14 is fired, it does what it is supposed to using Gravity Forms Model : update_lead_field_value. Only problem is - once my $lead (lead_id) goes over 9, to a double digit, the entry gets truncated. So for example, in this image below, I actually put in 448 into $lead. In the DB it's only showing as 4. ![Gravity forms sql shown](http://i.stack.imgur.com/TMrvD.png) The storage field is correct int 10 - and adding directly via sql works. So far I have -   * added directly via PHP   * move firing of the function around   * changed priority   * changed themes just in case   * deactivated plugins just in case   * single qouting, double qouting   * printed out array - everything looks perfect   * change string to intval etc... Nothing seems to work, no matter what - once my $lead id goes above a single digit. Am I missing something incredibly easy? Am I unaware of limitations on GFFormsModel::update_lead_field_value? Is the model expecting some specific number format?


Pages with posts filtered by category

My site has a few categories, such as "business", "techology", "news" etc. I'd like to display the latest posts from most categories on the front-page, except for a few special ones which I can filter out as described here. Is there an easy way to add pages in such a way that they automatically display all recent posts from a given set of categories? E.g. a "business & technology" page which automatically displays the most recent posts categorized under "business" or "technology"?


assign default pages to newly craeted site in wordpress multisite

I have created new multisite and it runs successfully. I want to crate 3-4 pages from super admin and assign these pages to my already created sites and when new site create than I want to assign these pages to site. and also I want to do is in child sites there is no option for crated new page. he can manage only those pages which is created from super admin. Is it possible?


Best Way to Setup a Network of WP Sites?

What, in your opinion, is the best way to setup a network of WP sites with a shared login?   * I want users to stay logged in to their account when they switch sites   * I want this to be used with different domains


No Edit / Delete Links for Custom Post Type?

I've created a custom post type for "testimonials" as well as rearranged the edit post display with custom columns for that post type... Everything works as expected EXCEPT for the fact that when I hover over one of these custom posts, the list of "action links" that normally appears beneath it enabling you to edit/delete that post aren't there... Here's a screenshot of what I mean: ![enter image description here](http://i.stack.imgur.com/hzLsg.png) Here's all the related code:               function wpg_edit_testimonials_columns($columns) {       $columns = array(         'cb' => '<input type="checkbox" />',         'testimonial_author' => __('Author', 'quotable'),         'testimonial_text' => __('Testimonial', 'quotable'),         'attribution_link' => __('Attribution Link', 'quotable'),         'date' => __('Date Added', 'quotable')       );       return $columns;     }          function wpg_manage_testimonials_columns($column, $post_id) {       global $post;       $custom = get_post_custom($post->ID);       $testimonial_author_name = $custom['testimonial_author_name'][0];       $testimonial_author_link = $custom['testimonial_author_link'][0];            switch($column) {              case 'testimonial_author':           echo $testimonial_author_name;         break;              case 'testimonial_text':           echo $post->post_content;         break;              case 'attribution_link':           echo $testimonial_author_link;         break;              default :           break;       }     }     add_filter('manage_edit-testimonials_columns', 'wpg_edit_testimonials_columns');     add_action('manage_testimonials_posts_custom_column', 'wpg_manage_testimonials_columns', 10, 2);      My only guess is that maybe it has something to do with the fact that the "title" column isn't being used? I didn't see any need in using the title column since the post type doesn't even support the use of "titles", as it's just a testimonial. ## EDIT: Ok, I've confirmed that it is, in fact, due to the fact that the title column isn't being used... I added "title" to the list of columns in the array and the links appeared... However, since titles aren't supported in this post type, the title is being listed as "Auto Draft" for all of the testimonials. ## EDIT AGAIN: Taking the advice of @helenhousandi, I've rolled my own set of links... but now I'm running into an entirely new problem. The delete/trash link uses a nonce, which I've added... but I'm apparently missing a step somewhere, because it's not actually completing the action when clicked. Instead I'm getting a WordPress failure notice: ![enter image description here](http://i.stack.imgur.com/MzwPX.png) Here's the edited portion of my code:               $wpg_row_actions  = '
ID.'&action=edit">Edit | ';     $wpg_row_actions .= 'Quick Edit | ';     $wpg_row_actions .= 'ID.'&action=trash', 'delete-post_'.$post->ID).'" title="'.__('Move this item to the Trash', 'quotable').'" class="submitdelete">Trash';               switch($column) {       case 'testimonial_author':         echo $testimonial_author_name.$wpg_row_actions;     break;


Verify if tag is used on posts

I'm using site tags for a glossary. I would like to display a link to the tagged page if the tag exists, otherwise just display the tag title. Is there a check which would allow me to determine if the tag is has been tagged on posts?                   $tags = get_tags( array( 'hide_empty' => false ) );         if ($tags) {           foreach ($tags as $tag) {             if ($tag->description) {               echo '
term_id ) . '" title="' . sprintf( __( "View all posts in %s" ), $tag->name ) . '" ' . ' style="text-decoration:none;">' . $tag->name.'

' . $tag->description . '
';             }           }         }      (Working) Update from Chip's recommendation                   $tags = get_tags( array( 'hide_empty' => false ) );         if ($tags) {           foreach ($tags as $tag) {             if ($tag->description) {               echo '
';                   if ( 0 < $tag->count ){                     echo 'term_id ) . '" title="' . sprintf( __( "View all posts in %s" ), $tag->name ) . '" ' . ' style="text-decoration:none;">' . $tag->name.'';                   } else {                     echo $tag->name;                   }               echo '

' . $tag->description . '
';             }           }         }      Example end result http://i.imgur.com/aFs6z.png


Wordpress Multisite: Set template languages for a domain?

I have two domains set up in a Wordpress 3 Multisite blog. One of them is supposed to be in Swedish and the other in English. The template contains some texts that I want to translate for the different sites. How do I set up different languages for the sites' frontend (using the language files in my template)?


Is it a good idea to edit an already existing plugin to add more functionality?

I need to add a relatively small bit of functionality to a Wordpress plugin and I have the option to either edit the plugin directly, or scrap the plugin completely and repurpose PHP code from another site to do the same thing. Repurposing non-Wordpress PHP code for such a small change seems silly and I have the few lines of PHP I would use when editing the plugin. My question is, is it a good idea to edit a plugin? I know that when editing a theme, if the edits are done directly to the old code, when the theme is updated the changes will be lost. Does this happen with plugins too? Is there a way around this? For those wondering how complicated the changes are, I'll explain briefly. The client I have wants a form submission to go to a dealer and the user. But on certain circumstances depending on the user's email address (if it ends in ".gov" or a few other endings... yes I know this isn't the best idea and I tried to convince the client but they were adamant) the client wants the email to go to someone else. Naturally this could be cured with a few small PHP lines in the plugin but the plugin doesn't have the functionality for "conditional recipients" based on content sent by the user. So I'd like to either add that functionality just for this site (if it can be done quickly) or I'd like to replace the plugin with straight php which seems like it would cause more problems than it would fix initially. Time is of the essence. Thank you so much for your help!


I want my post to republish again after adding a custom field

I wanted a code in Wordpress that could allow me to republish the post every time I add a new custom field. For example, if I already have a post and wanted to add an update to it; I want it to appear at the top of the site after updating it. Is that possible ? Thanks in advance


Image on rss feed on post

I want my website to display post of bloggers fashion posts from a virtual world second life. I've started using blogger, they have a simple widget "bloglist", just put the url of the blogger it also show pictures of recent post per url. Someone told me to move to wordpress because it's better layout. I'm using Wordpress now, but I'm totally lost. What type of plugins, codes or widgets do I need to get this same result in Wordpress? I know rss feed, but it does not show an image with the post feed. What do I need to achieve this? Here are examples of what I'm trying to achieve > behappyinsl.wordpress.com/ > > www.old-london-docks.de/ fashionfeedofsl.com/


Loading Canvas & WooCommerce translation file in child theme

I'm trying to localise a site (Canvas child theme). I already have the translated .po and .mo files. I uploaded the WooCommerce translation files to `child- theme/woocommerce/i18n/languages/` in the child theme and the Canvas translation file to `child-theme/lang/`. This follows the same directory structure as the parent theme and plugin. I have also defined WPLANG as 'af_AF' In my functions.php I have the following function               function weg_localisation() {      load_theme_textdomain('woothemes', get_stylesheet_directory() . '/lang');      unload_textdomain('woocommerce');      load_textdomain('woocommerce', get_stylesheet_directory() . '/woocommerce/i18n/languages.woocommerce-af_AF.mo');      }      add_action('init', 'weg_localisation');      Unfortunately I'm having no success with this. Any idea where I'm going wrong? Thanks,


Include content of file into plugin (ob_start();;include;ob_get_clean()) without <<<EOT

I am writing a plugin that requires a large chunk of html. Now the way how it is set up now works.               return <<<EOT  EOT;      But I want to split the file into different php files that i can include. Now I tried this, but it does not work:               ob_start();     include(plugin_dir_url( __FILE__ ).'file.php');     return ob_get_clean();      Any know how this could be done? =====================   **_EDIT_** Ok thanks Chris Carson to I have found the small error, I changed the code to:               ob_start();     include(plugin_dir_path( __FILE__ ).'/file.php');     return ob_get_clean();      This is working ok now, except for one small problem. In the previous code I used something like this:               $variable = 'Hello!';          return <<<EOT         {$variable}     EOT;      This would have made the following in html:               Hello!      But now this:               $variable = 'Hello!';          ob_start();     include(plugin_dir_path( __FILE__ ).'/file.php');     return ob_get_clean();      This just prints               {$variable}      Any way to get the code working with variables.


Using the loop to set locations for all posts on a single google map

Firstly, hi all! I am new to worpress stackexchange. I have been trying to build my own google map to show the location of all my posts. But I don't seem to be able to get the markers to display on the map. Edit: I have changed the code a bit since my origional post, I am now returning data but with errors. This is the data being returned:

Dubai

Testing the plugin even more

Sydney

Still testing the plugin

Singapore

Testing Plugin

Abu Dhabi

This is a test of the Maps

                And this is the maps.js file:               var infowindow = new google.maps.InfoWindow();     var pinkmarker = new google.maps.MarkerImage('/wp-content/themes/travel-bones/library/images/pink_Marker.png', new google.maps.Size(20, 34) );     var shadow = new google.maps.MarkerImage('/wp-content/themes/travel-bones/library/images/shadow.png', new google.maps.Size(37, 34) );          function initialize() {         map = new google.maps.Map(document.getElementById('map'), {              zoom: 12,              center: new google.maps.LatLng(38.898748, -77.037684),              navigationControl: false,                 backgroundColor:'none',                 streetViewControl: false,             mapTypeControl: false,             mapTypeId: google.maps.MapTypeId.ROADMAP          });              for (var i = 0; i < locations.length; i++) {               var marker = new google.maps.Marker({                 position: locations[i].latlng,             icon: pinkmarker,                 shadow: shadow,             map: map             });             google.maps.event.addListener(marker, 'click', (function(marker, i) {               return function() {                 infowindow.setContent(locations[i].info);             infowindow.open(map, marker);               }             })(marker, i));         }          }      And then this is how I am doing the query in the index.php               <?php if ( have_posts() ) : ?>
                     <?php $i = 1; ?>                     <?php while ( have_posts() ) : the_post(); ?>                         <?php if ( get_geocode_latlng($post->ID) !== '' ) : ?>                             <div id="item<?php echo $i; ?>">
<a href="<?php the_permalink(); ?>"><?php the_title(); ?>
                                 <?php the_content(); ?>
                         <?php endif; ?>                         <?php $i++; ?>                     <?php endwhile; ?>

                  <?php else : ?>
Error 404 — Page not found.
             <?php endif; ?>      The query is obviously working as the results are being returned. However I am getting this error on the maps.js file:               for (var i = 0; i < locations.length; i++) {       Uncaught TypeError: Cannot read property 'length' of undefined      And this error where the queried content shows...               var locations = [          latlng : new google.maps.LatLng(25.271139, 55.30748500000004),     Uncaught ReferenceError: google is not defined                                            },      This is the tutorial I have been following... code is modified to pull lnt/lng data from a geocoder pulgin. http://martyspellerberg.com/2012/02/tutorial- integrating-wordpress-and-google-maps-api-v-3/


Are there ways to have a functioning editing workflow in Wordpress?

The Cooking blog has two admins (I am one of them) and lots of contributors. A contributor writes a post, then the first admin edits it, then the second admin edits it, then we two admins talk about possible differences (contradictory comments turned out to confuse the author :P) then it goes back to the original author, who is supposed to implement, accept or reject our edit suggestions (which can be changes directly in the text, or comments describing what is wrong). The whole cycle is repeated 2-3 times until a post is finalized. We have found no way to do this in Wordpress. Currently, we receive the draft in a format the contributor finds convenient (directly in Wordpress, as a .doc file, in an email body, shared in Google docs). The only tool we have which has a "track changes" functionality is a full-blown word processor, so we copy it there and return it that way to the contributor. When the editing process is finalized, we transfer the text to Wordpress, manually adjusting all the formatting. This is a time-intensive process, and in the end it can happen that the contributor is unhappy with some formatting details, so they have to go over the post again and ask us to change it. During this process, everybody has to actively message the others that he has just made some changes and it is "their turn". This is failure-prone, as we have had cases where two people were editing in parallel without noticing, and cases where a planned task didn't get done because everybody thought somebody else is currently doing it. Besides, for longer-term posts we forget at which stage they are/whose "turn" it is and have to search through chat transcripts and hope that the message we have found reflects the current situation. A perfect solution would allow us to move the whole workflow to WordPress. Specifically, we need:   * a "track changes" function    * a function for leaving comments related to a specific place in the text    * a system for tracking the current "status" of a blog. In a perfect world, that would include a custom list of stati, such as "waiting for edit by rumtscho", but even a cruder system ("waiting for a review by and editor") would be better than nothing.    * active messaging which automatically notifies everybody associated with the post of a change in status, for example by sending an email. (Not something which is visible only when that person is logged in, because this is a side project for all of us and we don't visit the dashboard often).    * a schedule. Not just the simple "schedule for publishing on $date" thing for posts, but a calender accessible to authors and contributors, where events can be linked to existing posts and drafts.  It is probably wishful thinking to hope that all of this will be present in some way. But are there solutions which at least come close in some way, or which offer other good ways to solve our problems and create a working process out of this chaos?


SQL Bulk Move old posts by one author to another category

I'm looking to move a number of old posts by one author from one category to another category and was hoping someone could help me do this? I figure the easiest way would be through an SQL command? I'm aware that you can bulk 'move' posts via the post editor screen but this only adds another category and doesn't in fact move the posts. There are a number of different plugins out there that can bulk move posts but none of them allow you to select specific users and specific dates. In essence what I'm trying to achieve:   * select all posts from user with ID: 2   * **IF** posts are made **_before_** 15 Feb 2012 **AND** in category XYZ **THEN** move to category ABC Any help would be greatly appreciated.


get_the_tags() not iterating through for/while loop, but will with foreach

I'm having a very peculiar issue with Wordpress right now that I can't understand, and hopefully someone here will have experience with it to help solve it. I'm trying to iterate through the array returned by `get_the_tags()` using a standard loop (not foreach), but whenever I attempt to access it through index, it doesn't return anything. According to the Wordpress Codex, `get_the_tags()` returns an array of tag data that is associated with the post. Weirdly enough, a `foreach` structure works perfectly fine when dealing with it; however indexing it does not. Here's what I've tried:               $tags = get_the_tags();     $total = count($tags);     echo($total); // Returns 2          // This one does nothing         for($i=0; $i<$total; $i++){        echo($tags[$i]->name); // Does nothing     }          // This one works:     foreach($tags as $tag){         echo($tag->name); // Prints the tags, as it should     }      So for whatever reason, the above example using the index does _not_ work when it comes to `get_the_tags()`, but it works fine in a foreach loop. But that's not all that's weird. Using `get_tags()` to get all tags for the blog in an array in a similar fashion works fine in both situations! So for example:               $tags = get_tags();     $total = count($tags);     echo($total); // Returns 4          for($i=0; $i<$total; $i++){        echo($tags[$i]->name); // Prints the 4 tags     }          foreach($tags as $tag){         echo($tag->name); // Prints the 4 tags     }      They both return arrays of tags according to the Wordpress Codex, so what gives for the top one not working using an index? I'm trying to do something that requires access to the index (and dealing with more than 1 array, so it can't be a foreach). Would anyone have any ideas on how to fix it (or at least access the data)? Has anyone else experienced this bizarre issue?


First time using Multsite, not sure how to handle domains

So, I have a hosting account with a registered domain. I also have a domain with a different hosting company. Instead of installing two copies of WP in two different directories I'm giving Multisite a shot for the first time. I just need some clarification on how to handle the domain that's hosted elsewhere. I'm under the impression I need to use and configure the Domain Mapping plugin to point the offsite domain to the installation directory for the second site? Or, is there a better way?


How to make registration form ajax?

I have a registration form and I would like to make it ajax, is there such plugin or how can I adjust the standard wordpress registration page to be ajax without reloading page. Thanks in advance.


Exclude single page from function

//wraps the permalink around each thumbnail     add_filter( 'post_thumbnail_html', 'my_post_image_html', 10, 3 );          function my_post_image_html( $html, $post_id, $post_image_id ) {            $html = '' . $html . '';       return $html;      }      As the comment says, wraps the permalink around each thumbnail, but I'd like to exclude the link on single pages so I tried               //wraps the permalink around each thumbnail     add_filter( 'post_thumbnail_html', 'my_post_image_html', 10, 3 );          function my_post_image_html( $html, $post_id, $post_image_id ) {            $html = '' . $html . '';       return $html;       else {       if( is_single() ) {            $html = '';           return $html;                }                }     }      It breaks my site.


migrate a MU sub blog to a single install

I would like to convert one of my WordPress multisite blogs back to a single install on another server. it's not the main site but one of the subdomains. Is this possible?


Reverse chronology of post listing

I"m working on modifying a theme that is based on 2010. I want to make the posts on this blog display earliest to oldest, but I don't see how to do this in the theme: I understand I need to add `. "&order=ASC"` to a wp_get_posts query, but I can't find any. Just index.php: `get_template_part( 'loop', 'index' );` and loop.php it seems to have the posts already: `while ( have_posts() ) : the_post();` Where should I look?


Should I use SVN or Git?

I've never used version control before, but I'm starting to work more collaboratively on WordPress plugins and themes and I think it would be a good idea to have a record of versions and updates. WordPress seems to favour SVN, but Git seems to be the new, cooler alternative. Which version control do you use currently? And which system would you choose today if you were starting out in WP theme and plugin dev?


WPDB Insert or if exists Update

I'm not crazy familiar with WPDB or SQL in general but I have a custom table for my project and I'm trying to assign some metadata to it. What I'd "like" to happen is if a row exists, update it and if not insert it. I've read both Insert and Update in the WPDB Codex but neither really went into an "either or" situation. I thought i could work with update, so my code so far looks like this:               $wpdb->update(         $wpdb->prepare(             $wpdb->prefix.'item_info',             array(                 'post_id'       => $post_id,                 'item_stock'    => $item_stock             ),             array('post_id' => $post_id)         )     );      Does WordPress have anything like an "IF exists Update, ELSE Insert", or do I need to run custom SQL to achieve this, or do I need to query the database first to see if an ID exists in my table THEN decide whether to update it or insert it?


is it possible to replace the use of gd_lib with imagick or ImageMagick?

i'm looking around for a solution since weeks and can't make anything work yet. the problem is that my server is running debian/lenny and it's not supporting the bundled gd_lib which i need for thumbnailing/cropping stuff. but i could make use of imagick or imagemagick (package vs plugin). my question is: is there any way to replace the gd functions in media.php with the ones from imagick? AND is there a smarter way then modiyfing the media.php to do so? thanks


Is there any plugin to show number of clicks on the link?

I have a post having different links. I have to show number of clicks on each link. Is there any link to show number of clicks on the link?


Wordpress site isn't working with http, but https is fine

I'm hosting a wordpress site on the AWS EC2 plan, and I've set up an Elastic IP so I can host multiple sites. However, the wordpress site is only working when accessed with the https: protocol. When I use the http: protocol, only the front-page.php html gets loaded; no css, images, etc. I don't know if this is a problem with my Apache configuration or Wordpress, and my hunch is both; however, the reason I'm posting here is because the Wordpress site is _at least_ accessing the front-page.php. I only have one plugin installed, and I've updated it with Wordpress 3.9.2. In a nutshell: my GET requests to anything but '/' return a 404 when used with http; however, with https, everything works fine.


Will a plugin able to know is_user_logged_in?

I am currently building a plugin and it doesn't know when a user is logged in.               global $current_user;     echo $current_user->ID;      It works when embedded on a template but not on a plugin? I have a custom database that depends on user_id, whenever I insert a record, user_id field always has a zero value while others have the correct one.


Singular custom taxonomy label

I have a custom taxonomy called "Artists" which has the taxonomy singular name set to "Artist". If a post only has 1 artist I would like the label to be "Artist" instead of "Artists". How could I achieve this? My current code is below. Thanks!               <?php               $taxo_text = "";               $artists = get_the_term_list( $post->ID, 'artists', "

Artists

 ", '

', '

' );                    if ( '' != $artists ) {                   $taxo_text .= $artists;               }                    if ( '' != $taxo_text ) {                    echo $taxo_text;                    } // endif                    ?>


Make Customizer Load Specific Page

Is it possible to force the WordPress Theme Customizer to load a specific page? Or a page template? What about sample content. So instead of loading the home page content load dummy content that will help the user understand what it will look like with typical content instead of the content that's there right now. I haven't tried anything and am looking for some suggestions where to start. Perhaps some hooks to look at.


When using Tribe Events Calendar, querying for a specific event category returns nothing

I'm still new to wordpress and I'm trying to write a plugin but for some reason this code is producing nothing. Why? I am completely stumped. I have followed the examples here to a tee.               <?php         /*         Plugin Name: Text         */              add_action("init", "init_stuff");              function x_get_event_posts(){             $all_events = tribe_get_events(                 array(                     'eventDisplay' => 'all',                     'posts_per_page' => -1,                     'tax_query'=> array(                         array(                             'taxonomy' => 'tribe_events_cat',                             'field' => 'slug',                                 'terms' => 'xmlworkshopdonotuse'                             )                     )                 )             );                  echo count($all_events); // produces "0";         }              function init_stuff() {             x_get_event_posts();         }          ?>


Nested Shortcode Detection

If you are familiar with this code               <?php       $pattern = get_shortcode_regex();       preg_match('/'.$pattern.'/s', $posts[0]->post_content, $matches);       if (is_array($matches) && $matches[2] == 'YOURSHORTCODE') {         //shortcode is being used       }     ?>      from this website, but it does not work for nested shortcodes. Does anyone know how to make it work for nested shortcodes?


Get child terms of current term of the current post

I have custom post type "product" and taxonomy is "product_cat". There are two child terms -Music and videos. Under Music i have two more child terms albums and single. Now when i go to music category i want to get all the child terms of the music. I am using the following code               <?php $page_id = get_the_id(); ?>          <?php $cat_terms = wp_get_object_terms( $page_id, 'product_cat' ); ?>
<?php var_dump($cat_terms); ?>
               <?php foreach ($cat_terms as $terms  ) {?>     <?php $array = (array) $terms; ?>

<?php echo $array["name"]; ?>

                 <?php                        $args = array( 'post_type'=>'product',                       'tax_query' => array(                              array(                           'taxonomy' => 'product_cat',                           'field' => 'slug',                           'terms' => $array["name"],                         )                       )                     );                     $postslist = get_posts( $args );                             ?>                     <?php foreach ($postslist as $post) : ?>                         <?php $array1 = (array) $post; ?>                              <?php $image = wp_get_attachment_image_src( get_post_thumbnail_id($post->ID), 'shop_thumbnail' ); ?>
<img src="<?php echo $image[0]; ?>" alt="">
                     <?php endforeach; ?>
                 View all

     <?php } ?>      But this is giving me the Music category and one child i.e albums . But i just want album and single . Please help me out


Front-End Form Submission in Shortcode

The plugin I am working on contains shortcodes with forms on them. Upon form submission (POST), I do some database work, and then planned on redirecting to another page after the db work is complete. When I attempt this, I get the "Headers Already Sent" warning. Within the shortcode function, how do I call my redirect sooner than get_headers? Do I need to use some separate callback function?


How do I cleanly override a plugin's CSS with a child theme?

folks! I have taken it upon myself to adhere to WordPress conventions so I can have a clean, sexy child theme. However, I am unsure how to proceed on a certain issue. I would like to override the CSS for some plugins in my WordPress website, and this wonderful post was a great step in the right direction. My only concern is that I would like to do everything I can to **avoid overriding** the `header.php` file in my parent theme in order the do this. Is there another wonderful way to do this? Thanks for your help! **Update** : As was pointed out by another user's comment, this is in fact dependent on how the plugin implements its styles. This aside, assume that the plugins do provide a way for styles to be implemented in the `style.css` sheet of the child theme, or, in my case, a separate `styles` folder linked to that `style.css` sheet. I also know I can use `!important` all over the place, but this is generally frowned upon.


Worldpress uses local IP for URLs

I installed Worldpress in my PC and setup URL forwarding to my router to access the site from outside my home. everything works fine. but when I tried to load the page from outside it does not load the CSS and image files. I found reason that all the URLs uses the my home PC IP address. As example image urls like               http://192.168.1.2/wordpress/image1.jpeg      It is possible to configure WordPress to work without local IP


Qtranslate + Woocommerce (multiple tinymce)

I am using WooCommerce and qTranslate to develop an ecommerce website. I run into the following problems. I've googled it and days of trying to no avail. On the top of the product edit pages, the tinyMCE text area looks ok. It has several languages tabs along with visual and text editor tabs. However, at the bottom, the TinyMCE box for Short Description isn't integrated well with the qTranslate. The tool bar of it doesn't show up and there is no language tabs neither. Additionally, switching between the visual and text editor tabs is not working properly. A workaround I found on the Internet is to refresh the page every time. But it is not a solution. Apart from the problems above, every time the page refreshes, it seems that the cursor focuses in the box of the Short Description. If the Short Description is at the last section of the product edit page, the page will automatically scroll to where it is after reloading. I also tried to install TinyMCE Advanced and Ultimate TinyMCE to see if these two plugins can fix the problems, but also no luck. Cheers!!


Letting users create a post that is a custom post type from a page

I'm trying to create a kind of "Request for Proposals" system for a blog that belongs to a client of mine. I'm not too sure how to go about this, but so far I've outlined this much.. I know there will be two kinds of users for this. 1. Proposers 2. Speculators Proposers will be able to submit their proposals from the front-end of the site. Speculators will be able to login and see the page that lists all the most recent proposals, as well as view them individually. Speculators should be the only role allowed to do this. Now, I'm having a hard time figuring out how to create these two user types. I can see in Press Permit videos that he's got user roles like "Student" and a few others. But there isn't any video that shows how he was able to create those users.


Having Multisite websites expire

I'd like to have sites in a multisite installation expire and get deleted together with all their content and users, after a particular timeframe, say 1 week. How can I do this?


How can I get url from image tag in feed with fetch_feed?

I used this piece of code in `functions.php` to add featured image in `<image>` tag in feed               add_action('rss2_item', 'add_my_rss_node');          function add_my_rss_node() {         global $post;         if(has_post_thumbnail($post->ID)):             $thumbnail = wp_get_attachment_image_src(get_post_thumbnail_id($post->ID), 'medium');              $url = $thumbnail[0];             echo("<image>{$url}</image>");         endif;     }      then the URL of featured image displayed in feed as I expected. Now I want to pull this URL out, I tried `<pre>$item->get_title()</pre>` but it didn't show anything. Now I wonder how can I get this URL out? this' my feed: http://techdaily.vn/feed and I follow this guide to use feed_fetch http://codex.wordpress.org/Function_Reference/fetch_feed


Retrieve First Image Function

I am using this function to retrieve the first image from a gallery in a post. However this doesn't work properly when I re-order the images in the gallery. It is stuck with the first image at the first time of the upload. Any other ideas on always getting the first image as shown in the gallery?               function echo_first_image ($postID)     {                        $attachments = get_children(                                 array(                                       'numberposts' => -1,                                       'order'=> 'ASC',                                       'post_mime_type' => 'image',                                       'post_parent' => get_the_ID(),                                       'post_type' => 'attachment'                                       ));                         $first_attachment = reset($attachments);                    //$last_attachment  = end($attachments); or last image                    echo wp_get_attachment_image($first_attachment->ID, 'full');     }


Wordpress Widget plugin and input file

I am writing a widget plugin; and I want to insert an input tag:`<input type="file">` to browse for a pattern in my widget plugin admin panel; but I have problem to save its value(address of the pattern). It seems that `<input type="file">` doesn't work in widget plugins. Is it correct? Are there any other ways to browse a file from the admin panel? here is the input file code in the widget form function:               <fieldset id="customize">      <label>Browse pattern:</label>     <input type="file" accept="image/*" size="15" id="<?php echo $this->get_field_id('menupattern'); ?>" name="<?php echo $this->get_field_name('menupattern'); ?>" value="<?php echo $instance['menupattern']; ?>" />      </fieldset>       @s_ha_dum, I have been read the link about `enctype` ; but it wasn't helpful. please note that in the widget plugins I have to send data by the widget `form( $instance )` function, and I want to let the user to select a photo from the webserver; not to upload it!


How to get the deleted category id?

I want to do some action at the time of deleting a category using that category id. Is it possible to get the category id?


Remove swfobject.js in wp_head()

I have gotten rid of the wlwmanifest_link and jquery, since I load it from a compressed version and at the footer, but I can't find a way to get rid of the swfobject.js. This is the code I used to get rid of the other two in my functions.php file: `remove_action('wp_head', 'wlwmanifest_link'); if ( !is_admin() ) wp_deregister_script('jquery');` Replacing either with 'swfobject' does not remove it, so there must be another way.


CSS classes for theme

Does anybody know predefined (suggested by WP) CSS classes which should I use in my theme? I have seen somewhere in Internet a list of all CSS classes, which are used in WP theme, but can't find it. **UPDATE:** I have found the site where I've seen this list: http://www.wpbeginner.com/wp-themes/default-wordpress-generated-css-cheat- sheet-for-beginners/


Dashboard says "no posts found" even though there are some posts

I have a weird bug on the dashboard: the dashboard says there are a total of 3 posts, but the list is empty and says "No posts found" (see image below) ![enter image description here](http://i.stack.imgur.com/b6AoZ.png) It's a fresh install on a shared Windows hosting, using SQL Server as the database with the WP Db Abstraction plugin. I tried reinstalling WP completely and the bug is still there. Before I reinstalled WP, I had configured it for multi-site, and I had the same issue in the site list. I'm a complete newbie with WordPress and I have no idea how to fix this... any help would be greatly appreciated! * * * UPDATE: I investigated the queries issued to the database, and it seems that the query that is supposed to return the list of posts is this:               SELECT TOP 0 *     FROM wp_posts     WHERE 1=1     AND wp_posts.post_type LIKE 'post'     AND (wp_posts.post_status = 'publish' OR wp_posts.post_status LIKE 'future' OR wp_posts.post_status LIKE 'draft' OR wp_posts.post_status LIKE 'pending' OR wp_posts.post_status LIKE 'private')     ORDER BY wp_posts.post_date DESC      And of course, `TOP 0` returns 0 rows... this query seems to be generated by the DB abstraction plugin when it tries to translate the `LIMIT` clause to SQL Server. So I guess my only options are:   * fix the bug (doesn't seem easy, since there is no obvious translation for `LIMIT` in SQL Server)   * or switch to a MySQL database...


Reposition Woocommerce Message

I'm trying to reposition the messages in my Woocommerce theme. For example the successfully added to cart message. They appear to automatically be placed at the very top of where the woocommerce wrapper start begins. I've already found this link which allows me to change the wording of the message but what I need is to remove the message from where it is and reposition it elsewhere. I've scoured the woocommerce forum, this forum and the woocommerce template files. There is a messages.php but that only appears to contain the markup for the messages. I cannot figure out how to change where the messages appear. Any help on this would be greatly appreciated.


multi level menu not working and not displaying correctly

I have created a multi level menu with wordpress and no matter what i try the menu will not display correctly. here is the genereated menu

Latest

apps

app store

blackberry

play store

tablet apps

wp store

business

gadgets

galaxy note 2 and 3

galaxy s3/s4

htc one

huawei

iphone

meizu

motorola

nokia, LG

pantech

sony

mobile

iphone

android

blackberry

windows phone

tablets

acer

asus

ipad

note 10.1

note 8

surface

products

      here is the css i tried, its long so i put it in jsfiddle. i tried a few of the menus found on this site css menu maker and was able to get one to work. I know the css has #cssmenu ul li.has-sub and thats why it doenst work but i did change it to #cssmenu ul ul.sub-menu li for where it was needed and it didnt work. I tried looking for wordpress barebone multi level menu css so that i can work off of it but wasnt able to find anything.


How to add javascript just before the closing body tag in the footer of WordPress

I'm following some of the other people's advice here about adding my js file before the closing body tag but it doesn't seem to work for me. If someone would be so kind as to check this for me please?               <?php       /*load the js file into the footer*/       function myscript()        {        if( wp_script_is( 'jquery', 'done' ) ) {       ?>          <script type="text/javascript" src="js/scripts.js"></script>       <?php       }      }       add_action( 'wp_footer', 'myscript' );     ?>      Many thanks **EDIT:------------------------------------------------** This is the short solution.. `<script language="javascript" src="<?php bloginfo('template_directory'); ?>/js/scripts.js"></script>` not the right answer though is it? **EDIT---------------------------------------------------** This is what I am trying based on the WP codex examples and your points Fischi but think I am still doing something wrong..               function my_scripts_method() {     wp_enqueue_script(         'myscript',         get_bloginfo('template_directory') . '/js/scripts.js',         array( 'jquery' ),          '',          true     );      }               add_action('wp_enqueue_scripts', 'my_scripts_method');      The file still doesn't load into the footer.