title: How to enable thumbnails in RSS dashboard widget

text:
I'm successfully using fetch_feed() to display an RSS feed inside a dashboard widget. However, I'm unable to load the thumbnail image from the items in the feed. I'm attempting to do it with the get_image_url() method, however, WordPress errors out on that method as an undefined method. Code is below...               function example_dashboard_widget_function() {         // Display whatever it is you want to show            $rss = fetch_feed( "http://localhost/testsite/wp-content/test.rss" );               if ( is_wp_error($rss) ) {               if ( is_admin() || current_user_can('manage_options') ) {                    echo '
';                    printf(__('RSS Error: %s'), $rss->get_error_message());                    echo '
';               }          return;     }          if ( !$rss->get_item_quantity() ) {          echo '
No RSS items to show!
';          $rss->__destruct();          unset($rss);          return;     }          echo "
\n";          if ( !isset($items) )          $items = 10;               foreach ( $rss->get_items(0, $items) as $item ) {               $publisher = '';               $site_link = '';               $link = '';               $content = '';               $date = '';               $image = '';                    $image = $item->get_image_url();     //        $image = esc_url( strip_tags( $item->get_thumbnail() ) );                    $link = esc_url( strip_tags( $item->get_link() ) );                    $content = $item->get_content();               $content = wp_html_excerpt($content, 250) . ' ...';                   echo "
$link - $content
\n";     }          echo "
\n";     $rss->__destruct();     unset($rss);          }


title: Resizing Uploading Images in Bulk?

text: I have been running a blog for a friend and over the last months she has been adding insane amounts of images taken directly from a DSLR. Each takes up around 5-6 MB so the site is now slow to load and is consuming large amounts of bandwidth and disk size. I was looking on the smush.it plugin, but it doesn't seem to do it ad-hock and also, doesn't do bulk resize. Is there some easy way to fix this on the server with a plugin? Would prefer that instead of download all images and do bulk resize. Big thanks.


title: Add custom text color WordPress 3.9 TinyMCE 4 Visual editor

text: I had a code snippet which would help me to add some custom color to the visual editor text color dropdown along with the default colors. I'm pasting the snippet below.               function change_mce_options( $init ) {       $default_colours = '000000,993300,333300,003300,003366,000080,333399,333333,800000,FF6600,808000,008000,008080,0000FF,666699,808080,FF0000,FF9900,99CC00,339966,33CCCC,3366FF,800080,999999,FF00FF,FFCC00,FFFF00,00FF00,00FFFF,00CCFF,993366,C0C0C0,FF99CC,FFCC99,FFFF99,CCFFCC,CCFFFF,99CCFF,CC99FF,FFFFFF';       $custom_colours = 'e14d43,d83131,ed1c24,f99b1c,50b848,00a859,00aae7,282828';       $init['theme_advanced_text_colors'] = $default_colours . ',' . $custom_colours;       $init['theme_advanced_more_colors'] = true;       return $init;     }     add_filter('tiny_mce_before_init', 'change_mce_options');      After wordpress 3.9 update it stopped working, I've tried a lot to fix it, but I am unable to do it, can you please help me out?


title: Disable Specific Widgets on Selected Pages of a WordPress Website?

text: I would like to give a CMS look to some of my pages. I want to customize them by removing the default widgets and adding other widgets as my wish (I will use plugins like **My Custom Widget** to add custom codes if I need) . Is there any possibility to customize the specific pages like this?


title: PHP "Inception" - PHP within string

text: Posting this in Wordpress as my limited PHP knowledge leaves me thinking this might be WP-specific. I'm using WP's do_shortcode to call a shortcode into a post               echo do_shortcode('[mycred_video id="iYgPznBrjiA" amount="5" logic="interval" interval="15"]');      This embeds a Youtube video + extra code. So in order to have the content be dynamic I want to call on the content of a custom field I added to my posts, which I've used another plugin for. This is how I call it:               echo the_field( 'video_id' );      So I have to figure out how to call the content of that before the do_shortcode and then insert it in the string - right? Or is there language I can use in the string all by itself to call the content of video_id? The ultimate dream is to allow registered users be able to publish posts from the frontend. It seems I'll have to code that side of things myself, but do any of y'all know a good plugin that will give me a frontend editor I could include my custom field in? Much appreciated


title: How do I reply to comments from admin panel on a tablet PC?

text: For certain reasons I prefer to reply to readers' comments from the admin panel (edit-comments.php). It's not a problem with a mouse. When I place the cursor over a comment, the comment management links pop-up, including the reply option. It's shown below, albeit with the Russian UI. ![comment management](http://i.stack.imgur.com/KKGhN.png) The Reply link opens the reply form right below the comment. It doesn't work that way for me on a tablet PC. I can place a finger on the comment and the links appear, but when I try to press any link they all disappear. FWIW, I have an HP tablet and use IE10 (metro/desktop) on Windows 8, and have no desire to change the browser. Basically, there are two questions:   1. Is there an obvious option I'm missing that enables me to accomplish the goal?    2. If not, how can I modify WP behavior to display these links permanently? Thanks for your attention to my questions :)


title: How to Add Tags to Custom Post Type?

text: I have a custom post type called `portfolio` and I'm trying to add the tags taxonomy to it, how do I do this?


title: Wordpress Hacks/Defacing

text: Im trying to figure out how Wordpress sites become defaced/hacked. I know development very well. I know how to secure code, etc. But I am finding recently, that tons of Wordpress sites are becoming defaced. Both sites I developed, and others. Is it simply outdated Wordpress installs? Even when Wordpress is running version 3.1, sites are still being defaced. All user input is validated, both on the front-end and back-end. WP nonces are used wherever possible. Servers are fairly secure (not 777). ???? I'm loosing faith in Wordpress. If it is my fault, I will gladly admit and fix, but the only answer seems to be outdated Wordpress sites, and I find that hard to believe.


title: Quickest Way Besides FTP to Upload WordPress Files to a Web Server?

text: Assume I have SSH from a shared/managed-VPS hosting, and FTP access, but no fantastico. Thanks.


title: Membership Plugin

text: I'm looking for a good plugin for premium blog content. My client wants to offer 30 trial that's free as well as a paid monthly/6 months/yearly plan. It should display an except of the post for everyone even when they're on the site as a guest without any membership, trial or premium. It also needs to receive payments through PayPal and automatically turn on the subscription after payment. I want to be able to customize the register page to add additional fields like address and phone number.


title: Customizing Default Categories Widget

text: I am trying to hack the default categories widget from wordpress. I have the categories displaying the way I want but I am having trouble editing the output. The widget shows the number of posts in each post which is what I want, but it also displays the number in parenthesis. I don't want that. I know how to get rid of them but I can't seem to make it work. I tried like so               $cat_args['title_li'] = '';     $list = wp_list_categories(apply_filters('widget_categories_args', $cat_args));     $list .= str_replace('(', '', $list);     $list .= str_replace(')', '', $list);     echo $list;      It just continues to display the categories the same way. I don't understand why it's not echoing the list. I am using the code for the categories from the default-widgets.php file in the wp-includes folder.


title: How do I locate the exact location where this error is occurring 404 page not found

text: I recently installed a wordpress theme and lots of plugins. This error appears on blog post after refreshing page for second time anywhere in between the post content. Here's the link to my site: http://designer-grid.com/best-wordpress-plugins-for-2012-must-have/ > Not Found The requested URL /jquery-1.6.3.min.js was not found on this > server. > > Additionally, a 404 Not Found error was encountered while trying to use an > ErrorDocument to handle the request. > > Apache/2.2.22 (Unix) mod_ssl/2.2.22 OpenSSL/0.9.8e-fips-rhel5 > mod_auth_passthrough/2.1 mod_bwlimited/1.4 FrontPage/5.0.2.2635 > mod_fcgid/2.3.6 Server at www.jquerys.org Port 80


title: Customize the "respond" div on comments

text: I wanna ask if is possible to make my custom comments template, just for a reason: in `/wp-includes/comment-template.php`, there is a `<small>` wrapping the following code:               <?php cancel_comment_reply_link( $args['cancel_reply_link'] ); ?>      I could write a function inside my theme to remove that cancel comment reply link, but I don't know how to remove that `<small>` tag. See my filter:               add_filter('cancel_comment_reply_link', 'my_cancel_comment_link');     function my_cancel_comment_link() {         return false;     }      What could I do? I need to remove that because the website's owner have hired a SEO agency and, after a worst report, they asked to remove the cancel reply link, so I need to remove it.


title: Gravity Forms success modal

text: I'm trying to find a good way to get the success from my gravity forms to popup in a modal. Anyone have any examples or insight on this? I find gravity forms a little harder to customize then Contact Form 7. Thanks in advance!


title: How to search in two different wordpress blogs by using a single searchform?

text: How can i get search results from two different blogs [ www.mysite.com and www.blog.mysite.com ] using a single search form.


title: Gallery shortcode menu order fix no longer working on Wordpress 4.0

text: I currently use the pmc_gallery_menu_order_fix for setting the menu order for image attachments in galleries as seen here: Wordpress 3.5 Gallery Menu Order not set? With Wordpress 4.0, I am now getting an endless loop on the wp_update_post part of the code. Breaking it down, there appears the post IDs, arrays etc all seem to work properly but when it hits that update post seems to get wacky. Running into a out of memory error due to the endless loop it appears. Does anyone have another solution to update the menu_order for attachments from gallery shortcode?


title: WordPress Auth Cookie

text: I have 2 domains pointing on same WP installation, I want when user login under host1 (s)he be redirected to host2 and be logged in there too. Obviously because cookies under host1 aren't sent for host2. So I redirect user to host2 with cookies on the `GET` and set cookies on host2 again. On localhost where I tried every thing was ok but on remote server while the `wordpress_logged_in_<hash>` is present for host2 and is the same as one for host1, the user is not logged in on host2. why? * * * **edit** The problem was with presence of the cookies, in rechecking it was revealed that the required cookies were not sent because of another auto redirect for domain.com to www.domain.com


title: Use Custom Post Types, Get Template Part or Both when dealing with Taxonomies?

text: My Question headline might suck in which case any suggestions would be great:) I am having an issue with understanding in which context i should use and create a content-page.php vs. just calling in a custom post type to that specific content are of a page. I'm still struggling with taxonomies but making some headway today. This is relevant only because i'm creating a latest news area that will be displayed on 27 different pages (that all will use the same template) and so taxonomies will be the only way to distinguish this content. Thanks to s_ha_dum for showing me to the taxonomy query page here on the codex but i'm still a bit confused as to how i should structure a tax_query array whether it be in a content-page.php or within a template.php file. Let assume the former (content-page.php) so that i'd be calling in a content area into my template through the means of:               <?php get_template_part( 'content', 'latest-news' ); ?>      Then on the actual content-latest-news.php page i write a query with an argument array like this:               $args = array(                 'post_type' => 'latest_news',                 'tax_query' => array(                        array(                        'taxonomy' => 'news',                        'field' => 'slug'                        )                 )         );              $the_query = new WP_Query( $args );              ?>      Assuming i have already created a taxonomy for 2 pages "homepage" and "adams- morgan" (neighborhood name which i would create 26 more taxonomies but i'm just testing small scale first) how could this argument possibly know which taxonomy to call on? In my actual case the content area calls on all taxonomies so i'm trying to figure out at what point or where do i specify my "homepage" taxonomy so that on my front-page.php that's calling the `<?php get_template_part( 'content', 'latest-news' ); ?>` it knows to only show latest news from the custom post type that has that taxonomy? I'm probably going to use the `<?php get_template_part( 'content', 'latest- news' ); ?>` on my templates rather than put the extra markup directly into my template files just to keep them leaner and the markup further abstracted although i'm not certain if this is a good way to do this, any advice? To summarize my questions are:   1. Should i be separating content areas into their own php pages if they are to be used on several pages?   2. How can i write the correct argument with the proper array so that when i'm going to anyone of the 27 neighborhoods (after all of their taxonomies are created of course) WordPress will know which content to generate?


title: Tag search not working after permalink structure change

text: I recently changed my permalink structure from the default one /?p=123 to Post name, /sample-post/. That went well except that now the tag search doesn't work. Previously, when I clicked on the tag in the tag cloud, I would get /?tag=tag- name, and it worked. Now the structure is /tag/tag-name, and when clicking on it, it doesn't list the posts with that tag, but instead, it redirects to the post that has that tag in its title. This is my tag cloud:               <?php wp_tag_cloud(array(                        'smallest' => 15,                        'largest' => 15,                        'unit' => 'px',                        'number' => 45,                        'orderby'  => 'name',  alphabetically                        'order' => 'ASC', ascending order                        'taxonomy' => 'post_tag'                        )); ?>      I can't post comments, so: @TheDeadMedic Thanks for replying. The settings are: Front page displays: Your latest posts. Yes, the permalink is %postname%, but the same thing happens with any other permalink settings.


title: Best way to handle lack of titles in microblogging

text: I'm experimenting with doing "microblogging" with WordPress and I'm doubtful about how to handle "titles" when one uses different post "formats" (the "formats" may or may not be related with the core WP functionality). Many microblogging services don't feature any kind of title field, yet when a title is needed for technical reasons, like HTML page title, the permalink or the RSS post title, it is auto-generated from meta data (like the post date) or from a short excerpt of the text in the post. There are cases when the user puts _no_ text at all like with images or videos (which is not a good practice, but that's another issue); in those cases, in Tumblr at least, the HTML page title is absent, the permalink is only the post 'id' and the RSS title is merely the name of the "format" of the post. I'm in a dilemma about which could be the best practice for handling empty titles, in cases where is optional to have them:   1. _Auto-generating_ the title from the first characters in the content of the post. The theme has to have a function to not show the title when it coincides with the first characters of the "content". That's how the P2 theme works, yet besides of the auto-generating title function itself, I don't know if the option of conditionally not showing the title in the loop can be used in a generic plugin. Also, there may be cases when is not clear if the title is auto-generated (and can be auto-replaced) or actually a custom input.   2. Don't auto-generate the post title at all and leaving them empty, but _still_ generate an automatic title for HTML page titles, post slugs and RSS feeds. This may solve some issues with the previous method, yet I don't know how to generate HTML page titles and RSS feed titles without creating whole custom templates instead of a simple function. Although I feel having posts in the dashboard with no title may be awkward to manage.


title: wordpress plugin setting page not enqueueing jquery?

text: on a setting page for my custom plugin i ahve the following:               function wbvpe_load_scripts($hook) {         global $wbvpe_settings_page;         if( $hook != $wbvpe_settings_page )          return;              wp_register_script('search', plugins_url('search.js', __FILE__), array('jquery'), null, true);         wp_enqueue_script('search');     }     add_action('admin_enqueue_scripts', 'wbvpe_load_scripts', 20, 1);      When viewing the source of the page i can see the above gets outputted correctly. However there is no trace of jquery being loaded? I added the following to see what was happening:               $wpScripts = new WP_Scripts();     if($wpScripts->query('jquery','enqueued')){         echo 'enqueued';     } else { echo 'not enqueued';}          if($wpScripts->query('jquery','registered')){          echo ' - registered';     } else { echo ' - not registered';}      The output was:               not enqueued - registered      So jquery is getting registered but not enqueued. I tried to enqueue jquery again like this:               wp_enqueue_script('jquery');      But still nothing! Any ideas what the issue could be? This is the only jwery i can see getting loaded:               <script type='text/javascript' src='http://xxxxxxx/wp-admin/load-scripts.php?c=0&load%5B%5D=jquery-core,jquery-migrate,utils&ver=3.9'></script>


title: Page Template Dropdown For Custom Post Types

text: I am using the following code to create a dropdown on the edit post screen which will allow users to choose page templates for the post type. The code is working but when I try using it multiple times (for each post type) it no longer works. I am trying to have a dropdown for 3 post types, and each post type will have their own selections. Heres my code for the one post type ---               function attorney_template_meta_box($post) {       if ( 'attorney' == $post->post_type && 0 != count( get_post_templates() ) ) {         $template = get_post_meta($post->ID,'_attorney_template',true);         ?>     <?php _e('Attorney Template') ?><select name="att_post_template" id="att_post_template">     <option value='default'><?php _e('Default Template'); ?></option>     <?php post_template_dropdown($template); ?>     </select>     <?php       } ?>     <?php     }     add_action('add_meta_boxes','add_attorney_template_metabox');     function add_attorney_template_metabox() {         add_meta_box('postparentdiv', __('Attorney Template'), 'attorney_template_meta_box', 'attorney', 'side', 'core');     }     function get_post_templates() {       $themes = get_themes();       $theme = get_current_theme();       $templates = $themes[$theme]['Template Files'];       $post_templates = array();            if ( is_array( $templates ) ) {         $base = array( trailingslashit(get_template_directory()), trailingslashit(get_stylesheet_directory()) );              foreach ( $templates as $template ) {           $basename = str_replace($base, '', $template);           if ($basename != 'functions.php') {             // don't allow template files in subdirectories             if ( false !== strpos($basename, '/') )               continue;                  $template_data = implode( '', file( $template ));                  $name = '';             if ( preg_match( '|Attorney Template:(.*)$|mi', $template_data, $name ) )               $name = _cleanup_header_comment($name[1]);                  if ( !empty( $name ) ) {               $post_templates[trim( $name )] = $basename;             }           }         }       }            return $post_templates;     }     function post_template_dropdown( $default = '' ) {       $templates = get_post_templates();       ksort( $templates );       foreach (array_keys( $templates ) as $template )         : if ( $default == $templates[$template] )           $selected = " selected='selected'";         else           $selected = '';       echo "\n\t<option value='".$templates[$template]."' $selected>$template</option>";       endforeach;     }     add_action('save_post','save_att_post_template',10,2);     function save_att_post_template($post_id,$post) {       if ($post->post_type=='attorney' && !empty($_POST['att_post_template']))         update_post_meta($post->ID,'_attorney_template',$_POST['att_post_template']);     }     add_filter('single_template','get_post_template_for_template_loader');     function get_post_template_for_template_loader($template) {       global $wp_query;       $post = $wp_query->get_queried_object();       if ($post) {         $post_template = get_post_meta($post->ID,'_attorney_template',true);         if (!empty($post_template) && $post_template!='default')           $template = get_stylesheet_directory() . "/{$post_template}";       }       return $template;     }      by itself its fine, but when I try to add another one, it doesnt work. The metabox shows up but the drop down doesnt and the original post type's template doesnt even take into effect. Here's the additional code               // Practice Area     function pract_template_meta_box($post) {       if ( 'practice-area' == $post->post_type && 0 != count( get_post_templates2() ) ) {         $template = get_post_meta($post->ID,'_practa_template',true);         ?>     <?php _e('Practice Areas Template') ?><select name="pract_post_template" id="pract_post_template">     <option value='default'><?php _e('Default Template'); ?></option>     <?php post_template_dropdown2($template); ?>     </select>     <?php       } ?>     <?php     }     add_action('add_meta_boxes','add_pract_template_metabox');     function add_pract_template_metabox() {         add_meta_box('postparentdiv', __('Practice Area Template'), 'pta_template_meta_box', 'practice-area', 'side', 'core');     }          function get_post_templates2() {       $themes = get_themes();       $theme = get_current_theme();       $templates = $themes[$theme]['Template Files'];       $post_templates2 = array();            if ( is_array( $templates ) ) {         $base = array( trailingslashit(get_template_directory()), trailingslashit(get_stylesheet_directory()) );              foreach ( $templates as $template ) {           $basename = str_replace($base, '', $template);           if ($basename != 'functions.php') {             // don't allow template files in subdirectories             if ( false !== strpos($basename, '/') )               continue;                  $template_data = implode( '', file( $template ));                  $name = '';             if ( preg_match( '|Practice Area Template:(.*)$|mi', $template_data, $name ) )               $name = _cleanup_header_comment($name[1]);                  if ( !empty( $name ) ) {               $post_templates2[trim( $name )] = $basename;             }           }         }       }            return $post_templates2;     }     function post_template_dropdown2( $default = '' ) {       $templates = get_post_templates2();       ksort( $templates );       foreach (array_keys( $templates ) as $template )         : if ( $default == $templates[$template] )           $selected = " selected='selected'";         else           $selected = '';       echo "\n\t<option value='".$templates[$template]."' $selected>$template</option>";       endforeach;     }     add_action('save_post','save_pta_post_template',10,2);     function save_pta_post_template($post_id,$post) {       if ($post->post_type=='practice-area' && !empty($_POST['pta_post_template']))         update_post_meta($post->ID,'_practa_template',$_POST['pta_post_template']);     }     add_filter('single_template','get_post_template_for_template2_loader');     function get_post_template_for_template_loader2($template) {       global $wp_query;       $post = $wp_query->get_queried_object();       if ($post) {         $post_template2 = get_post_meta($post->ID,'_practa_template',true);         if (!empty($post_template2) && $post_template2!='default')           $template = get_stylesheet_directory() . "/{$post_template2}";       }       return $template;     }      _**EDIT_** The first code snippet works by itself, but the second code snippet doesnt work by itself.


title: Can WordPress change links automatically?

text: I keep making WordPress sites on temporary domains (say: example.com), and then to go live with them, I just move entire installation to new server and change temporary domain to live domain (say: mysite.com). This is easy. I, however, wonder how all the internal links (say: example.com/hello) inside posts' and pages' content of WordPress automatically get rid of old temporary domain and get replaced with new live domain (mysite.com/hello) and things just keep working? Is there any automatic script which keeps track of the setup domain, and updates all the domained links in all posts as soon as main domain changes?


title: Add section to custom menu panel

text: I would like to add a new section in the custom menu panel that would allow predetermined URLs to be added to a custom menu. For example, I would like a custom post type archive page. I know that they can be added manually by specifying the URL in the custom link section, but then if the site URL changes then the custom menu needs to be changed as well. Can someone please point me in the correct direction for this?


title: How to remove index.php from a tag or archive page URL in the root blog?

text: I'm developing a Multisite where the root site is an agregator (using the mu- sitewide-tags plugin). I created a custom widget to show tags across all sites, but when I click on the tag page on the main blog, it loads like this: http://example.com/index.php/tag/name_of_the_tag/ I tried to remove it creating a custom permalink, but wordpress doesn't allow to take it off. Is that possible to do it? Any idea?


title: Shortcode does not expand in Facebook like

text: I am using Facebook Like Button plugin on pages that just contains a shortcode. When I Like the page and post to Facebook, it shows the shortcode without expanding it. I want to show the expanded contents in Facebook activity stream


title: How to add captcha to publish widget

text: I want to add a captcha challenge to the "publish post" widget in "add new post" to prevent spam posts. This is because my site is open to registrations and posting. Could someone please suggest how I would go about this as I am not a programmer and wouldn't know where to start? Would a plugin be able to do this? If so how would i go about this?


title: How to link two news page multilingual press

text: I have two sites one in English and one in Finnish I have post page for English as News and Finnish as Uutiset I was able to link single news posts from news to uutiset and vice versa but when I tried to link the page News to Uutiset it is not working it takes me to home page. The plugin I am using is mutlilingual Press


title: Showing author page if user has no post

text:
I have a page with profiles in which people can post or `comment` on a `post`. The problem is that if this user chooses to comment instead of post, he or she will not get an `author page` until it has submitted a post. Is there a way to show the author page anyway? Because I have a function that shows the comments on the author page, but because it has no posts in it, that won't show too... I hope someone can help me out. PS: I already tried several plugins, but those things didn't work out. FYI: this is default behavior of Wordpress and I am using the default `author.php` template which has an "`if have posts`" loop, if not, `loop-no- posts` loop. So the author page is not created is there is no post. That is the whole point. Edit: my code:                       <?php if (have_posts()) : ?>
<?php         global $wpdb;         $user_id = $post->post_author;           $where = 'WHERE comment_approved = 1 AND user_id = ' . $user_id ;              $user = get_userdata($user_id);              ?>             <?php while (have_posts()) : the_post(); ?>                      <?php responsive_entry_before(); ?>                 <article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>

                         <?php if ( has_post_thumbnail()) : ?>                             <a href="<?php the_permalink(); ?>" title="<?php the_title_attribute(); ?>" >                                                           <?php endif; ?>                         <?php the_excerpt(); ?>
                     <?php responsive_entry_after(); ?>                  <?php              endwhile;                   /* get_template_part( 'loop-nav' ); */              else :                   get_template_part( 'loop-no-posts' );               endif;          ?>                 <?php         $args = array(             'user_id' => $user->ID,             'number' => 10, // how many comments to retrieve             'status' => 'approve'             );              $comments = get_comments( $args );              if ( $comments )         {             foreach ( $comments as $c )             {             $output.= '';             $output.= get_the_title();             $output.= '';             }                  echo $output;         } else { echo "bla";}?>


title: Display category multi-select with Advanced Custom Felds

text: I'm trying to have a multi-select where users can select which categories they want in a template. The functionality i want is similar to the "Select" field type but only pulling through categories to display NOT posts of those categories. I've got the multi-select working fine and high-lighting the selected options of that page but in the templates, the values are not displayed using: * * *               <?php var_dump(get_field('featured_tags')); ?>      The full code of the custom field type below:               <?php          class acf_Section extends acf_Field     {              /*--------------------------------------------------------------------------------------         *         *   Constructor         *         *   @author Elliot Condon         *   @since 1.0.0         *   @updated 2.2.0         *         *-------------------------------------------------------------------------------------*/              function __construct($parent)         {             parent::__construct($parent);                  $this->name = 'section';             $this->title = __("Section",'acf');                  // filters (for all fields with choices)             add_filter('acf_save_field-select', array($this, 'acf_save_field'));              }                        /*--------------------------------------------------------------------------------------         *         *   create_field         *         *   @author Elliot Condon         *   @since 2.0.5         *   @updated 2.2.0         *         *-------------------------------------------------------------------------------------*/              function create_field($field)         {             // vars             $defaults = array(                 'value'         =>  array(),                 'multiple'      =>  0,                 'allow_null'    =>  0,                 'choices'       =>  array(),                 'optgroup'      =>  0,             );                  $field = array_merge($defaults, $field);                       // no choices             if(empty($field['choices']))             {                 echo '<p>' . __("No choices to choose from",'acf') . '</p>';                 return false;             }                       // multiple select             $multiple = '';             if( $field['multiple'] )             {                 // create a hidden field to allow for no selections                 echo '<input type="hidden" name="' . $field['name'] . '" />';                      $multiple = ' multiple="multiple" size="5" ';                 $field['name'] .= '[]';             }                       // html             echo '<select id="' . $field['id'] . '" class="' . $field['class'] . '" name="' . $field['name'] . '" ' . $multiple . ' >';                  $args = array(                 'orderby' => 'name',                 'parent' => 0,                 'taxonomy' => 'sections',             );                  $categories = get_categories($args);                  $field['choices'] = '';                  foreach($categories as $cat) {                      $selected = '';                 if(is_array($field['value']) && in_array($cat->term_id, $field['value']))                 {                     // 2. If the value is an array (multiple select), loop through values and check if it is selected                     $selected = 'selected="selected"';                 }                      echo '<option value="'.$cat->term_id.'" '.$selected.'>'.$cat->name.'</option>';             }                  echo '</select>';         }                   /*--------------------------------------------------------------------------------------         *         *   create_options         *         *   @author Elliot Condon         *   @since 2.0.6         *   @updated 2.2.0         *         *-------------------------------------------------------------------------------------*/              function create_options($key, $field)         {              }              function update_value($post_id, $field, $value)         {             // save value             parent::update_value($post_id, $field, $value);         }                   /*--------------------------------------------------------------------------------------         *         *   pre_save_field         *   - called just before saving the field to the database.         *         *   @author Elliot Condon         *   @since 2.2.0         *         *-------------------------------------------------------------------------------------*/              function acf_save_field( $field )         {             // vars             $defaults = array(                 'choices'   =>  '',             );                  $args = array(                 'orderby' => 'name',                 'parent' => 0,                 'taxonomy' => 'sections',             );                  $categories = get_categories($args);                  $field = array_merge($defaults, $field);                  foreach($categories as $cat) {                 $field['choices'] .= $cat->term_id.' : '.$cat->name."\n";             }                       // check if is array. Normal back end edit posts a textarea, but a user might use update_field from the front end             if( is_array( $field['choices'] ))             {                 return $field;             }                       // vars             $new_choices = array();                       // explode choices from each line             if( $field['choices'] )             {                 // stripslashes ("")                 $field['choices'] = stripslashes_deep($field['choices']);                      if(strpos($field['choices'], "\n") !== false)                 {                     // found multiple lines, explode it                     $field['choices'] = explode("\n", $field['choices']);                 }                 else                 {                     // no multiple lines!                     $field['choices'] = array($field['choices']);                 }                           // key => value                 foreach($field['choices'] as $choice)                 {                     if(strpos($choice, ' : ') !== false)                     {                         $choice = explode(' : ', $choice);                         $new_choices[trim($choice[0])] = trim($choice[1]);                     }                     else                     {                         $new_choices[trim($choice)] = trim($choice);                     }                 }             }                            // update choices             $field['choices'] = $new_choices;                       // return updated field             return $field;              }                   /*--------------------------------------------------------------------------------------         *         *   get_value_for_api         *         *   @author Elliot Condon         *   @since 3.1.2         *         *-------------------------------------------------------------------------------------*/              function get_value_for_api($post_id, $field)         {             $value = parent::get_value($post_id, $field);                  if($value == 'null')             {                 $value = false;             }                  return $value;         }          }          ?>


title: Displaying or Hiding Metadata on Page from WP CPanel

text: I have a custom post type called "Celeb". This CPT contains two Taxonomy terms as "Men" and "Women".Each Post has two metadata as "Name" and "Age".   ![enter image description here](http://i.stack.imgur.com/eCbuT.png) Now I would Like to add a "Visibility" checkbox to WordPress CPanel to enable or disabe displaying the "Age" metadata on the page based on the Terms.   For example I would like to Hide the Age for all post under the ONLY "Women" Taxonomy term when the checkbox has been checked or vice versa.Can you please let me know how I can do this? * * * **Update:** ![enter image description here](http://i.stack.imgur.com/DlAk4.png) ![enter image description here](http://i.stack.imgur.com/a8sCL.png)


title: can't post immediately

text: something weird has happened to my sites. i can't seem to post any page or post immediately. it says post immediately, but when i do, it instantly changes to schedule for dec 2013. I thought it was on one site, but on checking 2 more sites i have, the same thing happens. i've checked general settings and checked the dates and time and set it to london which is where i am but not change. really baffled, anyone? thanks


title: multisite htaccess 301 redirects

text: I've got a multisite sub-domain install with 3 sites on it. 2 of the sites use domain mapping. The main site (id=1) requires several 301's that are old pages from a previous structure such as:               Redirect 301 /about/careers/ /contact/careers/      One of the other sites (id=3) has content that has moved into the main site. Normally, I'd redirect this in the .htaccess of that site:               Redirect 301 /news/events/ http://domain.com/news/events/      Multisite only has one .htaccess file. Is there a way to add 301 redirects for each individual site/domain from the main .htaccess file?


title: Group posts by date with a list

text:
I want to set a group of posts grouped by date as a list. Below is what I would like to have:               Day...

Lorem ipsum

     Previous day...

Lorem ipsum

Lorem ipsum

      I did that:               <?php while (have_posts()) : the_post(); ?>     <?php the_date(); ?>
<?php the_time(); ?><?php the_title(); ?>
     <?php endwhile; ?>      I don't really know where to put the
 or
 tags. Any idea? Actually, setting the starting tag is OK by doing this:               <?php the_date('','','
'); ?>      But I can't figure out how to set the closing tag. Regards, Alex


title: How do we remove the H3 tag for the reply-title I.D

text:
We're doing some SEO tweaking to a site, and our SEO guru informs us that we need to remove the `<h3>` tags from the `#reply-title` element, output from line 1554 of `comments-template.php`. It's the header text for the comments form. as seen here :               <?php if ( comments_open( $post_id ) ) : ?>             <?php do_action( 'comment_form_before' ); ?>

<?php comment_form_title( $args['title_reply'], $args['title_reply_to'] ); ?> <?php cancel_comment_reply_link( $args['cancel_reply_link'] ); ?>
                 <?php if ( get_option( 'comment_registration' ) && !is_user_logged_in() ) : ?>      We're aware of the numerous filters and hooks associated with the `comment_form();`, but that `<h3>` is hard-coded. for this, we've been unable to come up w/ a sustainable solution to replacing the `<h3 id="reply-title"></h3>` with just `<div id="reply-title"></div>`. it's starting to look like the quickest / easiest option may be to just unhook the call to `comment_form()`; and hook in a copy of our own function, which would be just a copy, with a simple change to that one line. But in the meantime, it never hurts to poll the community. Any ideas on how to modify that markup in a sustainable ( non-core hackable ) way? It should be noted that this can't be solved w/ some CSS or JS. The actual, crawlable DOM has to be dealt with. thanks again stack.


title: Get posts by meta value

text: I would like to list all posts that have a key of `cp_annonceur` with the value `professionnel`.


title: Using fetch_feed to retrieve items with non common titles

text:
I'm trying to fetch some feeds using `fetch_feed`, however, into the for `foreach`, as the documentation says, I can access to values with common titles like title, permalink, etc using the `get->` method, how can I access to those which looks like this:                <SO:AppId>617422</SO:AppId>      Where those `:` generates error on my code. Any ideas?, the feed looks like this:                channel         title         link         image           title           url         item           SO:AppId           SO:AppName           SO:AppTime      I need to access those with the `SO:` into a `foreach` which using the `get->SOMETHING` method. UPDATE****** This is my function:                function get_external_feed($url, $number = 16) {     $rss = fetch_feed( $url );     if ( ! is_wp_error( $rss ) ) :         $maxitems = $rss->get_item_quantity( number );          $rss_items = $rss->get_items( 0, $maxitems );         return $rss_items;     endif;           }      and my foreach looks like this:                <?php if (count($feeds) == 0 ) : ?>
No upcomming dates so far, come back later for more!
      <?php else : ?>      <?php foreach ( $feeds as $item ) : ?>            <?php $item->get->title(); ?>      <?php endforeach; ?>      <?php endif; ?>


title: Defining 'last' class on foreach blog posts

text:
I'm using the following code to display the latest 3 blog posts on my front page but I need to add a `last` class to the 3rd post on the ID `blog`.               <?php     $args = array( 'numberposts' => 3 );     $lastposts = get_posts( $args );     foreach($lastposts as $post) : setup_postdata($post); ?>

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

       <?php the_excerpt(); ?>
     <?php endforeach; ?>      What do I need to add to achieve this?


title: Separate wp_user based on blog / site at WP Multisite?

text: I used Woocommerce 2.1.7 installed at WP Multi User Version 3.9 I have 2 sites under WPMU, let's say   * site1.example.com --> admin_site1    * site2.example.com --> admin_site2      1. **Problem #1** After shop at `site2.example.com` and checkout, then I choose login (returning user), I login using admin_site1 and it succesfully login. `admin_site1` is user of `site1.example.com` and why still can checkout-login at `site2.example.com`.     2. **Problem #2** After shop at `site2.example.com` and checkout, then I choose register user, I using `admin_site1` data (email and username) and I got error message `"An account is already registered with your email address. Please login."` `admin_site1` is not registered yet as user at site2, but I can't register. I found the problem because single `wp_users` table. Is there a way to separate `wp_users` based on blog ID?


title: Using MIT Licensed niftyPlayer in a WordPress Hosted Plugin (Premium and Free versions)

text: Apologies in advance if I meander in this question, I am trying to grasp my brain around the different licensing models and yes, I know most of you are not lawyers. I am developing a WordPress Plugin that I intend on publishing a free version to the WordPress Plugin Directory and a premium version sold elsewhere. My plugin incorporates the Adobe Flash-based niftyPlayer (http://www.varal.org/niftyplayer/) which is licensed under the MIT License. The varal.org site states: > This program is licensed under the MIT License, which, to put it in non- > legal terms, allows you to share, use and modify it. Even for commercial > purposes. Check out the Wikipedia article on this license for more. Since a WordPress Plugin by its own nature is a derived work from GPL-licensed WordPress it needs to be licensed under GPL and I believe that the GPL requires that any work containing GPL-licensed software must be relicensed in its entirety under the terms of the GPL. With the plugin I am writing the player itself does not make any direct interactions with the WordPress core, it is just used on top of the site. Would the need to relicense apply to using the niftyPlayer in the plugin? Since the MIT license is pretty un-restricted, can I, and if so, how do I go about re-licensing it? I have some follow-up questions but they essentially pertain to the need to re-license/not.. Thanks for any insight.


title: Walker Class : extract function and wp_list_pages

text:
I'm just analyzing my custom Walker Class because it frequently skips over some post_meta data that I append to the $output HTML. Even though the Custom Fields are set, they are ignored by the Walker. They are only shown when I go back to my functions.php, and re-run the function that sets the Custom Fields. The **extract** function is used to obtain the arguments and skips over the arguments with the new ones provided in the walker. invalid/numeric keys and collisions are Skipped in this case, so I would assume that my Custom Walker is being run each time. I'll give an example of how it obtains the Custom Field:               $CommentCount = get_post_meta($page->ID, 'num_comments_in_Tree', true);         if(empty($CommentCount)){             $CommentCount = "";         }else{$CommentCount = '          comments: (' . get_post_meta($page->ID, 'num_comments_in_Tree', true)         . ') ';}              $MetaOutput = $CountChildren . $PageLastModifiedDate .          $CommentCount . $LastCommentDate . $Description;              $output .= $indent .                      '

ID) . '" title="' .                      esc_attr( wp_strip_all_tags( apply_filters( 'the_title', $page->post_title, $page->ID ) ) ) . '">' .                      $link_before . apply_filters( 'the_title', $page->post_title, $page->ID ) . $link_after . '' . $MetaOutput . '
';      ^See the end of the last line for the $MetaOutput. I don't know why, if the Custom Fields are set on each page, they will only show if I re-run the function that sets the Custom Fields.


title: Dynamically textarea with TinyMce editor

text: I need to used TextArea with Wysiwyg editor. That works when textarea is write on page ( Not dynamic , static ).. but my problem is for dynamically textarea. My code :               add_action('admin_head', 'load_tiny_mce');       function load_tiny_mce() {          // The 'mode' and 'editor_selector' options are for adding           // TinyMCE to any textarea with class="tinymce-textarea"           wp_tiny_mce(true, array(               'mode' => 'specific_textareas',              'editor_selector' => 'tinymce-textarea'          ));      }      I added textarea with javascript code when i push a button. textareas is basic not with wysiwyg editor ... ! I think i need to bind function ... but how to ! I hope, you understand me .. ! Regards


title: stripping tags from excerpt in Wordpress is not working

text: I am using this snippet               <a href='<?php the_permalink() ?>' title='<?php echo strip_tags(the_excerpt()); ?>      with which I am intending to remove all `ellipses`, `<p>` tags and other `shortcodes` and `links`, but that does not work at all. If I hover the anchor, I am still getting to see the `<p>` wrapped in the excerpt, as well as other tags and the url links. What am I doing wrong and what do I have to do to get it working?


title: Shortcode to output get_header not working

text:
I'm trying to create a shortcode that will output the contents of one of my template header files. I created the shortcode in my `functions.php` file               function zoo_header(){       return 'test'.get_header('navbar');     }     add_shortcode('zoo-header', 'zoo_header');      And use it in my templates: `[zoo-header]` or `do_shortcode('[zoo-header]')` However, the output of the shortcode is simply 'test'.   Why is the content of my header-navbar not showing up?               #header-navbar.php     <?php wp_nav_menu( array(       'theme_location' => 'right-menu',       'container' => false,       'menu_id' => 'navbar-right',       'menu_class' => 'nav navbar-nav navbar-right'     )); ?>
testing 123
      It's as if `get_header()` is not returning anything. I would expect at least the testing 123 to show up... A little background: I have 2 headers that I need to show, and I wanted to give the template authors the option to choose between one or the other.   I also tried using the `get_template_part('header', 'navbar')` with no success.


title: How to automatically apply a password to all posts within a custom post type

text: I am creating a custom post type, for which I want all posts to be password- protected with the same password. I realize that I can set a password on a post-by-post basis from within the admin panel, however this seems tedious and prone to error/forgetfulness. I'm sure there's a way to make this happen with some kind of filter, but I just don't know where to start. Any help would be greatly appreciated. Thanks!


title: Multiple Menu Selections to compile data on new page

text: Need to create a menu box (vertical stack of 4 selections) on a page, which then calls from either a database or CSV file, final combination of items required as follows:   * Selection 1: >MenuItem< ------> six options   * Selection 2: >MenuItem< ------> four options   * Selection 3: >MenuItem< ------> nine options   * Selection 4: >MenuItem< ------> three options With the results dynamically compiled on a new page. Any thoughts how to do this would be a great help! (page functionality needs to be like: http://www.biz2credit.com/apply-for- business-loans)


title: Wordpress admin screen failing to appear

text: Just started learning Wordpress and this started to happen right after I accidently moved a couple core files around, i put everything back and everything works its just that accessing `http://localhost:8888/smh-wp-2/wp- admin/` will just go to a screen like this http://i.imgur.com/ICiqSsG.png. Halp!


title: Help with url rewrite

text: How can I turn a URL like: `http://site.com/?project=5` into: `http://site.com/project/5/` ? I was looking the rewrite doc here: http://codex.wordpress.org/Class_Reference/WP_Rewrite#Examples and came up with this               // Adding a new rule     function my_insert_rewrite_rules( $rules )     {       $newrules = array();       $newrules['(project)/(\d*)$'] = 'index.php?project=$matches[2]';       return $newrules + $rules;     }          // Adding the id var so that WP recognizes it     function my_insert_query_vars( $vars )     {         array_push($vars, 'project');         return $vars;     }          add_filter( 'rewrite_rules_array','my_insert_rewrite_rules' );     add_filter( 'query_vars','my_insert_query_vars' );     add_action( 'wp', 'test');          function test()     {      global $wp_rewrite;      $wp_rewrite->flush_rules();      if(isset($_GET['project'])){        echo $_GET['project'];        exit;      }          };      but it doesn't work when I access for example http://site.com/project/2/


title: How to add logo to rss feed

text: I came across this function to add image to rss feed. However, I keep getting lots of syntax errors.               /* Add RSS Logo */          function addRssImage() {       echo "<image>         <title>My Title</title>         <url>" . get_bloginfo('template_directory') . "/images/logo.png</url>         <link>" . get_bloginfo('url') ."</link>         <width>300</width>         <height>60</height>         <description>MyDomain.com</description>         </image>";     add_action('rss2_head', 'addRssImage');     /* End RSS Logo */


title: Gravity forms and wp_update_post

text: I am using Gravity Forms to let users create posts. The user fills out a bunch of information, and a post is created. The user gets to choose which categories the post is in, but there is one more category that I need to add for every post. I am trying to use the gform_after_submission hook (http://www.gravityhelp.com/documentation/page/Gform_after_submission) and wp_update_post. I just want to add one more category to the post. Here is my code:               add_action("gform_after_submission_5", "add_category", 10, 2);     function add_category($entry) {       $post = get_post($entry["post_id"]);       $post->post_category = array ( 48 );       wp_update_post($post);     }      This does add the appropriate category, so that's good, but it also removes ALL of the other post data, which is bad. What am I doing wrong? Can this code be made to work, or should I be taking another approach?


title: Add Piecemaker to Wordpress Header

text: I wish to add the Piecemaker 3D rotator to Wordpress theme TwentyEleven In Header and NOT as a POST or Page. Via Wordpress Plugin: Piecemaker 2 Steps: 1. Piecemaker Created with Assets 2. Tested on POST/PAGE. Getting displayed correctly. Question:   1. How to display it in Header instead Of the TwentyEleven images (Header script removed) What should i do to display the Piecemaker in Header. I have tried:   1. Adding below code in Functions.php Source: Support forums              /**      * Function to use piece maker outside post content      *      **/     function display_piecemaker($att = null){     global $pm;          if(!is_array($att)){         $att = array(             'id' => $att,         );     }               echo $pm->replaceBooks($att);     }        2. Calling the function in theme file:              <?php if( is_home() ) {     display_piecemaker(array('id' => 1));     }?>      Note: I am beginner with PHP.


title: Which file renders the "Edit Gallery" Settings page?

text: I was looking for a tutorial on adding options to the "Edit Gallery" page. In the hopes of adding some GUI inputs that would result in the generated [gallery] short-code having custom attributes. I found this question. I was hoping that taking a look at how the page and options are rendered, and were the request "insert gallery" is sent would help me understand the issue. So again the questions are : 1) Where in the WordPress core can I see how the "Edit Gallery" page and its settings are rendered? 2) What file / function handles the "insert gallery" request ? I created a separate questions so someone could get some easy points : ) Thank you.


title: What is the very earliest action hook you can call?

text: After the solution to this question was to get a function to launch BEFORE the `init` action is fired by taking the sequence out of its function, it got me thinking, is there any earlier in the WP load sequence that I can hook a function into?


title: Post Attachment missing head (stylesheets/js/what-not)

text: I am using a modified 2011 theme, I got the single post to look fine but my single attachment is not working. I'm told this will default to the page.php if I do not have an attachment template. So, it doesn't look like its pulling the head from page.php either. Thanks in advance for any help, i'd provide some code but i'm not sure where to start. derp.


title: Getting menu items like get_pages

text:
I need a way to create a custom HTML template for the wp_nav_menu function. I've heard of custom walker classes, but these don't appear to be helpful enough to achieve what I'm trying to do; at least as far as I know because of the lack of documentation towards walker functions. What I need to do is be able to add a 'hoverable' class to all top level menu items. I only need the menu to go two levels; top level, then child menu items. I need to add a 'top- level' class to all menu item anchor elements who have a sub-menu. I need all sub-menu lists to have the class 'sub-nav'. And I need to have all of the last sub-menu list items (li) to have a class 'last'. Here's the code I have right now that generates my menu the exact way I need it to be generated using the get_pages function:               <?php     $pages = get_pages(array(         'parent' => 0,         'sort_order' => 'ASC',         'sort_column' => 'menu_order'     ));          $num_pages = count($pages);     $p = 0;          $exclude = '"pastor.php","service.php","gallery.php","audio.php","video.php"';     $exclude_list = $wpdb->get_results("SELECT GROUP_CONCAT(t1.ID) AS IDS FROM " . $wpdb->posts . " AS t1 INNER JOIN " . $wpdb->postmeta . " AS t2 ON (t1.ID = t2.post_id) WHERE t1.post_type = 'page' AND (t1.post_status = 'publish' OR t1.post_status = 'private') AND t2.meta_key = '_wp_page_template' AND t2.meta_value IN (" . $exclude . ")  ORDER BY t1.post_date DESC");          foreach($pages as &$page) :         $children = get_pages(array(             'sort_order' => 'ASC',             'sort_column' => 'menu_order',             'hierarchical' => 0,             'childof' => $page->ID,             'parent' => $page->ID,             'exclude' => $exclude_list[0]->IDS         ));         $num_children = count($children);         $has_children = $num_children > 0;         ?>         <li class="nav-item<?php echo ($has_children ? ' hoverable' : '') . ($num_pages == ++$p ? ' last' : '') . ($page->post_name === $root_parent->post_name ? ' active' : '')?>">             <a href="<?php echo get_page_link($page->ID)?>" class="top-level"><?php echo $page->post_title?>                  <?php if($has_children) : ?>
                     <?php                     $c = 0;                     foreach($children as &$child) : ?>                         <li class="nav-item<?php echo ($num_children == ++$c ? ' last' : '')?>">                             <a href="<?php echo get_page_link($child->ID)?>"><?php echo $child->post_title?>
                     <?php endforeach;?>
             <?php endif;?>
         <?php     endforeach;     ?>      Is there a way to pull menu items in an order multi-dimensional array so that way I can just iterate through them and generate the above template manually, instead of all this wp_nav_menu and walker none-sense?


title: SHOPP Custom Post Type, conditional tags

text: I really want to find out what the Custom Post Type is for the SHOPP plugin - is there any way you can fish it out from WP in the code or in the admin? May come in useful to customise other plugins and such. This is specifically for SHOPP plugin right now, so if anyone knows what it is (or if it has one?!) that would be helpful. Cheers!


title: WP Autoresponder plugin send email problem

text: I'm trying to use Select WP Autoresponder plugin to make a newsletter for my blog the problem is that this this plugin is not sending emails. I have tried to send email using new broadcast and the plugin reported that message was sent but actually it wasn't. What should I do I have version 5.1? Thanks


title: Set Maximum Width for an uploaded image

text: I want to restrict the width to a maximum of 600px for images uploaded using the "full size" image option in WP posts/pages section. I've tried two methods: **Method 1:** Adding the following to style.css of the theme:               .post img {     max-width: 600px; /* Adjust this value according to your content area size*/     height: auto;      } **Method 2:** Adding the following to the top of functions.php:               $GLOBALS['content_width'] = 600;      Both of them are not working. The option for full-size is not available in **Settings > Media** Please help.


title: How to filter all products by products_tag (woocommerce )

text:
I'm trying to retrieve the thumbnails for only certain products of my woocommerce, using `products_tag`, this code is showing all products :
     <?php     $args = array( 'post_type' => 'product', 'posts_per_page' => 5 );     $loop = new WP_Query( $args );     while ( $loop->have_posts() ) : $loop->the_post(); global $product; ?>                    <?php global $post; echo "
" . $thePostID = $post->ID. "
";    ?>               <?php if (has_post_thumbnail( $loop->post->ID ))      echo  get_the_post_thumbnail($loop->post->ID, 'shop_catalog');      else echo 'plugin_url().'/assets/images/placeholder.png" alt="Placeholder" width="'.$woocommerce->get_image_size('shop_catalog_image_width').'px" height="'.$woocommerce->get_image_size('shop_catalog_image_height').'px" />';     ?>                         <?php endwhile; ?>
      I try to add more arguments to the array inserting 'product_tag' but doesn't' work:                $args = array( 'post_type' => 'product', 'posts_per_page' => 5, product_tag => 'shoes' );      How can i show only the products with the tag shoes ? Thanks for your help


title: Category archives with monthly pagination

text: How would I go about doing the following: I need to setup a prev/next type pagination where posts within a category archive are split into months. For example, if I navigate to the News category, I should get all posts in the News category for this month only. I could then hit the prev link to get all of the posts for last month in the News category. This can replace the default settings where posts are simply paginated by a specific number of posts per page. Any help with this would be appreciated. Thanks


title: Please help me through this example with a filter to understand how they work

text: I am looking at this generate password function:               function wp_generate_password( $length = 12, $special_chars = true, $extra_special_chars = false ) {         $chars = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789';         if ( $special_chars )             $chars .= '!@#$%^&*()';         if ( $extra_special_chars )             $chars .= '-_ []{}<>~`+=,.;:/?|';              $password = '';         for ( $i = 0; $i < $length; $i++ ) {             $password .= substr($chars, wp_rand(0, strlen($chars) - 1), 1);         }              // random_password filter was previously in random_password function which was deprecated         return apply_filters('random_password', $password);     }      What I am trying to understand is the apply_filters part. Am I correct what it does is return random_password($password)? Where random_password is the filter function? But I cannot find random_password defined in any of the source files? Am I right in thinking if the source code can't find random_password() it returns $password, and if it can find random_password() defined somewhere it returns random_password($password)? If so, where in the source code do I define random_password()? Thanks


title: How to use wp-login.php page only for logout?

text: On my website I have removed wp-login.php to disable the login from default wordpress login window. Then I installed Social Login plugin, users are able to Login properly by using this plugin. But if they click on Logout button, they will be taking to the 404 page, since Logout URL is nothing but a parameter pass to wp-login.php page. So please suggest me a solution, where I can use wp-login.php page only for Logout process. Login and Password Reset should not work. Sorry for the lengthy query, but I am in urgent need. Thanks in advance.


title: Localize strings for translation

text:
I'm rebuilding my website from a child theme of twentytwelve to child theme of twentyfourteen. Most of the functions I'm using comes from tutorials, so most of the string aren't localized. With this child theme I'm working on I really want to localize the theme because I want to use the theme on an Afrikaans website and on an English website. I want to now what is the correct way to localize these following strings:               echo '  #This article have ' . str_word_count($post->post_content) . ' words to read!';      and               echo "
Page ".$paged." van ".$pages."";      and               echo "Next ›";      Many thanks in advance


title: Blogroll import/export with categories and descriptions

text: Is there an easy way (a plugin maybe?) to export and then import into a different WordPress installation all links in the blogroll including descriptions and categories? I know you can export links by going to /wp-links-opml.php, but I believe doing it this way you loose the link descriptions. When importing, I'd like links to be put in their categories - if the categore does not exist it should be created. I would prefer a way to do this without hacking any core WordPress files if at all possible.


title: Using the WordPress selected() function

text: I'm using the WordPress `selected()` function to display the current option in a dropdown list. The issue I am having is that for some reason WordPress is printing out `selected='selected'` above the form in addition to in the actual `<option>` elements. This is how I am using the `selected()` function.               <select name='gender'>     <option value='male' " . selected( $values['gender'] , 'male') . ">Male</option>     <option value='female' " . selected( $values['gender'] , 'female') . ">Female</option>     <option value='other' " . selected( $values['gender'] , 'other') . ">Other</option>              </select>      Removing the markup above eliminates the `selected='selected'`which is appearing completely outside of the `<form>` element.


title: shortcode_atts - one URL variable not working

text: I have devved a small plugin based on a shortcode. Here's a stripped down version of the code for the shortcode itself:               function lishortcode($liatts) {         extract(shortcode_atts(array(             "li" => get_option('li'),         ), $liatts));             foreach ($liatts as $key => $option) {                 $li[$key] = $option;         }         $lib=$li[URL];       return $lib;     }     add_filter('widget_text', 'do_shortcode');     add_shortcode('LI', 'LIshortcode');      The URL parameter is one of 5 variables called in the shortcode. All the others work except for this one. Is there a reason for this? The following 2 shortcodes output the same URL:               [LI]     [LI URL="http://www.differenturl.com/somewhere"]


title: How do I remove a require_once admin panel from the parent theme from the child theme functions.php?

text: In the parent theme, the following is at the bottom of the **functions.php** file.               require_once(TEMPLATEPATH . '/admin/admin-menu.php');      In the child theme's **function.php** , this code will include the child admin panel.               require_once(STYLESHEETPATH . '/admin/admin-menu.php');      As you can see, I shouldn't use both files b/c the bottom file includes `get_stylesheet_directory_uri()` instead of `get_template_directory_uri()` for certain localized files (js, css). Thus, I need to remove the parent file from loading I believe I need to use the `remove_action` hook, but I'm not sure how to do this right. Can't find a good answer on Google either. I started writing the following in the **functions.php** file in my child theme, but I don't know how to write it properly.               function remove_parent_admin_panel {        remove_action('remove_panel', '[WHAT-GOES-HERE?]');     }      Then I guess I need to use a `add_action` hook to add the above function to remove the parent admin panel. Should I wrap the parent `require_once` with a function statement? Am I on the right track?


title: Hiding Page by Title from Editing

text: I have a number of pages which are automatically generated. I then use a custom settings box to allow users to exchange the content on those pages. Problem being, I don't want users to be able to delete these specific pages. One of those pages is the "Disclaimer". The reason I'm doing this is because I'm creating a multi-site legal blog network and each page must have a disclaimer under US laws. How do I hide these auto-generated pages (like "Disclaimer," below) from the dashboard **by title** , rather than ID?               // If there is no disclaimer page, generate one from its template     $page = get_page_by_title( 'Disclaimer' );     if(!$page)     {             wp_insert_post(array(                 'post_name' => 'disclaimer',                 'post_title' => 'Disclaimer',                 'post_status' => 'publish',                 'post_type' => 'page',                 'post_author' => 1,                 'page_template' => 'page-disclaimer.php',             ));     }


title: How to make admin theme option with image slide show?

text: How to make admin theme option with image slide show so admin can change image dynamicly (user can upload and change the image and title slider) as a slideshow on the webpage? Thank you for any feedback. Note: without any plugin


title: Javascript included but alert() function not working

text: I've included the javascript by               wp_enqueue_script('slider', plugins_url( 'slider.js', __FILE__ ) );      with just a simple               $(document).ready(function () {         alert("alert");     });      It shows up in the browser but doesn't prompt me with "alert". PS: Forgot to mention I've also included the jquery, but still not working.               wp_deregister_script('jquery');     wp_register_script('jquery', "http" . ($_SERVER['SERVER_PORT'] == 443 ? "s" : "") . "://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js", false, null);     wp_enqueue_script('jquery');      * * * In addition to the answers, I also had to tell wordpress that my script depends on jQuery               wp_enqueue_script( 'slider', plugins_url( 'slider.js', __FILE__ ),array('jquery') );


title: Help with page nav?

text:
I am taking over a site and we are making a sister site to it, but the problem is that the navigation was set up for the other site - so I'm having an issue getting the navigation to link to the pages. What it is doing is using a filter of some sort... so when I try to click a link on the nav bar nothing happens but an empty drop down menu displays. We have no need for child pages on this project so I need help figuring out how to edit the filter so that parent pages act as links rather than "menu titles" if you will. here's my code:               <?php                           //add_filter ('wp_list_pages', 'formatNavList');                     $myPages = wp_list_pages(array('title_li' =>'', 'depth' =>1, 'sort_column' => 'menu_order, post_title', 'echo' =>0, ));                           $templateDir = get_bloginfo("template_directory");                     $pattern1 = "/
.*?(.*?)<\/a>/is";                     $replString1 = "
$1

                             ";                          $pattern2 = "/(<\/li>\s*?
]*navButton.*?>)/is";                     $replString2 = "

$1";                               $pattern3 = "/(<\/li>\s*?)$/is";                     $replString3 = "

";                          $menu = explode('
 $val) {                              $match = $matches = 0;                              if ($sub == 0){                             $id[] = $key;                             $pos = strpos($val,'<a');                             $text = preg_replace($pattern1, $replString1, "<li alt='$sub' $val");                             $output .= $text;                         }else{                             $output .= "<li alt='$sub' $val";                         }                         if (preg_match_all("/(
)/",$val,$match,PREG_PATTERN_ORDER)){                             $sub = $sub + count($match[0]);                         }else if (preg_match_all("/(<\/ul>)/",$val,$matches,PREG_PATTERN_ORDER)){                             $sub = $sub - count($matches[0]);                         };                         $i++;                         if($i==3){$i=0;};                          }                     $output = preg_replace($pattern2, $replString2, $output);                     $output = preg_replace($pattern3, $replString3, $output);                          echo $output;                 ?>      any help would be greatly appreciated! Thank you in advance!


title: Symbolic link for uploads in wordpress

text: Hi i am a new bie in wordpress. i use load balancer for my sites. So the request can be processed by any of the 4 servers. so i moved all contents from **/wp-content/uploads** to the centralised server **/images/myblog/wp-content/uploads** and created a symbolic link to it. Now the problem is, access to media contents results in 404 error. Can you please explain, is anything i am missing out.


title: Related links - from other sites

text: I'm in middle of re-building a website that's coded in a rather terrible custom CMS. Since the site is essentially a blog, I've been doing it in Wordpress. One thing I'd like to do is be able to add a few "related links" to each post. These links are not the same thing as "related posts". When a new article is posted, I'd like the post author to be able to attach a handful of links from other sites (e.g. an article on nytimes.com, something from other blogs, etc). Each related link item would consist of the original URL, the Title, the Author(s), Source, and a brief description. See image for an example: _Since I don't have enough rep points (yet), here's an image link instead:http://i.stack.imgur.com/nlhbt.png_ My first thought was I could use Custom Fields - but this would quickly fall apart if there were multiple links. My current thought is to have each link as a separate Custom Post Type, but then I'm stumped on ways to link them to the post it should be shown with. If only WP had an auto-complete field that I could use for the article title. I'm using Magic Fields for certain categories, but it doesn't look like it would work here. Is there anything I could use for this? I'm not very familiar with the WP core/plugins development, but I'm great with PHP/MySQL, so I don't mind having to code something up. I couldn't find anything by searching so I'm asking here. Any ideas for plugins/implementations that would work?


title: How do I add a class to <body> that is generated by <?php body_class(); ?>>

text: I need to add a class of "two-sidebars" to the regular bunch of WP classes that are generated by `<?php body_class(); ?>>` The reason I need to do this is I'm integrating WP into a Drupal install, and need to keep the "two-sidebars" class for style reasons for the Drupal part of the page. What's the best way? jQuery? Is it possible to hook into body_class?


title: Moving wp-config.php: Can this be done after site launch?

text: For additional security, the suggestion is made to move the wp-config.php up one level. Can this be done after the site has already been launched? Any potential issues in doing this? Are there an restrictions/suggestions on what the new folder should be called?


title: I want to order categories based upon the latest post time

text: For example if category A has post 1 which is created yesterday and category B has post 2 which is created today. So, the category will be listed in order Category B Category A Have anyone implemented this before?


title: Can i copy administrator role to another user?

text: can i copy the role of administrator to another user and remove few capabilities not required ?. Basically, i want to have a user with restricted admin privileges.


title: different startsite for IOS and change menu

text: I have a homesite and a second site. They are displayed to normal browsers. But I would like to show IOS and mobile devices the second site as homesite and hide the normal homesite. How can I do this? Joerg


title: next_/previous_post_link() `in_same_category` appears to fail when true

text:
I'm using the Modernize theme's custom Portfolio type page. In the `single- portfolio.php` template, I call `next_` and `previous_post_link()`, which correctly display links when in_same_category is set to `false`, but when set to `true` they are blank. There are other pages in the same category as the page currently being viewed, though some pages may belong to multiple categories. Did I miss something obvious? This shows the following link:               <?php     previous_post_link('

%link
', '%title', false);     next_post_link('
%link

', '%title', false);      This does not show the following link:               <?php     previous_post_link('

%link
', '%title', true);     next_post_link('
%link

', '%title', true);      **However** , after looking a little more, I wonder if multiple category taxonomies might be playing a role in this. I can't think of another reason for this not to behave as expected correctly than incorrectly configured categories.


title: Limiting conditional comment to home only in header.php

text: I've discovered a solution to an IE problem with a conditional comment. I only need it on the home page because I've isolated there with a class on only one image. Unfortunately, the comment causes me some problems on other pages so I need to limit the comment (and script) to function ONLY on the home page... here's what my comment looks like but it's not preventing from the other pages... I'm more designer than php guy but I'm trying...               <!--[if lt IE 9]><?php if(is_home() )?>          <script type="text/javascript" src="<?php bloginfo('template_url'); ?>/scripts/unitpngfix.js"></script>      Would certainly appreciate any help with this. Thanks much... Jeff


title: Display a tag only if there is a description

text:
I'm building a site glossary and trying to display only tags with descriptions. Is there a way to determine if the description is available and only display the tag when it is? Here is where I am so far.                   $tags = get_tags();         if (tag_description($tag->term_id)) {             if ($tags) {                 foreach ($tags as $tag) {                     echo '
term_id ) . '" title="' . sprintf( __( "View all posts in %s" ), $tag->name ) . '" ' . '>' . $tag->name.'

' . tag_description($tag->term_id) . '
';                 }             }         }


title: exclude custom post type by meta key in wp_query

text: I'm trying to display a custom post type (properties) and exclude posts that have a certain meta value (sold). Is there a way that I can do this? I have this for my code so far:                                       $args = array(                                 'post_type'      => 'property',                                 'orderby'        => 'meta_value',                                 'meta_key'       => 'random_775',                                 'order'          => 'ASC',                                 'posts_per_page' => 100,                             );                              $the_query = new WP_Query( $args ); ?>                         <?php if ( $the_query->have_posts() ) : ?>                         <?php while ( $the_query->have_posts() ) : $the_query->the_post(); ?>      So right now it shows all the custom post types even the ones that are 'sold'. How can I show the ones that are not sold? Also, sold is just a checkbox so it would have to know whether it was checked or not. Suggestions? Thanks!


title: Way to bulk delete menu items in new 3.x Appearance > Menus system?

text: I've done some searches but maybe I'm searching on the wrong terms. Does anyone know if there's a way to bulk-delete menu items in the new Appearance > Menus system? This is mostly to clean up localhost installations, so I'm totally open to plugins if anyone knows of one. I'd be thrilled if I could delete a Page and have all its sub pages (the ones I set as its sub pages via the Menu, not necessarily its real Child pages) also disappear from the menu, for instance. Thanks for any help!


title: RSS Feed broken

text: When I try to access my RSS Feed I am getting this error: error on line 1 at column 35: Unsupported encoding UTF-5 It was working fine just a couple days ago and I'm not sure what I changed if anything to break it. Any Ideas?


title: A to Z list for custom post types

text: Anyone know a plugin or any other solution to list posts filtered by the first letter from custom post types? I found some plugins, but nothing seems to work with custom post types.


title: How to paginate categories and sub categories?

text:
Here is my code so far:               <?php if (isset($wp_query) && $wp_query->max_num_pages > 1) : ?>

                             <?php if ($paged != 1): ?>
<a href="<?php echo get_previous_posts_page_link(); ?>">
                             <?php endif; ?>                             <?php for ($i = 1; $i <= $wp_query->max_num_pages; $i++) {                                          ?>
<a href=" <?php echo get_pagenum_link($i); ?>"><?php echo $i; ?>
                                 <?php                                  }                             ?>                             <?php if ($paged != $wp_query->max_num_pages): ?>
<a href="<?php echo get_next_posts_page_link(); ?>">
                             <?php endif; ?>
                         <?php if (false): ?><?php posts_nav_link(); ?><?php endif; ?>

         <?php endif; ?>      The initial page urls look like these: `HOME_URL/category/THE_CATEGORY/` and `HOME_URL/category/THE_CATEGORY/THE_SUB_CATEGORY` Whenever I ciick next, the url is this: `HOME_URL/category/THE_CATEGORY/page/2/` which makes a 404 error. How do I paginate categories and sub categories correctly?


title: Pagination & get_pages?

text:
I have a page that list the child pages of this specifiec page but i would like to add pagination for it , how can i do this ? here is the code that get's the pages
                 <?php                 $the_id = get_the_ID();                      $args = array(                 'child_of'     => $the_id,                 'title_li'     => '',                 'parent'       => $the_id,                 'sort_order'    => 'ASC',                 'sort_column'   => 'ID',                 'number'        => 20                 );                      $pages = get_pages( $args );                      $output = '';                      foreach($pages as $value){                          $thumb = get_the_post_thumbnail( $value->ID, $attr = '' );                     $output .= "
";                     $output .= "post_name . "' >" . $thumb;                     $output .= $value->post_title . "";                     $output .= "
";                 }                       echo $output;                 ?>


title: URL Rewrite Adjustment for Custom Post Type causes template to revert to index.php

text: I have a custom post type with a URL permalink rewrite that seems to work if it uses /mynews/stories/YYYY/mm/story-name but if I change "mm" to the first 3 letters of the month (eg Jan, Feb, Mar, etc), the template hierarchy breaks and it uses index.php. My code is here http://pastebin.com/RS1DMbB6 I put this all in the functions.php file as I'm not allowed to add plugins. So the moment I change from %monthnum% to %month%, the URL rewrite works, but the wrong template is being used. Debugging inside the post_type_link hook and template_include tells me is_single is null, and the template seems to go to index.php instead of single-story.php or even single.php. Any ideas why this seemingly simple change breaks template hierarchy?


title: Add_settings_field() parameterizing callback?

text: I'm trying to create a rather large and extensive settings page with various options of very similar type. Since there will be about 20 different fields, and the differences between most of those being simply their ID, I'd like to avoid creating a separate callback for each one. Is it possible to make a callback with a variable for the settings ID of each of these fields? That way one callback can server various settings fields of the same type. I've tried using the $args parameter for add_setitngs_feild(), but sadly, it does not work. For example:               add_settings_field('name', 'Field Name', array($this, 'fieldCallback'), 'SettingsGrouP', 'SettingsSection', array("settingID!"));                function fieldCallback($id)     {         echo "<input id='" . $id . "'/>";//etc, etc     }      fieldCallback si being called, but the ID of the input is blank.


title: WP_Query: attachment image in "full" size?

text: I'm using the following script for my current project.               $query_images_args = array(         'post_type' => 'attachment',         'post_mime_type' =>'image',         'post_status' => 'inherit',         'posts_per_page' => -1     );          $query_images = new WP_Query( $query_images_args );     $images = array();     foreach ( $query_images->posts as $image) {         $images[]= wp_get_attachment_url( $image->ID );     }      This saves all image paths of the current post or page into an array. And right now the paths are set to the "original" uploaded file. Is it possible to have a parameter that specifies that I want to save the largest file-size wordpress generates (with its settings in media) to that array? So when uploading an image to WP the following happens …               image-150x150.jpg     image-300x247.jpg     image-1024x843.jpg     image.jpg      Those four images are inside my uploads folder when I leave the default settings of the media uploader. And with my script above "image.jpg" gets pushed into the array. However I want the largest generated size in my array - in this case `image-1025x843.jpg`. Is that possible?


title: Widget translation on my plugin

text:
I am adding i18n to the widget on List Category Posts. I've correctly created the pot file, and po and mo files for Spanish and English. All of the Strings are being displayed with `_e()` on the form file. The directory structure is as follows:               /     include/         ListCategoryPostsWidget.php         lcp_widget_form.php     languages/         es_ES.mo         en_US.mo     plugin.php      There are other files, but these are the ones involved in translation. From my Widget class (ListCategoryPostsWidget.php) I'm using this to register the translation:               $translation_dir = '../languages';     load_plugin_textdomain( 'list-category-posts', null, $translation_dir );      And this is the code I'm using to include the form file in ListCategoryPostsWidget.php file:               /** @see WP_Widget::form */     function form($instance) {         include('lcp_widget_form.php');     }      Default language is English, so that works fine. But when I set WP_LANG to "es_ES" on my wp-config, I still see the text on the widget in English. Any ideas? **EDIT:** So, I'm adding some more code:
<label for="<?php echo $this->get_field_id('title'); ?>">     <?php _e("Title", 'list-category-posts')?>      This is how I'm using the _e function in lcp_widget_form.php.


title: How to remove WPML Generator Meta Tag by theme's functions.php (override plugin function)?

text: I've tried hard to find a way to not let plugin WPML output the following `<meta name="generator" content="WPML ver:2.8.1 stt:3,1;0" />` tag in `<head>` via help of theme's `function.php`:   It's called in `sitepress.class.php` beginning with line 255               if ( !is_admin() ) {         add_action( 'wp_head', array( $this, 'meta_generator_tag' ) );     }      This specific question has already been asked once in WPML forum. I've tried:               /* ::: Disable WPML Meta Generator Tag ::: */     if ( ! is_admin() ) {         remove_action( 'wp_head', 'meta_generator_tag', 20 );     }     add_filter( 'meta_generator_tag', 'theme_generator_tag' );          function theme_generator_tag() {         return false;     }      -- without success


title: Wordpress installation site folder move to the final site destination

text: My client have a site : business.com All the files of the old fashion site is there, images, video, html, css. i just made a folder called business.com/cms and installed wordpress here. FOr 2 month they write stuff, upload images and do there site in wp. Now it's time to lunch the site The problem, all the images and page belong to business.com/cms not the root business.com. when i will remove the old site and put all the file from the cms folder at the root level, the site will miss a lot of thing, images and manually link pdf in text How do you do that properly. Is itst possible to keep the site in /cms and used some .htaccess wizardry to make it look like root ? HELP, need to lunch tomorrow !


title: What does the Global Variable $s represent?

text: What does the $GLOBALS['s'] variable contain? It looks like an empty array, but what would it normally hold? I've encountered it in a tutorial: The WordPress Theme: Single Post, Post Attachment, & 404 Templates, it mentions a long string that gets passed to a `printf` function call. The string looks something like this:               //START OF STRING          $entry_utility = <<<LONGSTR     This entry was posted in %1{$s}%2{$s}.     Bookmark the permalink.     Follow any comments here with the     RSS feed for this post.     LONGSTR;          //END OF STRING      **NOTE: I've wrapped the long string from the tutorial inside a HEREDOC string instead, it was too hard to follow on the single line.** I've wrapped the $s variables in curly-brackets in case heredocs couldn't interpret them correctly.


title: New Variable Woocommerce product not showing variations, price, or add to cart on front end

text: I've only just installed Woocommerce to a network enabled Wordpress install. On one of the network sites, I:   1. added a product,   2. added attributes,   3. turned the product into a variable product,   4. went to the variations tab, clicked "Go" for "toggle Enabled"   5. on the variations tab, selected prices, "Go", and entered a price. On the front end, no product variations drop down shows, no price, and no add to cart shows.


title: WordPress local development environment

text: Everything on WordPress is primed for a production server, and hardly mentions info on development stuff. I want to setup a WordPress blog locally so that its good and ready before it goes live. Are there any specific guidelines when setting up a local WordPress development environment. What is the easiest way of creating a wordpress blog locally but one that i can, at some point, transfer to a live server? **Question Edited** for WordPress answers guidelines.


title: Hide featured post from second page

text: This is my category page code <--Featured Post start-->               <?php      $count = 1;     if (have_posts()) : while (have_posts()) : the_post(); if($count == 1) : ?>     <a href="<?php the_permalink() ?>" rel="bookmark" title=""><?php the_title(); ?>          <--Featured Post start-->     <?php else : ?>      <--Rest of Posts -->               <a href="<?php the_permalink() ?>" rel="bookmark" title=""><?php the_title(); ?>      * * *               <?php if (function_exists('wp_pagenavi')) wp_pagenavi(); else { ?>     <?php } ?>      i dont want featured post to be display after first page, how to prevent ?


title: How to get attachment caption (get_the_excerpt gives parent post excerpt) ?

text: I am displaying the attachments on the parent post page with this code :                       $args = array('post_type' => 'attachment', 'post_mime_type' => 'image', 'order'=> 'ASC', 'numberposts' => -1, 'post_status' => null, 'post_parent' => $post->ID );              $attachments = get_posts($args);             if ($attachments) {                 foreach ( $attachments as $attachment ) {                 $attachments_url[] = $my_image;                 $attachments_caption[] = get_the_excerpt();                 }             }      problem is that the excerpt doesn't get the attachment's caption but the post excerpt. do you know how to display the attachment's captions ? thank you


title: WordPress custom options storing?

text: I have a theme with around 500 custom options, their code looks like this:               <form method="post" action="options.php">        <?php wp_nonce_field('update-options'); ?>        <input type="text" " value="<?php echo get_option('option1'); ?>" />        <input type="text" " value="<?php echo get_option('option2'); ?>" />                <input type="hidden" name="action" value="update" />        <input type="hidden" name="page_options" value="option1,option2" />        <input type="submit" value="<?php _e('Save Changes') ?>" />     </form>      I guess they're all stored in wp_options table. The point is, I'm unable to save this data, every time i export/import Wordpress settings these custom options values disappear, changing theme also wipes them out. How to fix that?


title: Wordpress & PHP sessions

text: I am using a plugin called WP events manager, I would like to add custom functionality so that each event can be 'added' to a 'basket' then at the end the user can go the the 'checkout' and register for these events. I believe this is done by storing the ID of the event when the user clicks add in PHP sessions and then looping though the items at the check out with the infomation you enter at the check out. I am new to PHP sessions and not sure how I can store an ID on click of a button, and then loop through them at the end, if anyone knows about this, or knows any related articles I would be very grateful, googling the subject sent me into a mine field. Cheers!


title: Custom HTML output for registered navigation

text: Is it possible to strip out the title / url from a custom navigation as to create a new HTML structure? I'm creating a very unique menu structure, based on the custom menu created by a user in WordPress, but `wp_nav_menu()` does not seem to output only the title / url into an array. I could most likely get the HTML output from `wp_nav_menu()` and run a regex to strip out the various elements I need, but this seems overkill if a method already exits? Appreciate the help.


title: wordpress export pretty permalinks and post excerpt export

text: Note: tried all old questions and they seem not working in current version of wp I want to export pretty permalinks ( not in db) ,posts title,excerpt and if possible category and tags to csv Please tell me how to


title: JSON: schedule creation of json file

text: After some research I've managed to create a json file which I use as input for Twitter's typeahead (prefetch). On my website I have several hundreds of events and several thousands of artists (both custom post types). The json files are created using the function below (only posted one function since the function for artists is the same except it's a different post type). Since we keep updating the events and artists, and since we have so much of both, I was wondering how I should go about running the functions. My idea was to schedule this function, so it will run once every day or so. After some more research I should be able to fix this (using this post). Now my question is if this is good practice. I thought it would be great to schedule the functions to run every night (we have over 8000 artists so I don't want the functions to slow down the website for visitors), but maybe there's another efficient way of building such large datasets. The function:               function json_events() {            $args = array(          'post_type' => 'events',         'posts_per_page' => -1,         'post_status' => 'publish'       );            $query = new WP_Query($args);            $json = array();            while ($query->have_posts()): $query->the_post();         $json[] = get_the_title();       endwhile;       wp_reset_query();            $fp = fopen('events.json', 'w');       fwrite($fp, json_encode($json));       fclose($fp);     }


title: Warning when attempting to edit/add custom post type

text: I have two custom post types in my WordPress installation. Both are set up the same way in functions.php (one called "Media" and the other "Testimonials"). For some reason, I'm now getting the following error in Admin when I go to edit or add Media items: > Warning: call_user_func_array() expects parameter 1 to be a valid callback, > function 'add_media_metaboxes' not found or invalid function name in > /home/user /public_html/wp-includes/plugin.php on line 405 This does not affect my ability to add or edit Media items. Why is this error occurring, and how can I get rid of the warning? The site just changed domains, but I can't see how that would affect one custom post type and not the other. I've updated permalinks and all internal and external links. Thanks. * * * To follow up on @pippin's answer, here's the full code from functions.php. Do you see an error here?               function wpt_media_posttype() {         register_post_type( 'media',             array(                 'labels' => array(                     'name' => __( 'Media Items' ),                     'singular_name' => __( 'Media Item' ),                     'add_new' => __( 'Add New Media Item' ),                     'add_new_item' => __( 'Add New Media Item' ),                     'edit_item' => __( 'Edit Media Items' ),                     'new_item' => __( 'Add New Media Item' ),                     'view_item' => __( 'View Media Items' ),                     'search_items' => __( 'Search Media' ),                     'not_found' => __( 'No media items found' ),                     'not_found_in_trash' => __( 'No media items found in trash' )                 ),                 'public' => true,                 'supports' => array( 'editor', 'thumbnail', 'title' ),                 'capability_type' => 'post',                 'rewrite' => array("slug" => "media"), // Permalinks format                 'has_archive' => true,                 'menu_position' => 5,                 'register_meta_box_cb' => 'add_media_metaboxes'             )         );     }          add_action( 'init', 'wpt_media_posttype' );