In which version of WordPress was the new gallery shortcode implemented?

As of WordPress 3.5, as I'm sure you all know, the gallery shortcode generated from the media uploader changed and now includes a list of image IDs. The gallery shortcode codex page says the following: > "It's important to note that this style of gallery shortcode is not new to > 3.5, however it is much easier to generate and manage with the new Media > Workflow introduced in 3.5." Does anyone know what the minimum WP version is, in which this style of gallery shortcode will still work?


Retrieve user_meta and copy to post_meta

As geo mashup only retrieves post_meta, I am trying to copy over the geo_location from a custom registration field into the meta for page containing the map. The code I am using is:               <?php      $blogusers = get_users_of_blog();     if ($blogusers) {     foreach ($blogusers as $bloguser) {     $user = get_userdata($bloguser->user_id);     $user_location = the_author_meta('geo_address', $user->ID);      add_post_meta( 463, 'geo_move', $user_location);           }}     ?>      This creates the post meta, but the value is written as a blank, so it looks like $user_location isn't working. Any suggestions?


Custom notification for contributors when posts are scheduled

I'm working on a custom notification to be sent to contributors when their post is scheduled for publication, sharing the scheduled date of publication and various other information (title, category, etc). The problem I'm having is that if I open up a pending post, set the date to the future, and then hit schedule, the notification doesn't include the post's scheduled publication date, it includes the post's original submission date. I assume the issue is that my function is firing before the database is updated with the post's new date and other updated information. Code is below - any help is much appreciated!               function scheduledNotification() {        global $post;        $post = get_post($post_id);        $author = get_userdata($post->post_author);        $link = get_permalink($post->ID);        $date = mysql2date('M j Y', $post->post_date);        $category = get_the_category($post->ID);        $category = $category[0]->cat_name;             $message = "
Dear ".$author->user_firstname.",
".                              "
We will be publishing your ".$category." article, ".$post->post_title.", on ".$date.".
";               $headers[] = 'From: Send Name <test@testing.com>';        $headers[] = 'Content-type: text/html';        wp_mail($author->user_email, "Your Upcoming Post", $message, $headers);     }          add_action('pending_to_future', 'scheduledNotification');     add_action('approved_to_future', 'scheduledNotification');


Brute force attack?

I'm seeing this quite often: ![enter image description here](http://i.stack.imgur.com/VUZqS.jpg) No OS, same Browser, weird hostname -- they're definitely not real users. Can I do anything to take precautions before they do something? Thanks!


List only first-level children of specific custom taxonomy term

I have a site set up with the following:   * **Post Type:** product   * **Taxonomy:** product_cat   * **Taxonomy Slug:** hydro The term hydro has several immediate child terms and several grandchild terms. I need to write a loop that will display only the first-level children of the custom taxonomy term "hydro" (i.e - skip grandchild terms), along with a permalink to their respective taxonomy archive pages. I've tried working with `get_terms()` in various incarnations but I just can't get it right. Any help is greatly appreciated. Thanks!


How to use if($wp_query->query_vars['name'] == 'pagethatdontexist') without getting a 404? How to suppress 404

i want to do something if my url is /pagethatdontexist But I dont want wp sending 404 headers. I tried this:               add_action('wp', array($this,'awp'));        function awp(){     global $wp_query ;     debug($wp_query->is_404);     if($wp_query->query_vars['name'] == 'pagethatdontexist')         debug('yes were at pagethatdontexist');;     $wp_query->is_404 = false;     debug($wp_query->is_404);     }      Which works, but still, 404 headers are sent. Where can I hook in and tell wp not to send the 404? EDIT -- well, this seems to do the trick, I'm not sure if it's Kosher.               function filter_status_header(  $status_header, $header, $text, $protocol ){         global $wp_query;         if (iDontWant404()){             $wp_query->is_404 = false;// still sends 404 unless:             return 'HTTP/1.1 200 OK';           }         else             return $status_header;     }     add_filter('status_header',array($this,'filter_status_header'),4,4);


Enqueued scripts and styles loading in WordPress Dashboard as well

For a moment, I wondered if my test site got hacked -- my WordPress site's dashboard was all broken (cosmetically). But when i looked at the source code of the page, I noticed that the "scripts and styles" that I enqueued for the front-end were also enqueued in the backend as well. This is how I did it:               add_action('init','wpse54189_register_script');     function wpse54189_register_script(){              wp_register_script( 'aahan_bootstrap_transition', get_template_directory_uri().'/js/bootstrap-transition.js');         wp_register_script( 'aahan_bootstrap_carousel', get_template_directory_uri().'/js/bootstrap-carousel.js');         wp_register_script( 'aahan_bootstrap_carousel_cycler', get_template_directory_uri().'/js/bootstrap-carousel-cycler.js', array('jquery', 'aahan_bootstrap_transition', 'aahan_bootstrap_carousel'));         wp_enqueue_script( 'aahan_bootstrap_carousel_cycler' );              wp_enqueue_script( 'comment-reply' );              wp_register_script( 'aahan_ajax_comment', get_template_directory_uri().'/js/no-reload-comments.js', array('jquery'));         wp_localize_script( 'aahan_ajax_comment', 'yjlSettings', array(              'gifUrl'=> get_template_directory_uri().'/images/ajax-loader.gif',              'autoGrow'=> 'enable'         ));         wp_enqueue_script( 'aahan_ajax_comment' );          }          add_action('init','aahan_register_style');     function aahan_register_style(){         wp_register_style( 'aahan_webfonts_stylesheet', get_template_directory_uri().'/font/font.css');         wp_register_style( 'aahan_main_stylesheet', get_template_directory_uri().'/style.css', array('aahan_webfonts_stylesheet'));         wp_enqueue_style( 'aahan_main_stylesheet' );     }      What could be wrong here?


Increment value (value = value+1) of $wpdb->update

This sql query               $wpdb->query("UPDATE log SET total=total+1 WHERE id='1')");      How do I turn it into $wpdb->update() statement? Ex.               $wpdb->update('log', array('total'=>'total+1'), array('id'=>'1'));


Get Categories Where Taxonomy Equals 'n'

I have a custom taxonomy(the taxonomy is _types_ ) that is basically a selector that tells WordPress which section of the site to place the new post. So for example   1. I create a new post and select **Lifestyle** from the custom taxonomy list.   2. Then I would select a category to place the post under, for example **Healthy** I am trying to list the categories of **Lifestyle** in a custom menu format but only if posts exist under the taxonomy type and category selected. What I am getting is a full list of categories but not filtered by taxonomy type. Can anyone see where I have gone wrong?               <?php     $args=array(       'types' => 'Lifestyle',       'orderby' => 'name',       'order' => 'ASC',       'hide_empty' => 1       );     $categories=get_categories($args);       foreach($categories as $category) {         if ($category->count > 0){         echo '
slug.'">slug . '">'.$category->name.' / '.$category->count.'
';             }         }      ?>      Thanks so much in advnce! -d


jQuery UI & Admin (Calendar)

Am I smoking crack or why wouldn't this work? :/ This all seems pretty straightforward:               function admin_head()     {          ?>     <link type="text/css" rel="stylesheet" href="<?php bloginfo('template_url'); ?>/css/jquery-ui-1.8.9.custom.css"  />     <script type="text/javascript" src="<?php bloginfo('template_url'); ?>/js/jquery-ui-1.8.9.custom.min.js"></script>     <script type="text/javascript" src="<?php bloginfo('template_url'); ?>/js/theme-admin.js"></script>     <?php          }          add_action('admin_head', "admin_head");      And then in theme-admin.js ...               jQuery(document).ready(function($)     {            $("#datepicker").datepicker({             changeMonth: true,             changeYear: true, dateFormat: 'dd/mm/yy', showOn: 'button', buttonImage: plugin_path + '/images/icon-datepicker.png', buttonImageOnly: true});          });      Thank you for any insight you can provide :) Cheers


Placing a custom post type menu above the Posts menu using menu_position?

I just figured out the menu_position parameter it seems like you can place the menu of your custom post type almost everywhere. Except above the Posts menu! How can I accomplish that?


Image sizes in posts

I am having issues with images in my blog. I have default settings for media set in settings->media I am using a resize script to crop the featured image. So everywhere the featured image is called, I call this script and it's working good. So then, I went into a post, added an image into the body of the post and it comes out the same size as the featured image. So I removed the script, regenerated the images and I still have this issue. I don't know what I am doing wrong. Where does WordPress call the images that are inserted into the body of the post? I am calling the content of the blog page using `<?php get_template_part( 'content', get_post_format() ); ?>`


Are uploads directories created on a schedule?

I have a cron job that alerts me to modified files on a couple of WordPress installs. Two of them alerted me tonight to the creation of apparently empty folders like               /home/foo/public_html/wp-content/uploads/2013/05      Is there a scheduled job in WordPress to create the next month's upload directory on the last day of a month?


$wpdb returns no results with SELECT query on custom post type, works on default post type

EDIT: Adding more background info. I've coded a plugin that adds a meta box to the post page. When the post is published, the plugin will generate a random ID for the post, and insert the random ID and the post guid to a custom table in the database. After publishing, or upon editing, the plugin queries the custom table to retrieve the random ID for the post based on the post guid, and prints out the random ID in the meta box. Everything works great until I change the post type in the add_meta_box function from 'post' to 'quilt'. The plugin will generate the random ID and save it and the post guid to the table, but presents this error in the meta box: > Notice: Trying to get property of non-object in > /home/qultshow/public_html/wp-content/plugins/randomID/randomID.php on line > 126 instead of the random ID. If I use               var_dump( $query );     $wpdb->print_error();      to try to debug, I see: > NULL > > WordPress database error: [] SELECT * FROM wp_customtable WHERE qrci_guid = > "http://testsite.com/?post_type=quilt&p=213" If I copy the query from the Wordpress database error directly and run it in phpmyadmin, a row is returned as expected. So, the query is coded correctly, and the plugin works on the default post type of "post" but not on the custom post type of "quilt". The only change in the plugin is in this code: `add_meta_box( 'randomid_sectionid', 'Random ID', 'cd_meta_box_cb', 'quilt', 'normal', 'high' );` where 'post' was changed to 'quilt'. Is there something odd or different about querying the database from a custom post type that I need to know about to make this work? Notes: This plugin is not for usage by anyone but me on one website where I need this weird functionality. Also, this is a multi-site installation of wordpress if that makes any difference. I can't use post metadata for this since I need to be able to query this data without querying every postmeta table on the network, so it has to be a custom table in the database. Here's the pertinent code that is not returning a row on custom post types, _but does return a row on default post types_. Maybe it's not the best written code, _but it does work on default post types_ :               global $wpdb;     $wpdb->show_errors();     $sql = 'SELECT * FROM ' . $wpdb->base_prefix . 'customtable WHERE qrci_guid = "'. $post->guid . '"';     $query = $wpdb->get_row($sql);     $_quilt_id = $query->quilt_id;     var_dump( $query );     $wpdb->print_error();      And again, here are the errors on running: > Notice: Trying to get property of non-object in > /home/qultshow/public_html/wp- > content/plugins/metaboxplugin/metaboxplugin.php on line 126 > somewebsite/?post_type=quilt&p=49 > > NULL > > WordPress database error: [] SELECT * FROM wp_customtable WHERE qrci_guid = > "http://testsite.com/?post_type=quilt&p=213" I initially thought that there was an issue with the ampersand in the guid that the query searches on, because it was getting inserted into the custom table as `&` instead of just an ampersand. I fixed that problem, and now it is inserted into the table correctly, as just an ampersand, so there shouldn't be any issue pulling a record out of the table. That being said, on default post types, the ampersand is not in the guid, and the code works great. Maybe that really is the issue, but I don't know how to fix it. Can anyone help out with this?


Javascript will not run properly

I have this code which runs perfectly on jsFiddle. When I try to run that code on my self-hosted WordPress site, however, it will not run. (The code is exactly the same on my page, except that I added `<script type="text/javascript" src="/files/jquery-1.8.3.min.js"></script>` before the Javascript on the page.) The Javascript is directly in the Text tab of my page, JS first followed by the HTML. The form loads properly, but clicking the "Add Row" button does nothing. I had this issue on another page on my site, but it was fixed by wrapping everything in               $j(document).ready(function(){         // code     });      and using jQuery noConflict mode. I implemented that here (as you can see in the code), but it is not working.


Adding filter to the title without affecting the menu title

Hi I'm having problems with the `the_title` filter here's the code that I have:               function zen_title_filter($title){              if(is_singular()){             if(!empty($_GET['asin'])){                 if($title == 'Product Details Page' || $title == 'Compare Products Page'){                     $title = zen_get_titles();                      }                  }              }              return $title;     }          add_filter('the_title', 'zen_title_filter');      As you can see this filter updates both the menu title for the product details page and compare products page. But the behavior that I'm expecting is that it should only update the title of the post itself but not the menu title which in this case is also the same as the post title. Any ideas? ![enter image description here](http://i.stack.imgur.com/LlYMu.png) **UPDATE** I'm actually generating the page on the fly. Using a page as the template. So the post id is the id of the page. What I'm doing is adding filter to the content and completely replace the content of the page using the new content:               add_filter('the_content', function($content){       if(is_page('compare')){        $asin = esc_attr($_GET['asin']);        $data = get_data($asin);        $smarty->assign('item_data', $data);        $content = $smarty->fetch('file.tpl');       }       return $content;     });


Strange behavior with a redirect loop - involves WPML multi-language plugin

I have a (client) site located at http://internationalgateway.us/. We are using the WPML Multilingual CMS plugin. When choosing another language from the homepage (in this case French, since that's the only one enabled), I encounter a redirect loop. This can also be experienced just by visiting http://internationalgateway.us/fr. It appears as though an extra trailing slash is getting added to the url, triggering the loop. However, adding extra trailing slashes to any other url on the site does not cause the same behavior - it just results in a redirect to the page without the slashes. I understand this _may_ simply be a plugin issue, but I suspect that it is not, as the site was working fine previously. I'm wondering if this could be an issue with permalinks and/or .htaccess rules. Currently, my permalinks are set to `/%category%/%postname%/`, and the contents of the .htacess file are as follows:               # BEGIN WordPress     <IfModule mod_rewrite.c>     RewriteEngine On     RewriteBase /     RewriteRule ^index\.php$ - [L]     RewriteCond %{REQUEST_FILENAME} !-f     RewriteCond %{REQUEST_FILENAME} !-d     RewriteRule . /index.php [L]     </IfModule>          # END WordPress


Script only partially runs on theme activation, but runs fully on deactivation?

The code below is near the top of my functions.php and is set to run only when my theme is activated:               if ( is_admin() && isset($_GET['activated'] ) && $pagenow == 'themes.php' ) {      However, even though its creating the category "my-utilities", it is apparently not able to set the parent of the category1 and category2 items to the newly created category. Perhaps its too soon to call get_cat_id on the newly created category? I believe it has something to do with that, since the category's reparent on the 2nd time the theme is activated. This, I presume, is since the category that will be used as parent has been created previously, the routine has no problem finding its ID and using it as the parent for category1 and category2. What am I missing?               // with activate make sure theme's utility categories are present and parented correctly     if ( is_admin() && isset($_GET['activated'] ) && $pagenow == 'themes.php' ) {              if (file_exists(ABSPATH.'/wp-admin/includes/taxonomy.php'))         {             require_once(ABSPATH.'/wp-admin/includes/taxonomy.php');                      if(!get_cat_ID('my-utilities')){wp_create_category('my-utilities');}                  //find out the ID of the newly created category, "my-utilities"             $my_default_cat = my_cat();                  if(!get_cat_ID('category1')){wp_create_category('category1',$my_default_cat);}             if(!get_cat_ID('category2')){wp_create_category('category2',$my_default_cat);}                  //if the categories already existed, reparent them             $myCategory1['cat_ID'] = get_cat_id('category1');             $myCategory1['category_parent'] = $my_default_cat;             wp_update_category($myCategory1);                  $myCategory2['cat_ID'] = get_cat_id('category2');             $myCategory2['category_parent'] = $my_default_cat;             wp_update_category($myCategory2);              }     }               //utility category     function my_cat()     {         if(get_cat_ID('my-utilities'))          {             return get_cat_ID('my-utilities');         }         else         {             if(term_exists(1)) return "1";             else return get_option('default_category');         }     }


Show Custom Message in Wordpress Admin

I have a custom post type called "Films" that is used to manage an entire film collection. I would like to create a custom box with a message that will sit on top of all of the posts when you click on the Films button in the wordpress admin area. Currently (and by default) there is no messaging, just an index of all the posts in this post type. I want a box to appear above all of the posts with my message. The purpose of the box is to give admins of the site some direction on how to populate the films section. Any idea how I could go about this in wordpress? It is important to note that this message box should ONLY appear on the films custom post type, not on the dashboard or anywhere else.


A good heatmapping plugin for WordPress? (No 3rd-party services please)

I am hoping someone in this group can help me. We’re interested in obtaining more information on where people click on the site, ideally in as simple a way as possible. I looked up “heatmaps” on WP, and found some plug-ins, we want to avoid third-party services such as Crazyegg, so “WP Super Heatmap” jumped out (five stars, “simple,” etc.). Anyone have experience with this or other click- map plug-ins?


How to grab metabox value in wp_query meta_query key

How would I modify my WP_Query in order to get a custom meta box value instead of a custom field one like I currently do? This is how my query looks like:               <?php $today = date("Y-m-d",mktime(0,0,0,date("m"),date("d"),date("Y")));          $the_query = new WP_Query(  array ('showposts' => 10,                     'post_type' => 'page',                     'meta_query'=> array(                         array(                           'key' => 'start_date',                           'compare' => '<=',                           'value' => $today,                           'type' => 'DATE',                         )),                     'meta_key' => 'start_date',                     'orderby' => 'meta_value',                     'order' => 'DESC'                                     )                             );          while ( $the_query->have_posts() ) : $the_query->the_post();     ?>      Update: (what I'm using to create the metabox)               function my_meta_init_events() {         $post_id = $_GET['post'] ? $_GET['post'] : $_POST['post_ID'] ;         if ($post_id == '376') {         foreach (array('post','page') as $type) {             add_meta_box('my_all_meta_events', 'Start date', 'my_meta_setup_events', $type, 'normal', 'high'); }         }             add_action('save_post','my_meta_save_events'); }     function my_meta_setup_events() {         global $post;         $meta = get_post_meta($post->ID,'_my_meta_events',TRUE);          include(MY_THEME_FOLDER . '/inc/meta_events.php');         echo '<input type="hidden" name="my_meta_noncename_events" value="' . wp_create_nonce(__FILE__) . '" />'; }          function my_meta_save_events($post_id) {         if (!wp_verify_nonce($_POST['my_meta_noncename_events'],__FILE__)) return $post_id;         if ($_POST['post_type'] == 'page') {             if (!current_user_can('edit_page', $post_id)) return $post_id; }         $current_data = get_post_meta($post_id, '_my_meta_events', TRUE);           $new_data = $_POST['_my_meta_events'];         my_meta_clean_events($new_data);          if ($current_data)  {             if (is_null($new_data)) delete_post_meta($post_id,'_my_meta_events');             else update_post_meta($post_id,'_my_meta_events',$new_data); }         elseif (!is_null($new_data)) {             add_post_meta($post_id,'_my_meta_events',$new_data,TRUE); }         return $post_id;     }     function my_meta_clean_events(&$arr) {         if (is_array($arr)) {             foreach ($arr as $i => $v) {                 if (is_array($arr[$i])) {                     my_meta_clean_events($arr[$i]);                          if (!count($arr[$i])) {                         unset($arr[$i]); }                 } else {                     if (trim($arr[$i]) == '') {                         unset($arr[$i]); }                 }             }             if (!count($arr)) {                  $arr = NULL; }         }     }      I have meta_events.php in the right place, I see and update the metabox on that particular page, it does retain it's value, I am able to display the content of the meta box on any page, this is what I am using to grab the value of my metabox:               global $wp_query;   $array = get_post_meta(376,'_my_meta_events',TRUE); ?><?php $my_date = $array['date'];      Now, how can I modify my meta_query key to use this metabox value to filter the pages?


Does having two installations of Wordpress negatively affect SEO?

I found a similar thread Here but it didn't seem to answer what I needed. Basically, I'm running a core wordpress install on " www.domain.com " One of the pages on that site needs to run on a completely different theme. "www.domain.com/page1, /page2, /page2" would all be on the main theme. "www.domain.com/coolpage" would be on the separate theme. Two cores and plugins, etc. is fine by me. I just want to know if it would negatively impact SEO


show posts alphabetically in one category

I'm using a child theme of Twenty Twelve. I want to show posts from my main menu alphabetically for two cataegories; 'Groups' and 'Classes'. I've seen various bit of code on this site, but I can't seem to apply it properly. I will title my posts with the city name first, as follows; Kamloops - Pottery Club, Vernon - Pottery Association, Salmon Arm - Pottery Group. This way my users can find their city in the alphabetical list. In the Twenty Twelve theme, which php file do I copy into my child theme to modify, and how would I change from chronological listing to alphabetical listing. I like my thumbs and excerpts the way they are. Only want to change to alphabetical.


Anchor Text code string is automatically modified by WordPress

I have created an ad for a merchant wanting to rent ad space on my website home page. After creating the ad, (anchor text and pic/graphics with embedded hyperlink) the merchant has requested I remove my url from the ad code. The anchor text along with the embedded hyperlinks links to the merchant's home page. Problem is I don't know how my url was added to the code as I never inputted it in the original code in the first place. Somehow it was added by I think, WordPress or my server (PHP). When I view the page source I do see my url was added to the ad code. Can anyone help explain this and tell me how I can remove the url? Also, if I am able later to remove my url, how will it affect the hyperlink and anchor text? Thank you, -Dan Hi s_ha_dum, I have read your answer and have now made sure the code reads as abosolute url. Here it is with absolute url:               If you are interested in helping others treat and prevent hypertension, consider a healthcare degree from Loyola Online Courses today!      It still shows in page source however with my url addended to the code string. What am I not understanding? Thank you!


Why is the custom taxonomy archive page redirecting me to a single post?

I have a custom taxonomy, _artist_ , that is related to three custom post types: _videos_ , _posts_ and _letters_. I have an `taxonomy-artist.php` template that should display the archive for a given artist. When I visit `/artist/ARTIST_NAME` it will display the taxonomy archive template _only if there are no other posts associated with it_. If there _are_ posts associated with it, you get redirected to an individual post (I believe it's the oldest post associated with the taxonomy term). So if I visit `/artist/ARTIST_NAME` and there is content associated with it, I get kicked out to `[videos|letters|posts]/THE_POST_NAME`. I saw something about needing to have taxonomies registered before custom post types, so I am registering the taxonomy first and I've flushed out my permalink settings, but no luck. I'm stumped as to why this would be happening, so I would appreciate any ideas about what would cause this! Here's the code I'm using for registering the taxonomy and post types:               register_taxonomy( 'artist',         array(             'videos',             'letters',             'post'         ),         array(             'labels' => array(                 'name' => _x( 'Artists', 'taxonomy general name' ),                 'singular_name' => _x( 'Artist', 'taxonomy singular name' ),                 'search_items' =>  __( 'Search Artists' ),                 'all_items' => __( 'All Artists' ),                 'parent_item' => __( 'Parent Artist' ),                 'parent_item_colon' => __( 'Parent Artist:' ),                 'edit_item' => __( 'Edit Artist' ),                 'update_item' => __( 'Update Artist' ),                 'add_new_item' => __( 'Add New Artist' ),                 'new_item_name' => __( 'New Artist Name' ),                 'menu_name' => __( 'Artists' ),             )         )     );          register_post_type( 'letters',         array(             'labels' => array(                 'name' => __( 'Letters' ),                 'singular_name' => __( 'Letter' )             ),             'public' => true,             'has_archive' => true,             'supports' => array( 'title', 'editor', 'thumbnail' ),             'menu_icon' => get_stylesheet_directory_uri() . '/img/mail.png',         )     );          register_post_type( 'videos',         array(             'labels' => array(                 'name' => __( 'Videos' ),                 'singular_name' => __( 'Video' )             ),             'supports' => array( 'title', 'editor', 'thumbnail' ),             'public' => true,             'menu_icon' => get_stylesheet_directory_uri() . '/img/blue-document-film.png',         )     );


Additional menu item popping in submenus

I just want to make/add a Menu (Ads) that contains two submenus (View, Manage). My code is written below. The problem is that I don't know why it's popping another submenu in the main menu.               function Ad_menu() {         // Main menu         add_menu_page( 'Ads', 'Ads', 'manage_options', 'ad_menu', 'Main_Menu');              // Submenus         add_submenu_page( 'ad_menu', 'View', 'View', 'manage_options', 'View', 'View');         add_submenu_page( 'ad_menu', 'Manage', 'Manage', 'manage_options', 'Manage', 'Manage');     }     add_action('admin_menu', 'Ad_menu');


upload or auto setup feature photo by user avatar

I want user avatar image is set as a feature image, If there is no featured image. I am trying to do like this.               function auto_featured_image() {     global $post;          if (!has_post_thumbnail($post->ID)) {         $attached_image = get_children( "post_parent=$post->ID&post_type=attachment&post_mime_type=image&numberposts=1" );         //$attached_avatar = get_avatar( get_the_author_meta( 'ID' ));         $attached_avatar = get_avatar(1);            if ($attached_image) { // set feature image as the 1st image on post.               foreach ($attached_image as $attachment_id => $attachment) {                    set_post_thumbnail($post->ID, $attachment_id);               }       }/*elseif($attached_avatar){ // set feature image as the avatar image.                 foreach ($attached_avatar as $attachment_id => $attachment) {                     set_post_thumbnail($post->ID, $attachment_id);                 }            }*/      }     }      // Use it temporary to generate all featured images     add_action('the_post', 'auto_featured_image');     // Used for new posts     add_action('save_post', 'auto_featured_image');     add_action('draft_to_publish', 'auto_featured_image');     add_action('new_to_publish', 'auto_featured_image');     add_action('pending_to_publish', 'auto_featured_image');     add_action('future_to_publish', 'auto_featured_image');      set feature image as the 1st image on post works fine. but set avatar as feature image is not working. How can I make it work? Thanks,


Adding first / last CSS classes to menus

is that possible, without javascript hacks? like this:

 ...

 ...

 ...

 ...

 ...

 ...

 ...

 ...

 ...

 ...

 ...


I am getting an error some times when uploading themes

I am getting an error message When uploading some themes .               Warning: fopen(/home/..../public_html/...../wp-content/themes/creativeart/style.css) [function.fopen]: failed to open stream: No such file or directory in /home/...../public_html/...../wp-includes/functions.php on line 4165          Warning: fread(): supplied argument is not a valid stream resource in /home/...../public_html/...../wp-includes/functions.php on line 4168          Warning: fclose(): supplied argument is not a valid stream resource in /home/...../public_html/...../wp-includes/functions.php on line 4171      What does it mean ?I don't understand if the problem in themes or Am I missing some thing in my Wordpress Installation? I have tried the same themes in two wordpress installations and got the same error . I am listing some of themes here . mysticgrunge creativeart Does any one have idea on such error?


How would I add a link to the profile editing page of the dashboard?

Our passwords are handled by an external LDAP server and the plugin we're using to therefore removes all references to the ability to change passwords. What I'd like to do then, is add a link to the users profile editing page (where they get taken after clicking on their name) which points to our password change page. How do I add a link here?


How can i get the title i specified in add_options_page for my header

i have               add_options_page('Post Products Settings', 'Post Products Settings', 'administrator', 'pp_settings', 'pp_settings_page');      anyway i can get whats specified in the 1st parameter for use in my page header? i know i can hard code it tho, but just curious


Plugin function inside custom plugin

I am trying to use a plugin function ( `wp-bannerize()` ) inside my custom plugin. but when i write:               if( function_exists('wp_bannerize') ){                 echo "exist";             }else{                 echo "not exist";             }       The output is `not exists` How can i get this function inside my custom plugin? UPDATE: Here the code of my plugin:               class Infinite_posts{              public function __construct() {                   add_action('wp_ajax_is_bannerize', 'load_plugins');     //when plugin receive an AJAX call with 'is_bannerize'parameter load_plugins() is triggered              }              public function load_plugins(){             add_action( 'plugins_loaded', 'show_bannerize' );     //when all plugin are loaded show_bannerize() is triggered         }              public function show_bannerize(){             if( function_exists( 'wp_bannerize' ) ) {                 echo "exist";             } else {                 echo "not exist";             }                }     }          if( !is_admin() )         $infinitePosts = new Infinite_posts();      here my javascript too:               $('.gallerie h2').on('click', function(){       jQuery.post(           'http://localhost/~sdibenedetto/d-art/htdocs/wp-content/plugins/infinite-posts/infinite-posts.php',            {               'action': 'is_bannerize',               'data':   'foobarid'           },            function(response){               alert('The server responded: ' + response);           }       );          });      Is this correct? How to make the AJAX call and pass the parameter "is_bannerize" to trigger the plugin? With this javascript i have this error in the alert:               Fatal error:  Call to undefined function add_action() in /Users/sdibenedetto/Sites/d-art/htdocs/wp-content/plugins/infinite-posts/infinite-posts.php on line 44
      Pls help. Thanks


using posts_where for meta data on pre_get_posts

Let's say you have some code which filters posts by using `pre_get_posts` e.g.               add_action( 'pre_get_posts', 'be_exclude_category_from_blog' );          function be_exclude_category_from_blog( $query ) {              if( $query->is_main_query() && $query->is_home() ) {             $query->set( 'cat', '-4' );         }          }      I found a nice bit of code which enables you to further filter these posts to the last 90 days:               add_action( 'pre_get_posts', 'be_exclude_category_from_blog' );          function be_exclude_category_from_blog( $query ) {              if( $query->is_main_query() && $query->is_home() ) {             add_filter( 'posts_where', 'filter_date' );             $query->set( 'cat', '-4' );         }          }          function filter_date( $where = '' ) {         $where .= " AND post_date > '" . date('Y-m-d', strtotime('-90 days')) . "'";         return $where;     }      This works really well. But what if I want to use the same method to target a post's meta data instead of just post_date? Is this possible? From this answer it looks like you should do something like this:               add_action( 'pre_get_posts', 'be_exclude_category_from_blog' );          function be_exclude_category_from_blog( $query ) {              if( $query->is_main_query() && $query->is_home() ) {             add_filter( 'posts_where', 'filter_date' );             $query->set( 'cat', '-4' );         }          }          function filter_date( $where = '' ) {         global $wpdb;           $where .= " AND ($wpdb->postmeta.meta_key = '_length' AND $wpdb->postmeta.meta_value = '61')";         return $where;     }      However this does not work for me, it returns zero results. Even though I know there are posts with a meta key of `_length` with a value of `61`. Could someone point me in the right direction? Cheers


what is the correct way to compare dates in a WP query_posts meta_query

I have a query_posts call in a WP template. Through the use of the More Fields Plugin I can give the site admin the ability to create an event (custom post type) and then enter a date which is formatted: YYYY/mm/dd. The main question is; what value should I pass to the value option in the meta_query array? I am currently trying to pass "date("Y/m/d h:i A")" (minus the quotes), because, as I understand it, that will print the current date today. I don't care about the time of date so that may be irrelevant. Ulitimatly I am trying to use the compare option to nail down showing upcoming events, past events in different places on this site. In one other spot I actually need to pass the value option an array that prints that first and last day of the current month, limiting the output to events happening this month.               <?php                  query_posts( array(                    'post_type'  => 'event',        // only query events                   'meta_key'    => 'event_date',  // load up the event_date meta                   'orderby'     => 'meta_value',  // sort by the event_date                   'order'       => 'asc',         // ascending, so earlier events first                   'posts_per_page' => '2',                   'meta_query'  => array(         // restrict posts based on meta values                       'key'     => 'event_date',  // which meta to query                       'value'   => date("Y/m/d h:i A"),  // value for comparison                       'compare' => '>=',          // method of comparison                       'type'    => 'DATE'         // datatype, we don't want to compare the string values                     ) // end meta_query array                   ) // end array                 ); // close query_posts call                      ?>


Displaying table data on a page

I would like to present content from a table located in Wordpress data base to a Wordpress page. Is there any plugin that i can use.If not,what is the simplest way to code it? Thanks, Ron


Thumbnails have stopped generating correctly

I had thumbnails set up and working perfectly on my site. However, I wanted to change the size and did so through the functions.php file (although I see this is now an option in Settings -> Media). I then used the plugin Regen. Thumbnails. It went through all the images and seemed to be successful. However, this has now broken all of my thumbnails. I can see it did not create new images in the uploads folder (just the original 150x150px thumbnails). All the links through to thumbnails now just link through to the full size of the image. If I upload a new image, a thumbnail will not be generated. I've restored the thumbnail settings back to the original settings, no luck (also tried regenerating them at the original size even though these are still present in the uploads folder). Any ideas?!


getting all values of a custom taxonomy if there is no post

I am working on a real estate theme. I am using some custom taxonomies such as Listing Purpose and Property type etc. In my add Listing form I am displaying each taxonomy in a dropdown, for which to work accordingly, I need to manually select all the taxonomy values in a post first then I can see the dropdown being filled properly. Today, for a check I deleted all the posts and came back to add Listing page and the dropdowns were empty. My question is that is there any way that I need not to first select all the values in each taxonomy? hope i was clear enough to get a suitable answer.


How to use next_post_link and previous_post_link on single posts in search results

I'm using `next_post_link` and `previous_post_link` on my single post templates, to navigate from post to post, so far so good. But if I do a search and click on a result post, then the `next_post_link` doesn't bring me to the next result post, but to the next post in the default post order. Is there a way to make `next_post_link` and `previous_post_link` behave in different ways depending on the context ? When in a search context, browse only within search results, etc. **EDIT** : I'm looking for a solution that would work with custom post types.


Can anyone tell me why I can't edit a plugin when it is installed without having to re-install?

I am using a shortcode plugin as a framework for the short codes I want to add that go with my theme. I decided to just include the plugin in a repo for the user to dl so I am not building theme right into the theme. When I try to add shortcodes, and make changes they don't seem to show up no matter what I do unless I reinstall the plugin completely. I am using Notepad++ as an editor instead of the WP editor, because I can't see why it would matter. This seems to happen with any plugin I attempt to modify. What gives?


WordPress: query pages except remove one page

I'm currently running this query to get pages (not posts) from the site section:               query_posts("post_type=page&post_parent=6");      I'd like to remove one page, 271, from this query. Based on this stack I tried:               query_posts("p=-271&post_type=page&post_parent=6");      Unfortunately this had the opposite of the intended result, showing only page 271 and not the other pages in the loop. Placing the _p=-271_ at the end of the query had the same unsuccessful result. How can I reverse this to show all the other pages except page 271?


Slug adding -2 even though the other posts with the same name is in a separate post type

This is annoying, and because of this I separated their post types. Now, I have two post types:   1. `motogp-2013`   2. `motogp-2014` In my post type `motogp-2013` I had an event called 'Grand Prix de France' which turned to 'grand-prix-de-france' as a permalink. I'm now in the `motogp-2014` post-type and I added a post with the same name 'Grand Prix de France' which turned to 'grand-prix-de-france-2' as a permalink. Even though they are completely separate post-types, they are adding a 2 after the permalink. Why is this? Can it be stopped?


How do i hide the auto-generated custom field that's created when update_post_meta() is called?

I've added a custom textarea for the create/edit post admin page. I did so using the add_meta_box() function. The problem is that the add_meta_box() callback function (which saves the data input into the textarea) calls the update_post_meta(). update_post_meta() then adds a custom field within the custom field section. So you essential end up with two textareas for the same field! The one you've created and the auto generated one! Is there a way to remove the auto generated custom field? Thanks, Jon


Seaweed Plugin not working

I have installed the Seaweed (Wordpress Plugin). I have successfully installed it and I can able to edit the content. But the save function is not functioning popularly. when I clicked on the "save button", the processing bar displays and nothing happens beyond that. Has any one try it ? Could any one help me to make use of it.


How to transfer a WordPress blog to a different domain?

Let's say we are currently hosting our WordPress blog on certain domain and would like to move it to a new domain. How to do this with the least hassle and SEO hit? Are there any plugins that could help with this? (for example providing automatic cross-domain 301 redirection or similar)


Cannot retrieve a custom RSS field from posts

The goal is to display a featured thumbnail micro thumb as a custom field in RSS. This is what I've done:                   //theme functions.php     function rss_post_thumbnail($content) {         global $post;         add_post_meta($post->ID, 'little_thumb', get_the_post_thumbnail($post->ID,  'thumbnail'), 1);         return $content;     }     add_filter('the_excerpt_rss', 'rss_post_thumbnail');     add_filter('the_content_feed', 'rss_post_thumbnail');              //feed rss2.php     <item>         <little_thumb><?php echo get_post_meta(get_the_ID(), 'little_thumb', true); ?></little_thumb>     </item>      But, I can't seem to retrieve this value with the parses. If I open RSS source code though, I can see this thumb right there. Any ideas? I'm using a really lightweight lastRSS.php class, if it matters.


How can I add an "ALL CATEGORIES" entry in wp_dropdown_categories?

I want to let the users search posts by categories. So I use wp_dropdown_categories to build a drop-donw list with all categories. Trouble is I want to allow them to set this to "ALL CATEGORIES" as well. So how can I add another entry in the drop-down list? Thanks,


Issue with Custom Post Type Tags

I cannot get TAGS to work within my custom post types. I have the following to establish my custom post type:               function Work() {         $labels = array(             'name'               => _x( 'Work', 'post type general name' ),             'singular_name'      => _x( 'Work', 'post type singular name' ),             'add_new'            => _x( 'Add New', 'Work' ),             'edit_item'          => __( 'Edit Work' ),             'new_item'           => __( 'New Work' ),             'all_items'          => __( 'All Work' ),             'view_item'          => __( 'View Work' ),             'search_items'       => __( 'Search Work' ),             'not_found'          => __( 'No Work Found' ),             'not_found_in_trash' => __( 'No Work Found In The Trash' ),              'parent_item_colon'  => '',             'menu_name'          => 'Work'         );         $args = array(             'labels'        => $labels,             'description'   => 'Holds our Work and Work specific data',             'public'        => true,             'menu_position' => 5,             'supports'      => array( 'title', 'editor', 'thumbnail', 'excerpt', 'comments' ),             'has_archive'   => true,             'taxonomies' => array('category')              );         register_post_type( 'Work', $args );      If I take: 'taxonomies' => array('category') and edit to array('tags') nothing happens. Shouldn't that make tags work with my custom post type? I also found this code:               function reg_tag() {              register_taxonomy_for_object_type('post_tag', 'CUSTOM_POST_TYPE');     }     add_action('init', 'reg_tag');      and added it to my functions file as well, but no luck with that either. Can anyone point me in the right direction?


How to extract url from get_the_term_list?

How do you extract the url from :               $url = get_the_term_list($post->ID, 'nom-origin')      I have tried many things but i just don't get it. The only solution i got was this but i know it's just too messy :               $url = get_the_term_list($post->ID, 'nom-origin');//,'
Job Category:
 ', ', ', '' );     $url_tmp1 = explode("href=\"",$url);     $url_tmp2 = explode("\" rel=\"tag\">",$url_tmp1[1]);     $url_simple = $url_tmp2[0];


adding custom classes for tables

I have to implement a default class for HTML-Tables at WordPress. The wp- standard is `<table>` .. ist there any way to do this, that i get this output per default? `<table class="abc xyz">` maybe with filters?


Generate Own Custom CSS Button with icon

I recently changed my WordPress theme and noticed that all the buttons in previous theme are gone and are now looking like this on my new theme:               [button link="http://.....com" style="download" color="primary"]Download Latest Me[/button]      The style is the download icon while primary represents Green color. I simply need a guide here on where and how I can create a similar plugin or tinymce as I have over 300 of these already posted :(


Create Array from custom post type to display a slider

I have created a custom post type in my wordpress theme dedicated to creating slides for a slider displayed on the homepage, It has a title, slide text and slide url and also featured image. I'm now trying to get this info from the meta boxes within the custom post type and turn it into a slider that shows as many slides as there are posts. Currently my outputted code is a bit of a mess and all that is happening is the featured image is being shown, but not in the right place and not with the text etc. Here is my php code:

          <?php $loop = new WP_Query( array( 'post_type' => 'slider', 'posts_per_page' => -1 ) );?>     <?php while ( $loop->have_posts() ) : $loop->the_post();?>          <?php     $slide_text = get_post_meta($post->ID, "_text", true);      $slide_url = get_post_meta($post->ID, "_url", true);      $slide_img = the_post_thumbnail();      ?>

<?php echo $slide_text; ?>
             <a href="<?php echo $slide_url; ?>" id="scroll_to">                                                       see what we can do for you.
     <?php echo $slide_img; ?>
          <?php endwhile; wp_reset_query(); ?>

      And this returns the following in my HTML:

                                                                                see what we can do for you.

#about
                                                                                see what we can do for you.

      I can't figure out what I have done wrong, I'm sure it's something to do with how I've set up the loop, but I'm not sure where to start looking. Any help would be appreciated


Will multiple conditionals slow down page load?

I plan to implement some specific content for specific categories only, about 15. I wonder will wordpress conditionals (15 if) slow down my website visibly? Sorry if this sounds silly.


Get custom url from thumbnail

I am working on a multisite install using folders, and am trying to create a grid of images which link to different sites within the mulitisite. I've created a bunch of posts in a category "sites", inserted images and used the "custom url" function in the wp editor to link them to each site. I'm grabbing the images from these to display in the grid OK, but need help to link them to the custom url associated with the images instead of just the post they came from... Any ideas much appreciated - thanks Here's the code I'm using to get images from the "site" category posts to display in a grid:                    <?php $custom_query = new WP_Query(array ('cat' => 34, 'showposts' => 1));     query_posts($custom_query);     while($custom_query->have_posts()) : $custom_query->the_post();?>

     <a href="<?php the_permalink() ?>" rel="bookmark">            <?php         if ( has_post_thumbnail())         {           $thumb = wp_get_attachment_image_src( get_post_thumbnail_id( get_the_ID() ), 'preview-thumb' );           echo '';         } else {           echo 'No post thumbnail.';         }       ?>


Is wordpress suitable for beginners with coding skills?

I am web design beginner currently deciding as to which program to use for my web design process, considering wordpress, drupal, brackets and Dreamweaver.


Will $current_user no longer be global?

I just had a look at Global variables in WP and I discovered that a lot has changed since the last time I looked. `$current_user` is no longer listed. Does that mean this and many other (old) globals will be "phased out" from future WP versions?


Drop-down list of article tags

How would I get a list of all the tags on a post-type archive page and display the tags not in a tag cloud but in a multi-select drop-down list. When the user selects tags, then filter which posts are displayed to match the approach tag choices (preferably without reloading the page - ajax)?


Use one template only for custom post type archives?

I'm currently using `archive.php` as a generic listing for categories, tags, authors, etc. However, my custom post types have a very customized archive page that's completely different from `archive.php`. I'm wondering if there's a way to create one archive file that acts as a generic template for **only** my custom post types. If it was included in the Template Hierarchy, it would likely be called `archive-post-type.php` or `post-type.php`. I know I can use includes or `get_template_part`, but it's really just the same archive file across multiple post types, so I'd rather just create one file for all of them. Ideally, this CPT archive template could still be overridden by `archive-$posttype.php`. If I utilized `archive.php` instead for the custom post types, I'd have the same problem in reverse, since `category.php`, `tag.php`, `date.php`, etc. would all be the same template, yet still different from `archive.php`.


Capability for allowing user to post own comments without moderation

I work at a radio station that has several WP user roles -- for simplicity sake, let's say Admin, Programmer, Subscriber, in decreasing order of ability. Currently, Admin users need to approve comments left by Programmer users. How do I auto-approve Programmer-level comments, without letting that user level administrate comments globally? Thank you!


Custom Post Row Actions

I came across this question while writing this question. I have one question that extends upon that question. I figured out that you use the `get_delete_post_link` filter to create a new url for my actions (or a similar function -- In any case, I'm using that one with the boolean at the end). Only thing is, **I don't know how to capture the event now.** Some help would be appreciated considering I can't find many examples of post row actions on Google. :-/               public function _wp_filter_get_delete_post_link( $post_id, $deprecated, $force_delete = false )     {         if ( ! empty( $deprecated ) )         {             _deprecated_argument( __FUNCTION__, '3.0.0' );         }              $post = &get_post( $post_id );               if ( ! $post ) return;              if ( strcmp($post->post_type, "visitor") ) return;              $post_type_object = get_post_type_object( $post->post_type );         if ( !$post_type_object ) return;         if ( !current_user_can( $post_type_object->cap->delete_post, $post->ID ) ) return;         // http://localhost/wordpress/wp-admin/post.php?post=163&action=trash&_wpnonce=a56abdcbb3              $action = ( $force_delete ? 'logout' : 'login' );              $delete_link = add_query_arg( 'action', $action, admin_url( sprintf( $post_type_object->_edit_link, $post->ID ) ) );              return wp_nonce_url( $delete_link, "$action-{$post->post_type}_{$post->ID}" );     }      And, if you're needing some more information on how I'm using it, here's some more code:               public function _wp_post_row_actions( $actions, $post )     {         if ( $post->post_type == 'visitor' )         {             //unset( $actions['edit'] );             unset( $actions['inline hide-if-no-js'] );             unset( $actions['trash'] );             unset( $actions['view'] );                  $state = get_post_meta( $post->ID, 'v_state', true ) === 'in';                  if ( $state )             {                 $actions['trash'] = get_delete_post_link( $post->ID, '', true );    // Logout                 // get_delete_post_link             }             else             {                 $actions['trash'] = get_delete_post_link( $post->ID );  // Login             }         }              return $actions;     }      **EDIT:** Well, the above isn't complete. I just noticed that it doesn't actually generate a link which is weird. **So, I guess what I'm asking is for a way to customize the Post Row Actions for my custom post type by adding a "Logout/Login" link in place of the`$actions['trash']` link.**


Broken category pagination

For some reason the below code works until I hit the third page and gives 404. Is it possible to fix it without using any plugins?               <?php         $temp = $wp_query;         $wp_query = null;         $wp_query = new WP_Query('cat='. $id .'&posts_per_page=4&paged='.$paged);         while ($wp_query->have_posts()) : $wp_query->the_post();     ?>          <?php get_the_content() ?>          <?php endwhile; ?>               <?php if (  $wp_query->max_num_pages > 1 ) : ?>         <?php previous_posts_link( __( 'Previous', 'themename' ) ); ?>         <?php next_posts_link( __( 'Next', 'themename' ) ); ?>     <?php endif; ?>          <?php $wp_query = null; $wp_query = $temp;?>


Custom Post Type Menus

I'm writing a plugin for work because our main website is being ported to WordPress eventually. I've got multiple custom post types planned for this plugin and would like to group them all into one main menu. Basically, **I want the "Visitors" link to be placed under "Argus Admin".** The other links aren't necessary to be added as I can "hack" those wherever I want.                   $v_args = array(             'labels' => array (                     'name' => 'Visitors',                     'singular_name' => 'Visitor',                     'add_new_item' => 'Register New Visitor', // TODO: http://codex.wordpress.org/Function_Reference/register_post_type#Arguments                 ),             'public' => true,             'publicly_queryable' => false,             'exclude_from_search' => true,             'show_ui' => true,             'show_in_menu' => 'argus',  // TODO: This doesn't work...             'hiearchical' => false,             'supports' => array( '' ),             'register_meta_box_cb' => array ( &$this, '_wp_visitor_meta_box_cb' ),         );              register_post_type( $post_type, $v_args );      This my menu page that I created:               add_menu_page( 'Argus', 'Argus Admin', 'manage_options', 'argus', array( &$this, '_wp_argus_main_panel' ), '', -1 );


Query of custom post types only shows first post

I have a loop to show my custom post type of 'case_studies'. It originally showed all posts until I wanted to just show 3 specific posts. The problem is that it only shows the first post in my list of 'p=54,49,44'. What am I doing wrong?               $case_studies = new WP_Query();                     $count = 0;                      $case_studies->query('post_type=case_studies&p=54,49,44');                       while($case_studies->have_posts()) : $case_studies->the_post(); $count++;                         $custom = get_post_custom($post->ID);                         $case_studies_image_url = $custom['second_image'][0];


Img Src File path issue

To get images loaded correctly when I use img src in HTML, I have to give the entire file path. Using CSS I would only need to use:               `background-image: url(images/morebutton.png)`      With img src I have to use this:               <img src="wp-content/themes/blankslate/images/morebutton.png">      Using this file path gives me the image on the home page, however when I click through to the article page, the image doesnt load.. I'm having the same issue with my logo, it shows on the homepage, any additional pages it doesnt show. Can anyone tell me if the file path setup I have is incorrect?


Create a admin page in wordpress without admin menus ("wordpress sidebars")

I'm creating a new page in WordPress admin for a theme. In this new page will be a list of people registered (in a form), but with few details / information. So when a person clicks on something, I would like to open a "pop-up" (with all information) but not display this popup/page in the menus of the WordPress administration. Is there any way?


Creating arguments from loop for WP_Query meta_query

I'm trying to create a WP_Query with the outcome arguments such as:               $args = array(         'post_type' => array( 'post', 'custom' ),         'meta_query' => array(            'relation' => 'AND',               array('key' => 'key1', 'value' => 'value1'),               array('key' => 'key2', 'value' => 'value2'),               array('key' => 'key3', 'value' => 'value3')         )     );      What I'm really doing is creating an advanced search which gets the meta values to search like this:               //$queryData = array();     //parse_str($_SERVER['QUERY_STRING'], $queryData);            $queryData = array('key1' => 'value1','key2' => 'value2','key3' => 'value3');          $args = array(         'post_type' => array( 'post', 'custom' ),         'meta_query' => array(            'relation' => 'AND',                 /* ADD $queryData loop HERE*/              )     );      I'm trying to avoid to manually create each search parameter:                         array('key' => 'key1', 'value' => 'value1'),               array('key' => 'key2', 'value' => 'value2'),               array('key' => 'key3', 'value' => 'value3')      and just use $_SERVER['QUERY_STRING'] to create array and loop to add the arrays to meta_query I'm having difficulty merging or adding the arrays to meta_query


How to manage a 200 sidebars website? widgets.php page is way too slow!

I'm using a plugin called "Simple Page Sidebars" (http://wordpress.org/extend/plugins/simple-page-sidebars/) to manage the sidebar of pages. The problem is that now, I have more than 200 sidebars in backend "widgets.php", it takes a very long to fully load the page. Sometimes, if I want to edit a widget, the AJAX call need several minutes to lead everything. Also, it happens that when saving a widget too quickly (without waiting that the page is fully loaded), I'm loosing my entire widget/sidebar configuration, which is very annoying. Am I doing anything wrong here? Can you recommend me any easiest sidebar/widget management solution for a 200 sidebars website? I was thinking to manage everything from pages but it is not very convenient when it comes to use the same sidebar across different pages. Thanks for you help.


Download html textarea content as a file

I am working on a project where the requirement is to download a textarea content as a .txt file on a wordpress site.               <html>     <body>     <form action="#" method="post">     <textarea name="text" rows="20" cols="100"></textarea>     <input type="submit" value="submit">Download Text</input>     </form>          <?PHP          if(isset($_POST['submit']))      {             $text = $_POST['text'];     print ($text);          $filename = 'test.txt';     $string = $text;          $fp = fopen($filename, "w");     fwrite($fp, $string);     fclose($fp);          header('Content-disposition: attachment; filename=test.txt');     header('Content-type: application/txt');     readfile('test.txt');           }          ?>          </body>     </html>      I am using a plugin to process the php code in pages.But for me it is not creating a .txt file. please help me to identify the issue


WP-Syntax plugin not working

I am new to wordpress (installed yesterday for first time). In order to add syntax highlighting i installed the WP-Syntax plugin and i copied pasted the following snippet in the edit post window. Its copied from the usage examples.

     <?php     function foo() {     echo "Hello World!\\n";     }     ?>

      However when i preview it on the main site i end up seeing the following as it is, whereas i was expecting to see highlighted php code. Could anyone point out what could be the issue?


Use of Javascript with Dojo/Dijit on a WordPress page

I just created a web page that uses a lot of JavaScript to build a fancy form that helps build an build the object/html behind an mp3 player for a user. I got it working and tested in a plain-html page outside of WordPress. I then copied into a WordPress "page", took out the <head> tag, changed <body> to a <div>, but no luck. Can it even be done? I also want to use a small javascript to open up a video-player in a new small browser-window. Working on raw html page: http://learnhowtoputaudioonyoursite.com/TestMP3Player.html Not working in WP page: http://learnhowtoputaudioonyoursite.com/build-player


Using jQuery prepend() with file include

I'm working on a plugin that will add a top header bar (similar to the admin bar) directly after the `<body>` tag to sites. Since this will be used on multiple themes, I can't rely on the various hooks that some themes / frameworks provide. I know that I can use the `prepend()` function to include raw markup, but I can't seem to find a solid way to have include a .php file instead.


mysql_real_escape_string() error using xml2ary in Wordpress plugin

I created a plugin in order to replace some content in the post with information from a xml file. To parse the file I'd like to use xml2ary and the `wp_insert_post_data` filter. I got the content replacement working with a _teststring_ and I can also parse the **xml** in a script outside of WordPress. But when I try to call               $data = xml2ary(file_get_contents($url));      inside of the plugin, I get the following error, twice: > Warning: mysql_real_escape_string() expects parameter 1 to be string, array > given in {path}\testblog\wp-includes\wp-db.php on line 774 plus another one: > Warning: Cannot modify header information - headers already sent by (output > started at {path}\testblog\wp-includes\wp-db.php:774) in {path}\testblog\wp- > includes\pluggable.php on line 934 Here's my plugin code:               require_once("xml2ary.php");          if (!class_exists("Marketplace")) {     class Marketplace {              function Marketplace(){                  add_filter( 'wp_insert_post_data' , 'addInfo' , '99', 2 );         }          }     }          if (class_exists("Marketplace")) {     $marketplace = new Marketplace();     }               if (isset($marketplace)) {          function addInfo( $data, $postarr ){              $url = "http://catalog.zune.net/v3.2/de-DE/apps/578ef361-c265-46b7-b6f4-63cbd7fbefe0?clientType=WinMobile%207.0";     $data = xml2ary(file_get_contents($url));          $data["post_content"] = "test";     $data["post_content filtered"] = "test";     return $data;     }          }      Any idea why this is happening?


Sideways8 Taxonomy Images add term issue

I'm using the Sideways8 Taxonomy Images plugin (latest version), with WP 3.7.1. I also use the woocommerce plugin (latest version). It all worked well till some point, where I really don't know why, but the S8 plugin started not funcitioning prerfectly. It correctly saves term-images, but the term page doesn't refresh after clikking the add button. So it seems that nothing happens (while the new term was instead effectively saved). If you want to see the new term, you must manually refresh the page. Any idea of what could be? ![enter image description here](http://i.stack.imgur.com/W7MsZ.png)


Best way to add internal link in widget

I'm looking for a way to transform a static piece of code into a widget to display in different sidebars containing a simple internal link. The basic code is:
     <a href="<?php echo get_page_link(90); ?>">My link text
      The main focus is to make it future proof so no matter the site url it should be working without a search and replace or other manual intervention. I would like to avoid:   * php in widget   * hardcoded link  Maybe a widget specific shortcode? Any help is much appreciated :)


How to recover WordPress Adress(URL)

I installed WordPress in localhost. I changed the WordPress Address from the general settings. After that none of the previous pages appears. Instead, a "Page Not Found" error page is appearing. I tried to change WordPress Address into previous one, but it doesn't happen. Now how can I recover the previous pages?


Best practice for multiple queries on page

On my WordPress site I have three categories 'moviestar', 'interviews', and 'movies'. On a 'moviestar' category page that is entitled 'Angelina Jolie' (and with a custom variable starname='Angelina Jolie'), I want to display posts from other categories tagged with 'Angelina Jolie'. My Page Example: ### Angelina Jolie (normal page information) ### Interviews query 1 - display linked list of all posts in 'interviews' category tagged with 'Angelina Jolie' ### Filmography query 2 - display linked list of all posts in 'movies' category tagged with 'Angelina Jolie' ### NextGen Gallery query 3 - display all pictures in NextGen Gallery tagged with 'Angelina Jolie' * * * So my questions are:   1. How do I query posts in specific categories tagged with Angelina Jolie? Like this?              global $wpdb;     $yourCategory = '123';     $yourTag = 'Angelina-Jolie';     $querystr = "                 SELECT p.* from $wpdb->posts p, $wpdb->terms t, $wpdb->term_taxonomy tt, $wpdb->term_relationships tr, $wpdb->terms t2, $wpdb->term_taxonomy tt2, $wpdb->term_relationships tr2                 WHERE p.id = tr.object_id                 AND t.term_id = tt.term_id                 AND tr.term_taxonomy_id = tt.term_taxonomy_id                 AND p.id = tr2.object_id                 AND t2.term_id = tt2.term_id                 AND tr2.term_taxonomy_id = tt2.term_taxonomy_id                 AND (tt.taxonomy = 'category' AND tt.term_id = t.term_id AND t.slug = '$yourCategory')                 AND (tt2.taxonomy = 'post_tag' AND tt2.term_id = t2.term_id AND t2.slug = '$yourTag')                 ";     $pageposts = $wpdb->get_results($querystr, OBJECT);     if ($pageposts):         foreach ($pageposts as $post):             setup_postdata($post);             // do regular WordPress Loop stuff in here         endforeach;     else :         // nothing found     endif;        2. How do I modify the above to query multiple categories and store which category the post is in?   3. Does it make sense that I will query once on the page and then use a PHP loop to echo out the information under each heading? Something like...               while(($row=mysql_fetch_array($result))&&($row['cat']=='845')){       echo "
". $row['post_title'] . "
";        4. Would it be better to abandon using WordPress functions and queries and instead query the db directly using normal php? I really need some advice or a good example. I'm using Wordpress 3.3.2 I have read the following but I just don't get it yet: http://www.borishoekmeijer.nl/show-related-posts-using-custom-taxonomy/ http://stackoverflow.com/questions/8563136/wordpress-query-filtering-by- custom-field-tag-and-category


Looking to display non-image files in Gallery with logo specific to file type

When I first began looking into this, File Gallery got me much closer to solving the problem. The only issue is that the plugin only displays the generic non-image icon when I upload a file. Does anyone know of a pre-existing plugin that would either work alongside File Gallery or in place of it to achieve logos specific to a file type (say, I upload a .doc file then the plugin displays a MS Word logo). Failing a pre-existing plugin, what would be a good starting point to attempt to craft my own hand-made solution? Thanks in advance! _Note: This was originally posted in on the wordpress.org support forumhere, but since it got no responses there, I thought I'd try my luck here._


Use template of parent category for single post sub-categories

I have single post templates in a folder in my child theme marked "single". I need the sub categories to use the same template as their parent. I've read a dozen tutorials all of which were more than 3 years old and don't seem to work anymore. So what's the correct way to do this? Here's what I was trying.               function pa_category_top_parent_id ($catid) {      while ($catid) {       $cat = get_category($catid); // get the object for the catid       $catid = $cat->category_parent; // assign parent ID (if exists) to $catid       // the while loop will continue whilst there is a $catid       // when there is no longer a parent $catid will be NULL so we can assign our $catParent       $catParent = $cat->cat_ID;     }     return $catParent;     }     define(SINGLE_PATH, STYLESHEETPATH . '/single');     /**     * Filter the single_template with our custom function     */     add_filter('single_template', 'my_single_template');     /**     * Single template function which will choose our template     */     function my_single_template($single) {      global $wp_query, $post;      foreach((array)get_the_category() as $cat) :         $categoriapadre= pa_category_top_parent_id ($cat);         if(file_exists(SINGLE_PATH . '/single-cat-' . $cat->slug . '.php'))         return SINGLE_PATH . '/single-cat-' . $cat->slug . '.php';         elseif(file_exists(SINGLE_PATH . '/single-cat-' . $categoriapadre . '.php'))         return SINGLE_PATH . '/single-cat-' . $categoriapadre . '.php';            endforeach;      return $single;     }


Why are my constants not available outside my class?

I'm developing a plugin and I try to use a class (following the method of another plugin). But I don't understand why my constants are not globally available. This is my code:               /*     Plugin Name: Some simple plugin     */            if (!session_id())         session_start();          class myPluginClass {            function __construct() {         /* Set the constants needed by the plugin. */         add_action( 'plugins_loaded', array( &$this, 'constants' ), 1 );       }                 function constants() {         $upload_dir = wp_upload_dir();              define( 'SIMPLE_GALLERY_DIR', trailingslashit( str_replace('\\', '/', plugin_dir_path( __FILE__ )) ) );              //This works and outputs http://.....         echo SIMPLE_GALLERY_URL;       }          }          $sg = new simpleGallery();     //This does not work and outputs SIMPLE_GALLERY_URL.     echo SIMPLE_GALLERY_URL;      The result of the above two is: `SIMPLE_GALLERY_URLhttp://.....` This means that my last echo is executed before the class. Or is it? `constants()` is attached to the `plugins_loaded` hook - could it be that this is executed after page is loaded?


How can I find out what items a user has purchased?

I'm using WordPress E-Commerce (get shopped) and would like to get a list of items that a user has purchased, just a list of post IDs would be perfect. Is there any way for me to get this? It must be stored somewhere.. has anyone attempted this before?


Vimeo thumbnails

I use Advanced Custom Fields to show Vimeo videoes on a site I am creating for a client - The client pastes the vimeo ID (the last letters in the url) in a field, and the video is shown. But I would also like to show thumbnail of the video, I am using the following (not working code) for this:               <?php     $imgid = the_field('video_link');     $hash = unserialize(file_get_contents("http://vimeo.com/api/v2/video/$imgid.php"));     echo $hash[0]['thumbnail_medium'];       ?>      This code only shows the video-ID on the page. But if I, instead for "the_field('video_link')" writes the video-ID in the code - the thumbnail URL _is_ displayed. Does anyone know what I am doing wrong? :)


Rename image uploads with width in filename

I am attempting to change the name format that Wordpress uses to rename uploaded files. For example, when I upload an image with filename "cat- picture.jpg" Wordpress will create scaled versions and rename the filename to variations of "cat-picture-{WIDTHxHEIGHT}.jpg". Is there a way I am able to move this width & height attribute to the beginning of the filename so instead I get variations of "{WIDTHxHEIGHT}-cat-picture.jpg"? So, in the context of this example, I'd like the filename to be renamed to "600x400-cat- picture.jpg". Thoughts? I've looked at this post and this post, but I am unable to come up with a working solution. Here's my code:               add_filter( 'wp_handle_upload_prefilter', 'modify_uploaded_file_names', 20);     function modify_uploaded_file_names( $image ) {         // Get default name of uploaded file and set to variable         $imagename = $image['name'];         // Case switch for multiple file extensions         switch ( $image['type'] ) {             case 'image/jpeg' :                 $suffix = 'jpg';                 break;             case 'image/png' :                 $suffix = 'png';                 break;             case 'image/gif' :                 $suffix = 'gif';                 break;         }         // Get size of uploaded image and assign to variable         $imagesize = getimagesize($image);         // Re-structure uploaded image name         $image['name'] = "{$imagesize[0]}x{$imagesize[1]}-{$imagename}.{$suffix}";              return $image;     }      Any help would GREATLY be appreciated. **_Thanks!_**


How to hide image-url if no attachment?

How can I hide the img-tag if there is no attacment? (function is from this tutorial: http://wp.tutsplus.com/tutorials/automagic- post-thumbnails-image-management/)               <img src="<?php get_attachment_picture();?>" />      I need something like this:               <?php if ( get_attachment_picture()) { ?>     <img src="<?php get_attachment_picture();?>">     <?php } else { ?>     show nothing, not even av default image     <?php } ?>      Here is the function I use:               <!?php           /* Function to process your thumbnail & image        Copy and paste the code below to your functions.php */          function get_attachment_picture(){         global $post, $posts;         $related_thumbnail =  get_post_meta($post->ID, 'image', $single = true);                            //read post meta for image url              if($related_thumbnail == ""):             $attachments = get_children( array(                                         'post_parent'    => get_the_ID(),                                         'post_type'      => 'attachment',                                         'numberposts'    => 1,                                         'post_status'    => 'inherit',                                         'post_mime_type' => 'image',                                         'order'          => 'ASC',                                         'orderby'        => 'menu_order ASC'                                         ) );             if(!empty($attachments)):                                               //check if there an attachment or not                 foreach ( $attachments as $attachment_id => $attachment ) {                   if(wp_get_attachment_image($attachment_id) != ""):                       $related_thumbnail = wp_get_attachment_url( $attachment_id );                   endif;                 }             else:                                                           // if no attachment                 $first_img = '';                 ob_start();                 ob_end_clean();                 $output = preg_match_all('//i', $post->post_content, $matches);                 $first_img = $matches [1] [0];                      if(!empty($first_img)):                     $related_thumbnail = $first_img;                 else:                     $related_thumbnail = "images/default_thumbnail.jpg";                            //define default thumbnail, you can use full url here.                 endif;             endif;         endif;                echo $related_thumbnail;     } ?>


How can I Add a variable PHP in the Menu Nav

I want to add a variable in the Menu, for passing a value in all my page. The purpose is to retrieve a value for transport to another web site (from my website links) to the tracking, this value depends on the origin of the user. eg of my menu :               - Home = mylink/?partenaire=<?php     echo $myPartenaire;     ?>          - About us = mylink/aboutus.php?partenaire=<?php     echo $myPartenaire;     ?>          - Contact = mylink/contact.php?partenaire=<?php     echo $myPartenaire;     ?>      I can retrieve the value in my page but not in the menu   1. I've installed this plugin to put PHP in my page http://wordpress.org/extend/plugins/insert-php/   2. In function.php before "`?>`" at the bottom of the page, I've add :              $myPartenaire =  $_GET['partenaire'];        3. In header.php At the beginning, I've add :              <?php global $myPartenaire ;  ?>        4. In my page I can retrieve the value, I've add :              [insert_php] global $myPartenaire ;  [/insert_php]          LINK OF MY PAGE          eg : mylink/contact?partenaire=<?php     echo $myPartenaire;     ?>      I know after how to get the value of "partenaire" in my page, but I don't know how to add the value               partenaire=<?php     echo $myPartenaire;     ?>      in all the link in my nav menu.


Change wordpress meta tag description using WP functions

I do apprecciate this may sound like the usual question, but it is not. Just to let you understand I do not need to install one of the many SEO Plugin and change it on the box before content is published. My scenario is the following: I have a page which Querystring may change the content shown on page and I'd like to do the same with meta description and title if that would the the case. In a normal template file I would probably look for the querystring and stick an if condition. Problem is that template is not mine and when it will be updated my changes will be lost. So I thought to a slightly more complicate solution. Using the Wordpress php_exec plugin I will embed the php lines in the content section delegating to them the task, but using normal Wordpress core functions. This is a must, because I can't use a simple if condition in the content area, not without having two meta descriptions or title in the page, with the latter added in the wrong place. So what I need to do is understanding how Wordpress is adding both the meta in the final HTML. Is this something related to the add_action('wp_head', ... something here)? As additional info, I am not using Yoast SEO plugin, so I can't rely on any of his additional function. Thanks for your help Andrea


How to store username and password to API in wordpress option DB?

I'm currently developing a plugin and the chances are that I will more than likely release it on the public plugin repository so others can use it. The plugin will be using an API and to use this API you need to pass a username and password. So my plugin needs to store these login credentials in the database. I don't want to store these in plain text although the API needs them in plain text. So my question is how do I store these sensitive bit of information? Hashing is out, so it has to be some sort of encryption. In WordPress is there a unique key that can be used that will differ from blog to blog? What php functions should I use to encrypt and decrypt? I'm looking for functions that will more than likely work on all WP installs.


query for filtering published posts?

i need to filter count based on a date and post_status = 'publish', how to write a query to filter, as far as now i have filtered based on date, what is the query need to filter based published post. > $table1 = $wpdb->prefix.'posts'; $sql = 'SELECT COUNT(ID) AS count FROM > '.$users_table1.' WHERE DATE(post_date) < "'.date('Y-m-d',time()).'"'; > $result = $wpdb->get_var($sql); iam stuck with this, do anyone know this?


Password Protected page not asking for a password

I have set a page to be password protected in the admin, but for some reason WP is not asking for the password when viewing the page. It definitely isn't a plugin as I have confirmed the behaviour with the plugin folder renamed. I have been testing it in Chrome w/incognito. The page is using a custom template, which may be the problem? No other templates I have looked at though seem to display any password logic.


global $current_user not current user

I believe I have a misunderstanding of what the global variable $current_user is exactly. I'm attempting to display the current user's email and name on a page using add_filter('the_content', 'my_function') and if two users click the button at the same time, you will see another user's information. I can reproduce this over and over. The code I'm using is below:               function my_function($content){         $current_user = wp_get_current_user();         $content .= "User Email: " . $current_user->user_email;         return $content;     }          add_filter('the_content', 'my_function');          // ALSO PRODUCES SAME RESULT:     function my_function2($content){         get_currentuserinfo();         global $current_user;         $content .= "User Email: " . $current_user->user_email;         return $content;     }      What am I doing wrong? I've tried this in init action and results the same. **UPDATE:** I also want to make sure that the method in which I'm creating a user is not causing the problem either. I use the standard WP login, but I redirect to my custom registration page which asks for basic info and then does the following to create a user. Is there anything wrong with this (or is it missing something that a normal WordPress user would have?):               $userdata = array(                         'user_pass'         => $password,                         'user_login'        => $email_1,                         'user_nicename'     => $nickname,                         'user_email'        => $email_1,                         'display_name'      => $nickname,                         'nickname'          => $nickname,                         'first_name'        => $first_name_1,                         'last_name'         => $last_name_1,                         'description'       => NULL,                         'rich_editing'      => 'true',                         'user_registered'   => date("Y-m-d H:i:s"),                         'role'              => 'ssm_user'                     );          $user_id = wp_insert_user($userdata);     $user = new WP_User( $user_id );


Placing assets for external use

I'm developing a plugin, that is meant to work on external requests to a wordpress site. The plugin will generate a `.json` file, and will come with 2 default `.css` style and 1 `.css` file that will contain the common styling rules (I will combine them later). My concerns stands at, where should I place the files and is it safe to create a `simlink` between plugin's assets folder and where the `.json` file is generated at. Plugin folder structure:               plugin/           assets/                 common.css                 blue.css                 clear.css           plugin.php           plugin-class.php      And were currently the `json` file is generated:               $dir = wp_upload_dir();     $dir = $dir['basedir'].'/plugin';          WP_Filesystem();     global $wp_filesystem;          if (wp_mkdir_p($dir))          $wp_filesystem->put_contents($dir.'/latestArticles.json', 'callback('.json_encode($toExport).')', 0644);      On a future release, I will allow the possibility for the files to be uploaded to a S3 Bucket, but meanwhile, I am currently placing them to the path mentioned above, mainly because all may requests to `mm.site.com/...` are going through CloudFront So, I am asking that if is safe to have (or recommended) a `simlink` from `site/wp-content/plugins/plugin/assets/` to `site/wp- content/uploads/plugin/assets` ? If not, where should I place my file, so they can be available from external requests?


Can I enable/disable/hide plugins on a per-site basis in multisite?

I'd like to be able to enable/disable plugins on a per-site basis in multisite, similar to the way that themes are per-site configurable. Is this currently possible? (For instance, I don't particularly want people seeing the Domain Mapping plugin but want them to be able to enable Gravity Forms.)


Croppping tool for wordpress avatar upload

Does anyone know of a method that lets the users upload and image and use a basic cropping/selection tool to create their author thumbnail? I have searched for wordpress oriented cropping tools/libraries and have not seen one..


SQL database export-import

I develop websites containing WordPress blogs as well as other PHP pages I design. When I make changes to sites locally on my test server I do a SQL database dump using myPHPAdmin. How can I avoid overwriting the content of the client's WordPress Calendar entrys and other Calendar settings? If I simply deselect the calendar tables on my localhost db dump will the client's db maintain those client entry to the tables on the remote server after the import? Thanks in advance


Problem with index.php after moving site

I moved my site to a new server and it all went smooth, but now when I access the home page I get this weird behavior:   * When the URL is typed, the PHP source code of the file index.php is shown, not the normal content.   * If I type the URL of any subpage, I can see the subpage perfectly, and   * If I type `www.myurl.com/?preview=true` I can see the home page perfectly (this one has me lost). The old version of the site was made with Wordpress too and it was working fine until I replaced it with this new installation. I have no idea what is going on, any help will be greatly appreciated.


How can I merge this rewrite rule into Wordpress so that it does not generate 404's or 500's?

I've been trying to accomplish a simple url rewrite (really I want to move a multisite to a different url) as I explained here I did get advice on the url rewrite here in a way I understand, but now the difficulty is incorporating this into my Wordpress .htaccess in a way that will not generate 404's or 500's from the web server. The suggested rule is `RewriteRule r.info\/blogs\/st\/?(.*)$ r.info/blogs/th/st/$1 [L]` And the relevant parts of the .htaccess are:               # BEGIN wtwp_security     <IfModule mod_rewrite.c>             RewriteEngine On             RewriteBase /blogs/th/st/             RewriteRule ^wp-admin/includes/ - [F,L]             RewriteRule !^wp-includes/ - [S=3]             RewriteRule ^wp-includes/[^/]+\.php$ - [F,L]             RewriteRule ^wp-includes/js/tinymce/langs/.+\.php - [F,L]             RewriteRule ^wp-includes/theme-compat/ - [F,L]     </IfModule>     <Files "wp-config.php">             Order allow,deny             Deny from all     </Files>     Options -Indexes     # END wtwp_security          # BEGIN WordPress     <IfModule mod_rewrite.c>     RewriteEngine On     RewriteBase /blogs/th/     RewriteRule ^index\.php$ - [L]          # add a trailing slash to /wp-admin     RewriteRule ^([_0-9a-zA-Z-]+/)?wp-admin$ $1wp-admin/ [R=301,L]          RewriteCond %{REQUEST_FILENAME} -f [OR]     RewriteCond %{REQUEST_FILENAME} -d     RewriteRule ^ - [L]     RewriteRule ^([_0-9a-zA-Z-]+/)?(wp-(content|admin|includes).*) $2 [L]     RewriteRule ^([_0-9a-zA-Z-]+/)?(.*\.php)$ $2 [L]     RewriteRule . index.php [L]     </IfModule>          # END WordPress      The caveat given was "`Make sure no rule before this rule which has the [L] option gets triggered`" but as we can see there are a series of rules with [L].


Adding a dropdown on my setting page

I have created a plugin and I have created setting for it where I have created a text field. But now I want to add a dropdown link. Can I show a thumbnail in the front of it in a dropdown, yes or no. the code which i have did for setting page till now is under               class Spyrowebz_setting     {        private $options;        public function __construct()          {            add_action( 'admin_menu', array( $this, 'add_spyro_page' ) );            add_action( 'admin_init', array( $this, 'spyro_page_init' ) );          }        public function add_spyro_page()         {             add_options_page(             'Settings Admin',              'Spyrowebz slider',              'manage_options',              'spyrowebz-slider',              array( $this, 'create_spyro_page' )           );          }        public function create_spyro_page()         {             $this->options = get_option( 'my_option_name' );            ?>
                <?php screen_icon(); ?>
Spyrowebz Slider
                           <form method="post" action="options.php">                  <?php                     // This prints out all hidden setting fields                        settings_fields( 'my_option_group' );                           do_settings_sections( 'spyrowebz-slider' );                        submit_button();                        ?>                </form>
           <?php           }           public function spyro_page_init()            {                      register_setting(              'my_option_group', // Option group              'my_option_name', // Option name              array( $this, 'spyro_sanitize' ) // Sanitize            );            add_settings_section(                'setting_section_id', // ID                'Slider Settings', // Title                 array( $this, 'spyro_section_info' ), // Callback                'spyrowebz-slider' // Page                );               add_settings_field(                'width', // ID                'Slide Width', // Title                  array( $this, 'spyro_slider_width_callback' ), // Callback                'spyrowebz-slider', // Page               'setting_section_id' // Section                         );                       add_settings_field(               'height',                'Slider Height',                 array( $this, 'spyro_slider_height_callback' ),                'spyrowebz-slider',                'setting_section_id'              );                  add_settings_field(               'thumbnail',                'Slider Height',                 array( $this, 'spyro_slider_thumbnail_callback' ),                 'spyrowebz-slider',                 'setting_section_id'             );                 }     public function spyro_sanitize( $input )     {         $new_input = array();         if( isset( $input['width'] ) )             $new_input['width'] = absint( $input['width'] );              if( isset( $input['height'] ) )             $new_input['height'] = sanitize_text_field( $input['height'] );          if( isset( $input['thumbnail'] ) )             $new_input['thumbnail'] = sanitize_option( $input['thumbnail'] );              return $new_input;     }     public function spyro_section_info()     {         print 'Note: If you set the slide height and width then your images should have that height and width';     }     public function spyro_slider_width_callback()     {         printf(             '<input type="text" id="width" name="my_option_name[width]" value="%s" />',             isset( $this->options['width'] ) ? esc_attr( $this->options['width']) : ''         );     }     public function spyro_slider_height_callback()     {         printf(             '<input type="text" id="height" name="my_option_name[height]" value="%s" />',             isset( $this->options['height'] ) ? esc_attr( $this->options['height']) : ''         );     }     public function spyro_slider_thumbnail_callback()     {         printf(             '<slect><option selecte>Yes</optin> <option>No</optin></slect>',             '<input type="radio" id="thumbnail" name="my_option_name[thumbnail]" value="No" />',             isset( $this->options['thumbnail'] ) ? esc_attr( $this->options['thumbnail']) : ''         );       }     }      if( is_admin() )     $my_settings_page = new Spyrowebz_setting();


Image paths on custom post types getting /post_type/ added to path

Whenever I use a JavaScript path to /images/imagename.jpg or within CSS ie. `background: url(../images/imagename.jpg)` works fine sitewide giving me an expected path to an image that looks like this: `http://localhost/projectname/wp- content/themes/bonestheme/library/images/imagename.jpg)` The problem is that that path on custom post type pages becomes: `http://localhost/projectname/post_type/page/wp- content/themes/bonestheme/library/images/imagename.jpg)` Can someone help me understand this and how to fix it? Thanks in advance.


What does the "Show Images" do for Wordpress music playlist?

In the new audio playlist in Wordpress 3.9, you can check the options:   * Show Tracklist    * Show Artist Name in Tracklist   * Show Images  The last option doesn't really make sense. There is no option to set an image for an audio track - unless I'm missing something?


Show excerpt for only first post in query

I'd like to only show the excerpt for the first post in my main query. I was wondering the best way to approach this. What I have tried so far is:   1. Making a custom homepage and using two queries, one that returns 1 post with an excerpt and another queries that returns posts without.   2. Just using the default queries but using css to hide the excerpts for all posts but the first, using `nth-child`. Both of these work well enough, but I was wondering if there was a better way to do this, through a function or filter. Thanks!


I would like all rel=author links to lead to Google+, but those on my homepage lead to the WP author page

Is there a way to achieve this (best case, without an additional plugin)? Currently I don't use any extra Google+ authorship plugins (most likely it works through JetPack).


register_post_type name character limit

I need to create a new custom post type, but the issue i am having is that the name i want to give is longer than 20 characters. Is it possible to override this with a hook or filter? I tried to modify this file in wp-includes `post.php` on line `1237`(`strlen > 20`), but this removed the publish button and replace it with Submit for review. Any idea how i fix this matter. tanks.


Wordpress on Ubuntu 12.10: permalinks problem

I am running a backup of my website on Ubuntu 12.10 (apache+mysql). I can see properly admin and home page, but permalinks are not working (so urls like this are failing: localhost/page/.../). What I did till now is: 1) Created file .htaccess via settings->permalinks with the content:               # BEGIN WordPress     <IfModule mod_rewrite.c>     RewriteEngine On     RewriteBase /     RewriteRule ^index\.php$ - [L]     RewriteCond %{REQUEST_FILENAME} !-f     RewriteCond %{REQUEST_FILENAME} !-d     RewriteRule . /index.php [L]     </IfModule>          # END WordPress      2) Added rewrite apache module with:               sudo a2enmod rewrite      3) Changed in the file sites-enabled/000-default the row:               AllowOverride None      to:               AllowOverride All      4) Finally restarted apache with:               sudo service apache2 restart      Anyway I am still getting "not found" when I visit a permalink. How can I make the permalinks work?