update image path with words starting uppercase to lowercase chars

I have to convert the image path to lowercase characters inside wp_posts table. Right now, I have inside my posts this:               <img class="alignleft" title="my image title" alt="my image alt" src="http://www.mydomain.com/wp-content/uploads/2012/09/My-Image-Lowercase-First-Char.jpg" width="75" height="75" />      And I need to update those uppercase chars in the image path to lowercase chars like this: **my-image-lowercase-first-char.jpg**. Is it possible to do it via mysql in phpmyadmin?


Buddypress + Memberpress

I am looking to build a wordpress site using both BuddyPress and MemberPress. I know that these plugins have some conflicting areas. Has anyone ever used these plugins together? If so do the two plugins synchronize well? If not what are the things that I have to modify to allow the two to work together?


Menu item not created on theme activation

On theme activation the following code doesn't create my menu with the 'New Page' item, the menu is created and the location is assigned to 'submenu' but no menu item of my newly created page? What am I missing?               <?php     if (isset($_GET['activated']) && is_admin()){         $new_page_title = 'New Page';         $new_page_slug = '/new-page/';         $new_page_content = 'This is the page content';         $new_page_template = 'page-job-list.php'; //ex. template-custom.php. Leave blank if you don't want a custom page template.         //don't change the code bellow, unless you know what you're doing         $page_check = get_page_by_title($new_page_title);         $new_page = array(                 'post_type' => 'page',                 'post_title' => $new_page_title,                 'post_content' => $new_page_content,             'post_status' => 'publish',             'post_author' => 1,     );     if(!isset($page_check->ID)){             $new_page_id = wp_insert_post($new_page);             if(!empty($new_page_template)){                     update_post_meta($new_page_id, '_wp_page_template', $new_page_template);             }     }          // Check if the menu exists     $menu_name = 'AnotherMenu';     $menu_exists = wp_get_nav_menu_object( $menu_name );          // If it doesn't exist, let's create it.     if( !$menu_exists){         $menu_id = wp_create_nav_menu($menu_name);              wp_update_nav_menu_item($menu_id, $new_page_id, array(             'menu-item-title' =>  __($new_page_title),             'menu-item-url' => home_url( $new_page_slug ),              'menu-item-status' => 'publish'));     }          $menulocation = 'submenu';          if(!has_nav_menu($menulocation) ){         $locations = get_theme_mod('nav_menu_locations');         $locations[$menulocation] = $menu_id;  //$foo is term_id of menu         set_theme_mod('nav_menu_locations', $locations);     }     }


Shortcode not working in custom post types

I have created a shortcode and placed it in my functions.php and registered it with:               add_shortcode('featured-attribution', 'gteh_author_shortcode');      It works fine on posts and pages. I created a custom post type, and when I use the shortcode in the content, it just displays the shortcode rather than the function. I am using `the_content()` to display the content so not sure why it is not working. In fact, the custom post type is just using `single.php` so not sure why it works on single posts, but not single custom post type pages... Does anyone have any suggestions?


query custom post type by date

I created a custom post type envent. I d like to filter out post in the futere. I did use the advanced custom fields plugin to make a date picker. I used following code, but somehow id does not filter out the future post.               <?php $events = new WP_Query(                 array(         'post_not_in'    => array($donotrepeat),         'post_type'       => 'chuchi_event',         'meta_key'        => 'event_datum',         'orderby'        => 'meta_value',         'order'           => 'dsc',         'meta_query'  => array(                            'key'     => 'event_datum',                     'value'   => date("Ymd"),                     'compare' => '<=',                             'type'    => 'DATE'                          )          )); ?>              <?php while($events->have_posts()) : $events->the_post(); ?>                           <?php $date = date_create(''.get_field('event_datum').''); ?>
<?php echo date_format($date,'l d.m.Y'); ?>
                                 <a href="<?php the_permalink(); ?>" title="<?php the_title_attribute();                                  ?>" >                     <?php endif; ?>


Incorrect url for sharing blog on linkedin

I have a self-hosted Wordpress blog with Jetpack installed. My Wordpress URL structure is > http://mydomain.com/archives/%postname%. Using the Jetpack's Publicize feature, I connected my blog to my LinkedIn profile. New posts now automatically appear on LinkedIn, however, the post's URL appearing on LinkedIn inherits the following structure: > http://mydomain.com/2013/06/24/%postname% which of course gives a 404 error. Any suggestions on how to correct this problem?


unregister a sidebar widget

The codex says it is depreciated. As a long time plugin user, I know how annoying it is when plugins don't clean up after themselves, is it's deprecation indication that it is necessary?


Create a page in a plugin , like woocommerce

I want create a plugin with custom posts. Which post will be shown in the single page from the plugin, just like woocommerce single products are shown. How can I do it. I saw it in many plugins as one template folder which override theme single page.


Sticky post for each category on category pages

I think the title is self explanitory. I would like to show category.php a post I set as sticky post for that category.   Do you know a good plugin or a code to do this?   Thanks,   Sarit


Carousel Hover Image

I a using an image carousel to display some pictures on my website. The carousel I am using is called: Jcarousellite (http://www.gmarwaha.com/jquery/jcarousellite/). I have the carousel setup, styled, and configured...but am having trouble getting through the last little bit of the code to work. The code I am using to get the images:               <?php query_posts( 'category_name=photos&posts_per_page=-1' ); ?>         <?php if ( have_posts() ) { ?>             <button class="prev"></button>             <button class="next"></button>

                     <?php while ( have_posts() ) : the_post(); ?>
<?php the_post_thumbnail("carousel-thumbnails"); ?>
                     <?php endwhile; ?>

         <?php } else { ?>
<?php _e("Sorry, no pictures have been posted :("); ?>
         <?php } ?>     <?php wp_reset_query(); ?>      The javascript function:                     I have another image that I would like to show when a user hovers over the thumbnail:               <?php the_post_thumbnail("carousel-full"); ?>      Initially, I tried to add a span to the end of the link, to make it work...then I could use CSS to position the image where I want...but because the jquery puts a `overflow:hidden` property on the photo container my image gets cut off. As I was looking around, a suggestion was to make the hover appear outside your `overflow:hidden` div, but how do I do that? Thanks,   Josh


Google maps live search and data storage in wp

I am developing a website - sellers database. Every seller posts locations - shops he has visited in the past so the chance of another seller visiting the same shop is being eliminated. I have built a custom meta box where the user inputs the address so every location is being displayed with a google map inside each post. The problem here is that some users type the address incorrectly as a result google maps cannot locate and display them. Is there any method that I can use live search when typing an address in the meta box like search in google maps works?


AJAX doesn't pass variables to the php function in the plugin

I'm creating a plugin that at a certain point has to use AJAX to pass information to php depending on the events fired by front end user on the different page. The event itself is when the user clicks on one of the links. my ajax code is :                 $.ajax({                cache: false,              async:false,              timeout: 8000,              type: 'POST',              data: {action: 'getpostfilter', year : year, month: month, category: category},              url: ajax_object_1.ajaxurl,              success: function(data) {alert( "Handler for .click() called." + category+year+month );},              error: function() {}              });      I have created action hooks and the function that ajax calls:               function get_post_filter_by_date_and_category(){               global $wpdb, $information;               $information['category']= $_POST['category'];          $information['year']= $_POST['year'];          $information['month']= $_POST['month'];             print_r($information);              return $information;              die();     }              add_action('wp_ajax_getpostfilter','get_post_filter_by_date_and_category');         add_action( 'wp_ajax_nopriv_getpostfilter','get_post_filter_by_date_and_category');      Where `global $information` was created in the beginning of the plugin source code is used to store the variables that are passed on to the php. I call the function that supposed to get the post information on the separate page as follows:               get_post_filter_by_date_and_category();          if(isset($information)){                  echo('<h1> ELSE</h1>');                  print_r($information);      I didn't forget to properly enqueue the scripts and I also use wp_localize_script to pass `admin-ajax.php` as URL to ajax call. I have absolutely no clue what is going wrong. **I have checked the following using different print and alert functions** :   1. The jQuery I am using is correct and creates all the variables and passes them to AJAX as intended.   2. AJAX gets all the info ( checked through `alert()` ) and doesn't throw any errors   3. PHP code runs without any 'blunt' errors . `print_r()` is used to check the contents of `$information` and every time it returns this :Array ( [category] => [year] => [month] => ) I am pretty sure this is not because I am not doing the extra security measures (nonce and etc.) Please help.


Custom post admin filtering by post meta (the date)

I've created a custom post type for events that uses a custom field to retrieve the date for the event. It works ok and I'm able to filter the displayed results using `meta_compare` to compare the date value to the current date. So far so good. I can also filter the admin end to display either future or past events (or both, by removing the `meta compare`) via a `pre get posts` filter. What I want to do is to create an admin page that will display the past events. I've created the page (and menu item) with the following code:               add_action('admin_menu', 'add_concerts_page');     function add_concerts_page() {         add_submenu_page('edit.php?post_type=concerts', 'Concerts Archive', 'Concerts Archive', 'manage_options', 'concerts-archive', 'my_archive_function' );     }          function my_archive_function() {}      But I don't know how to write the function!! I can write a regular loop and filter the results, as I would do on the front-end, but all I need to do is to show the same information as the normal admin page, but showing events that have since passed. This is how I filter the custom posts edit screen to show only future events:               function concerts_pre_get_posts($query) {       if (is_admin()) {         if (isset($query->query_vars['post_type'])) {           if ($query->query_vars['post_type'] == 'concerts') {               $query->set('meta_key', 'date_value');               $query->set('orderby', 'meta_value');               $query->set('order', 'ASC');         $query->set('meta_compare', '>=');               $query->set('meta_value', time());                }         }       }     }     add_filter('pre_get_posts' , 'concerts_pre_get_posts');      I don't really need to create a separate archive page for past events, just a link to toggle the query from past to future events on this page would be groovy, but I haven't a clue how to go about doing this! All help greatly appreciated!


WordPress echoing content in seemingly random place

I have been building a series of theme pages. On one page a users messages (post_type=messages) come in in a tab on the page. The content is displayed in place as is the title etc.... The content is shown again after the closing on the page. There is no that would let that happen in the theme. Furthermore the post_type=bookings that show up in another tab echo the content correctly. But within that loop is another loop that shows the post_type=items showing the configurations of each booking. It then echoes the last item as another booking. What the hell is going on. Any ideas? Marvellous \---- EDIT --- The error is due to loops within loops. So we need to use the get_posts function instead of query_posts. I have implemented it like this.               <?php $congigs = get_posts('post_type=items&author='.$current_user->ID.'&tag='.$bkpostid.'&numberposts=-1');                         foreach($congigs as $posts) :  setup_postdata($posts); ?>
<?php the_title(); ?>
     <?php endforeach; ?>      There should be 8 of these posts to get and it does get them, however `<? the title ?>` is showing 8 copies of the main title of the entire page, not the item post title. Any ideas. Thanks,


Get Permalink without domain (i.e. get relative permalink)

This is the code I am using:               <?php echo str_replace( home_url(), '', get_permalink($post->ID) ); ?>      What it does is output the permalink as a relative URL i.e. only the slug. For instance, if the permalink is `http://example.com/2012/01/post-title/`, the relative URL output by the code would look like `/2012/01/post-title/`. **Problem:** All Posts and Pages show the right permalink, which is great. But all other pages (including Home, Search and Archives) show the relative URL of the first post and not that of the respective pages. Any idea why? What am I doing wrong here? **Reference:** Get page permalink without wpurl * * * **EDIT:** Here's what else I've tried: **In functions.php**               function get_relative_permalink( $url ) {         $url = get_permalink();         return str_replace( home_url(), "", $url );     }      **In header.php**               <link rel="alternate" hreflang="en-IN" href="http://in.example.com/<?php echo get_relative_permalink(); ?>" />      Same problem with this as well. But this one shows a not-so-informative error too.


featured image problem with custom post type

I created a new custom post type based on the code provided by the wordpress codex. But when I try to set a featured image it returns and shows -1 in the featured image box instead of the images. I checked in the function that sets the featured image and it looks like it doesn't pass the check to see if I'm allowed to edit the post ( current_user_can('edit_post', $postID) ) However when I check somewhere in my plugin (I'm adding meta boxes in that particular page) with the same function it shows that I have the right to edit the page. Anyone an idea why it is causing a problem with the featured image?


WooCommerce Customize the archive-product page

How to modify the archive-product.php in Woocommerce to sho the results with a bigger thumb and in list view not in grid. There is a plugin for that but this is not working for me since I will use a shorcode after that which plug-in is not working with the shortcode.


Can't send mails using contact plugin

There are many contact form plugins available but none of them succeeds in sending mail even contact 7 form. Only the default contact form of Jetpack wordpress succeeds in sending the mail. But the problem is it only sends the mail when I use the email id which I used while signing for the wordpress, a gmail id. if i replace that gmail id with my website support email id in my user profile, even the jetpack coontact form fails. I want to use my website email id as it has auto-responder facility.


How do I remove 'www.' from all internal links in self-hosted multisite?

This is my first WP administration (I have inherited this from another developer), so I would appreciate it if you could treat me as a newbie. I have a site with 40 or so pages and all the links on any page, image etc. are pointing at //www.mydomain.com, but I want them to point at //mydomain.com. The home page redirects clients correctly already (I believe this is a normal WP behaviour, as they think it is best practice and I am happy with that), but since the WP editor automatically creates links with the www subdomain, it's flicking back and forth between both as the user goes into the site. I don't want to do a re-direct with the .htaccess file as that creates overhead (and this is a work-around, not the desired behaviour), but there are far too many to change manually, and I suspect that any new ones would also be created with the www prefix anyway.. So how do I change this behaviour as well as changing the existing links?


Media handle sideload not working

I am using this media uploader wp snippet which downloads an image from my one site to other. It was working fine until yesterday but I checked this morning, it wasn't working.                           require_once(ABSPATH . 'wp-admin/includes/file.php');                 require_once(ABSPATH . 'wp-admin/includes/media.php');                 require_once(ABSPATH . 'wp-admin/includes/image.php');                      $media_img_url = 'http://abc123.com/wp-content/2013/08/qwerty.jpg';                 $tmp = download_url( $media_img_url );                 $post_id = 32454;                 $desc = 'The image is here';                 echo $tmp;  //Output: /tmp/qwerty.tmp          // Set variables for storage     // fix file filename for query strings     preg_match('/[^\?]+\. (jpg|JPG|jpe|JPE|jpeg|JPEG|gif|GIF|png|PNG)/', $media_img_url, $matches);                   $file_array['name'] = basename($matches[0]);     $file_array['tmp_name'] = $tmp;          print_r($matches); //Output: Array()     echo $file_array['name'].                  //Output: Nothing          '<br>'.$file_array['tmp_name'];       //Output: /tmp/qwerty.tmp                           // If error storing temporarily, unlink                 if ( is_wp_error( $tmp ) ) {                     @unlink($file_array['tmp_name']);                     $file_array['tmp_name'] = '';                 }                      echo $file_array['name'];        //Output: Nothing                      // do the validation and storage stuff                 $id = media_handle_sideload( $file_array, $post_id, $desc );                     print_r($id); //Output: WP_Error Object ( [errors] => Array ( [upload_error] => Array ( [0] => File is empty. Please upload something more substantial. This error could also be caused by uploads being disabled in your php.ini. ) ) [error_data] => Array ( ) )                       // If error storing permanently, unlink                 if ( is_wp_error($id) ) {                     @unlink($file_array['tmp_name']);                     return $id;                 }                    print_r($id);                  //Output: Nothing                  $src = wp_get_attachment_url( $id );                    print_r($src);                  //Output: Nothing      For debugging purposes, I echoed values at some points to know where it is not working. I have checked php.ini file many times,nothing is changed. Here are errors:               [Sun Sep 01 07:06:46 2013] [error] [client 213.236.00.15] (70014)End of file found: Error reading request entity data     [Sun Sep 01 07:11:09 2013] [error] [client 213.236.00.15] ModSecurity: Error reading request body: End of file found [hostname "abc123.com"] [uri "/wp-admin/admin-ajax.php"] [unique_id "UiNK-dBhnx0AAA3rD4cAAAAC"]      Frontend uploading Visual: ![image](http://i.stack.imgur.com/Q1mlF.jpg) Error when uploading images from frontend:               [Sun Sep 01 22:54:18 2013] [error] [client 213.236.00.15] ModSecurity: Input filter: Failed writing 8192 bytes to temporary file (rc 18446744073709551615). [hostname "abc123.com"] [uri "/wp-admin/async-upload.php"] [unique_id "UiQoCdBhnx0AACtXBFwAAAAA"]     [Sun Sep 01 22:54:55 2013] [error] [client 213.236.00.15] ModSecurity: Multipart parsing error: Multipart: writing to "/tmp/20130901-225455-UiQoL9Bhnx0AACtYB4gAAAAD-file-pwzC5a" failed [hostname "abc123.com"] [uri "/wp-admin/async-upload.php"] [unique_id "UiQoL9Bhnx0AACtYB4gAAAAD"]      These two lines are present redundantly with different timings in error log. Please anyone suggest how to resolve this? Thanks.


http error when uploading media files

I am having this same annoying issue many other have: When I am trying to upload images into Wordpress via the media uploader, it gives me an **http error**. Now I have tried the following, but nothing works:   * Multi-File uploader and the Simple browsers uploader   * Everything as stated in this post, including the 'memory fix', but still not. What is even more strange, and pointing to a server problem perhaps, is the following:   * I have a shared Linux hosting server account   * Inside the public_html folder, I have 4 different wordpress websites, where each website uses its own wordpress installation, **and they all have the same problem**   * I use different versions of wordpress - 3.5 and 3.6 between the different installations   * Even starnger, is that up until today, everything worked great, until I added another folder for a new wordpress installation.   * Each installation uses its own DB   * I do not use multi-site Can anyone please tell me why I keep getting this error? Thanks!


Loop in taxonomy for terms and post

I'm having trouble getting this to work. I've created a custom taxonomy named article_subjects and am looping thru, displaying each term; but am trying to get the newest post for each term
         <?php             $args = array (                 'orderby'    => 'name',                 'order'      => 'ASC',                 'hide_empty' => true,                 'number' =>      '4'             );                  $terms = get_terms( 'article_subjects', $args );             foreach ( $terms as $term ) { ?>
                      <?php                      $postargs = array (                         'tax_query' => array (                             array (                                 'taxonomy' => 'article_subjects',                                 'field'    => 'name',                                 'terms'    => $term->slug,                                 'number'    => '1'                             )                         )                     );                     global $wp_query;                     $posts = new WP_Query($args);                          foreach ( $posts as $post ) { ?>
<?php echo $post->the_date ?>

<?php echo $post->the_title ?>

<?php echo $post->the_excerpt ?>
                     <?php } ?>
             <?php }         ?>


Can't enqueue scripts in the footer?

The WordPress codex says: > $in_footer > > (boolean) (optional) Normally scripts are placed in the section. If this > parameter is true the script is placed at the bottom of the . This requires > the theme to have the wp_footer() hook in the appropriate place. Note that > you have to enqueue your script before wp_head is run, even if it will be > placed in the footer. (New in WordPress 2.8) Default: false So I added `true` after each script's `src path`:               /**          * JavaScript          */              function my_scripts_method() {             wp_deregister_script( 'jquery' );             wp_register_script( 'jquery', 'http://ajax.googleapis.com/ajax/libs/jquery/1.6/jquery.min.js', true );             wp_enqueue_script( 'jquery' );         }              add_action('wp_enqueue_scripts', 'my_scripts_method');              function media_queries_script() {             wp_register_script( 'mediaqueries', get_template_directory_uri() . '/js/css3-mediaqueries.js', true );             wp_enqueue_script( 'mediaqueries' );         }              add_action('wp_enqueue_scripts', 'media_queries_script');              function custom_script() {             wp_register_script( 'custom', get_template_directory_uri() . '/js/custom.js', true );             wp_enqueue_script( 'custom' );         }              add_action('wp_enqueue_scripts', 'custom_script');              function replace_script() {             wp_register_script( 'replace', get_template_directory_uri() . '/js/jquery.ba-replacetext.min.js', true );             wp_enqueue_script( 'replace' );         }              add_action('wp_enqueue_scripts', 'replace_script');      But the scripts are still being included in the header. Any suggestions to fix that?


Clean URLs for custom $_GET variables

I have a query var `show=othertemplate` that I can add to any URL to show any post, page or archive in Wordpress in a different template, like this: **mysite.com/[any URL]/?show=othertemplate**. I'd like for it to be accessible via clean URL, like **[any URL]/othertemplate** or **[any URL]/show/othertemplate**. I have tried achieving this by registering the query var with a query_vars filter and adding code like below to .htaccess, but Wordpress intervene and throws a 404. WP Debug Bar says that the query is looking for attachment=print.               RewriteEngine On     RewriteBase /     RewriteCond %{REQUEST_URI} !^/index\.php     RewriteRule ^(.*)/othertemplate/?$ /index.php/$1?view=othertemplate [L]      I have also tried using the Wordpress rewrite functions, but the same thing happens.               function st_myqueryvars($vars) {         $vars[] = 'show';         return $vars;     }          add_filter('query_vars', 'st_myqueryvars');          function st_myrewriterules( $wp_rewrite ) {       $newrules = array();       $new_rules['^(.*)/othertemplate/?$'] = 'index.php/$matches[1]?show=othertemplate';       $wp_rewrite->rules = $new_rules + $wp_rewrite->rules;     }     add_filter('generate_rewrite_rules','st_myrewriterules');      Is there something I'm missing here? > **Update:** After flushing permalinks I see that this WP function rewrites > **/ _[any URL]_ /template** to **index.php?show=template** instead of > **index.php? _[the URL's corresponding query string]_ &show=template**. I > can't 'hard code' a query string like > post_type=$matches[1]&name=$matches[2]... into the rewrite rule because it > needs to work for any page/post/archive, which have different permalink > structures. How do I get around this?


I was in the midst deleting trash file and the internet connection is becoming really slow. When I clicked the Products tab in the wp-admin it says that: "Error establishing a database connection", although I did not change anything on the database. Also, there are times that the message: "Access to the webpage was denied" is appearing. I've restarted several times, and tried copying and pasting the link in different browsers, but its still appearing and I wonder why. Hope you guys can get me out of this stuff. I think I'm gonna broke down into pieces now. :(


Does it matter if two people are using the same Wordpress admin account?

Just wanna ask around if its possible for a person to disconnect from wp-admin when someone is already using the same account? Like for example two people are sharing only one wp-admin account. One will disconnect and the other one will not be disconnected. Is this possible?


Why is get_the_excerpt returning full content

I have my home page set to a static page with a custom page template. Here I want to show posts, but just the excerpts with a "Read more" link. I want to use the more tag, which is a part of wordpress so I hate the fact that this doesn't work! If I simplify the code that would be it:               while ( $q->have_posts() ) : $q->the_post();         $the_exc = get_the_excerpt();         echo $the_exc;     endwhile;      So how do I convince wordpress that on my home page I just want to show the excerpts (until the more tag). And this is like 75th time I'm dealing with this the_excerpt, the_content, issue. How do you guys do this?


Show posts with specific tag in a category page

I have a website which belongs to a magazine. I want do something like this: I want to create a link that refers to /category-slug/tag-slug. in that link, I want to show all posts with "specific tag" which are in "specific category". How can I do that?


Search box on single Post page should only search for posts

<form role="search" method="get" class="search-form-for-post form-inline" action="<?php echo home_url('/'); ?>">
             <input type="search" value="<?php if (is_search()) { echo get_search_query(); } ?>" name="s" class="search-field form-control" placeholder="Enter Keyword">             <?php _e('Search for:', 'roots'); ?>                              <button type="submit" class="search-submit btn btn-default"><?php _e('SEARCH', 'roots'); ?></button>
     </form>      I have written above code in content-single.php It is searching pages also.I want to search only post when I am Searching from post


Custom field being erased after autosave

Why wont the custom fields from this post type save? I have a custom post-type called Photos and a couple of meta boxes. Here is basically what I have in my functions.php               add_action('init', 'photo_register');          function photo_register() {              $labels = array(             'name' => _x('My Photos', 'post type general name'),             'singular_name' => _x('Photo', 'post type singular name'),             'add_new' => _x('Add New', 'photo item'),             'add_new_item' => __('Add New Photo'),             'edit_item' => __('Edit Photo'),             'new_item' => __('New Photo'),             'view_item' => __('View Photo'),             'search_items' => __('Search Photos'),             'not_found' =>  __('Nothing found'),             'not_found_in_trash' => __('Nothing found in Trash'),             'parent_item_colon' => ''         );              $args = array(             'labels' => $labels,             'public' => true,             'publicly_queryable' => true,             'show_ui' => true,             'query_var' => true,             //'menu_icon' => get_stylesheet_directory_uri() . '/article16.png',             'rewrite' => true,             'capability_type' => 'post',             'hierarchical' => false,             'menu_position' => 4,             'taxonomies' => array('post_tag','category'),             'supports' => array('title','comments','trackbacks','revisions','custom-fields','page-attributes','thumbnail', 'excerpt', 'tags')           );               register_post_type( 'photo' , $args );         register_taxonomy("Photos", array("photo"), array("hierarchical" => true, "label" => "Photos", "singular_label" => "Photo", "rewrite" => true));               }          add_action("admin_init", "admin_init");     add_action('save_post', 'save_details');          function admin_init(){ // add_meta_box( $id, $title, $callback, $page, $context, $priority );        add_meta_box("media", "Media Type", "media", "photo", "side", "high");       add_meta_box("map_meta", "Mapping Info", "map_meta", "photo", "normal", "high");       add_meta_box("photo_meta", "Add a photograph", "photo_meta", "photo", "normal", "high");     }          function media(){       global $post;       $custom = get_post_custom($post->ID);       $film = $custom["film"][0];       $camera = $custom["camera"][0];            ?>       Camera:       <input name="camera" value="<?php echo $camera; ?>" />              Film:       <input name="film" value="<?php echo $film; ?>" />            <?php     }          function photo_meta(){       global $post;       $custom = get_post_custom($post->ID);       $single_photo = $custom["single_photo"][0];       ?>

             <input id="single_photo" name="single_photo" value="<?php echo $single_photo; ?>" />

         <input type="button" value="Upload" name="upload" id="upload_image_button" />

            <?php     }               function map_meta() {       global $post;       $custom = get_post_custom($post->ID);       $latitude = $custom["latitude"][0];       $longitude = $custom["longitude"][0];            ?>

Latitude:
       <input id="latitude"  name="latitude" value="<?php echo $latitude; ?>"></input>

Longitude:
       <input id="longitude" name="longitude" value="<?php echo $longitude; ?>" ></input>

             <?php }            function save_details(){       global $post;       update_post_meta($post->ID, "single_photo", $_POST["single_photo"]);       update_post_meta($post->ID, "latitude", $_POST["latitude"]);       update_post_meta($post->ID, "longitude", $_POST["longitude"]);       update_post_meta($post->ID, "camera", $_POST["camera"]);       update_post_meta($post->ID, "film", $_POST["film"]);          }      I had it working for a while but now it will not save the fields and a refresh wipes everything. Can anyone see what the problem is? Any suggestions on how to find the bug? Basically anything you can think to improve this would be much appreciated, especially if I can get it to work! ## EDIT I figured out that they do save but if I remain on a post long enough for an autosave to run, then try to navigate away I get the message : > The page is asking you to confirm that you want to leave - data you have > entered may not be saved. I click leave then when I return to the post everything is erased. What is going on here?


Overriding The Loop with filter or hook

I'm trying to replace the `$wp_query` object for a specific category, without having to deal with creating a new template and creating a new `WP_Query` object there. My aim is to change the data available to The Loop from the default for that request to a custom query.               add_filter( 'pre_get_posts', 'custom_wpquery' );          function custom_wpquery( $query ){     global $wp_query;        if (is_category(121)) {                  if ($wp_query === $query) {                        $query = new WP_Query('page_id=146');                        $query->set('page_id', 146);                  }        }       return $query;     };      That doesn't seem to affect The Loop at all, what am I doing wrong?


Exclude post from home page and archives, but still public

Can a post be hidden from home page, archive view, category lists etc. and viewable only if you have a direct link to it? The blog doesn't have registered readers and is open to public so that would be a mean of hiding some posts from public view without using the password protection.


Admin filter/error if post title is too long

Is there a filter that will throw an error if the posts creator enters a post title that is too long? I am looking to throw an error like: "The title you've entered is more than 30 characters. Please change the title and try again." Preferably this might be a banner alert like standard errors or at least something noticeable. In addition the post will not be saved until the title is of the correct length. I know there is the wp_insert_post_data filter where you can modify the title before it is saved, but I don't want to do something like truncating as it might not make sense to the end user. This is something I would like the post writer to change.


make a excerpt on data from a meta box?

I have made a custom post type called `news` that has meta boxes. I would like to print the data from the metabox as a excerpt. How can I do that? This is the code that I use that prints the data :               <?php $loop = new WP_Query( array( 'post_type' => 'news', 'posts_per_page' => 10, 'post_parent' => 0 ) ); ?>     <?php while ( $loop->have_posts() ) : $loop->the_post(); ?>     <?php the_excerpt(); ?>
<?php echo get_post_meta( $post->ID, 'twpb_news_textdate', true ); ?>

<?php echo get_post_meta( $post->ID, 'twpb_news_rub', true ); ?>

<?php echo get_post_meta( $post->ID, 'twpb_news_textnews', true ); ?>
          <?php endwhile; ?>


post thumbnail: increase dimension if smaller than... Possible?

I need thumbnails of minimum width: 400px. I would like that if the user uploads an image that is, say, 380px wide, Wordpress creates a 400px-wide version. Is that possible?


upgrade from WPMU 2.9.2 to WP 3.2.1

I am running WPMU 2.9.2 and want to update to WP 3.2.1. As I understand it, WP 3 took in WPMU. I imagine that involved some big changes to the implementation of WPMU. What steps do I need to take to perform the upgrade? Thank you. Pat


multisite registration: check existing subdomains while typing

I wish to ask how to build a real time control while a user attempt to register his website in a wordpress multisite installation. The control should check if the subdomain already exists while the user is typing it into the input field. This control will involve a simple jquery function, executed while typing, that check all the existing subdomain in the wordpress database table. Any suggestion would be appreciated. Thank you very much.


How can I include author (their archive page) in search results?

How can I include author archive pages in the default search results? For example if I have an author name Billy Joe and I type his name into the search box a link to his author archive would display.


Reset Loop get_posts();

I add too single.php menu:
     <?php     $all_posts = get_posts(array(          ));          // this variable will contain all the posts in a associative array     // with three levels, for every year, month and posts.          $ordered_posts = array();          foreach ($all_posts as $single) {     $year  = mysql2date('Y', $single->post_date);     $month = mysql2date('F', $single->post_date);     // specifies the position of the current post     $ordered_posts[$year][$month][] = $single;     }          // iterates the years     foreach ($ordered_posts as $year => $months) { ?>
         <?php echo $year ?>
         <?php foreach ($months as $month => $posts ) { // iterates the moths ?>         <?php foreach ($posts as $single ) { // iterates the posts ?>
                 <a href="<?php echo get_permalink($single->ID);// echo   '#post-'.$single->ID;?>"><?php echo get_the_title($single->ID); ?>

         <?php } // ends foreach $posts ?>              <?php } // ends foreach for $months ?>

 <?php     } // ends foreach for $ordered_posts     ?>
      After this code a got loop to print single post:
                   <?php /* The loop */ ?>         <?php rewind_posts(); ?>         <?php while ( have_posts() ) : the_post(); ?>                  <?php get_template_part( 'content', get_post_format() ); ?>             <?php twentythirteen_post_nav(); ?>             <?php comments_template(); ?>              <?php endwhile; ?>
      but on every single page, I have the latest post. Pleas help me.


Copy url from post_content to custom field

I'm new to MySQL so I don't know if this is even possible. I would like to copy a url that's in post_content to a custom field. The url is variable and it looks like this:               [audio:http://www.website.com/folder/file.mp3]      Is it possible to copy just the url (http://www.website.com/folder/file.mp3) to a custom field? I've tried different things but as I don't always understand how to query MySQL I've had no luck. Thanks!


Add class to WordPress admin bar?

How can I to add a wrapper class to the WordPress admin bar? I would like to center the contents to the same width as my theme.


Using wp_mail with attachments but no attachments received

Ok I give up. Been looking at multiple examples including this one. I get the email no problem but there are no attachments. Am I missing the content/type of file type? All the examples I've seen uses only text/html as the content type. Here's what I have (added upon Stephen's request)               if( isset( $_POST['to'] ) && isset( $_POST['from'] ) ) {     global $wpdb;          $to = $_POST['to'];     $from = $_POST['from'];      $name = get_bloginfo('name');     $attachment = $_POST['file'];     $headers  = 'MIME-Version: 1.0' . "\r\n";     $headers .= 'Content-type: multipart/mixed; charset=iso-8859-1' . "\r\n";          $headers .= 'From: ' . $name . ' <' . $from . '>' . "\r\n";        $subject = 'Send to Kindle';     $msg = 'Yay! Your book has arrived';          $mail_attachment = array( $attachment );     wp_mail($to, $subject, $msg, $headers, $mail_attachment);     echo 'Email sent';     } else {     echo 'Email not sent';     }


Simple Multilanguage Switcher

Firstly i have been install wp with different languange with indonesian languange as default, i have plan, want to translate with other languange, How to simple translate switch, but keep Indonesian as default. with .po file thanks for the help ...


How does the ternary operator work in the wordpress loop post?

Okay so I kind of understand that ternary operators work like                 condition ? TRUE : FALSE      However I'm looking a simple loop to get my posts that I have               <?php if (have_posts()) :     while(have_posts()): the_post();         the_content();         endwhile;     endif;      ?>      The question I have is where is the ? in this syntax. Why is the `:` used when according to the                  condition ? TRUE : FALSE      Whatever comes after the semicolon is when that statement `(like have_posts())` is FALSE?


Removing the base "Author" or changing it to something else. is it possible?

Is it possible to remove the AUTHOR base? Is it possible change it to postedBy so that the urls is site.com/postedBy/joe And finally, is it possible to remove a custom taxonomy base from the url so that a url like site.com/people/joe can become site.com/joe


Restricting access to content

I'm developing a functionality to let only customers and doctors have access to exam results. But i'm not so sure about the strenght of my code in securing view only to those authorised. I've gotten so far as to create the 'exam' post type to handle the information and added the metabox to save doctor and patient info in every exam (doctor and patient are also custom roles for users, with capabilities similar to subscribers). then i've created this function to check if the user trying to view content is entitled to it:               /*      * Checks if user is logged in and has access to that specific exam      */     function rm_userauth_check() {         global $current_user;           get_currentuserinfo();           $doctor = get_post_custom_values('doctor');           $patient = get_post_custom_values('patient');           $loggeduser = $current_user->user_login;           $nicename = $current_user->display_name;           $mainrole = $current_user->roles;            if ($current_user->data !== null) {                if ($mainrole[0] == 'doctor' && $loggeduser == $doctor[0]) {               return true; // this user is a doctor and is assigned to this exam           } elseif ($mainrole[0] == 'patient' && $loggeduser == $patient[0]) {               return true; // this user is a patient and is assigned to this exam           } else {               return false; // this user is not assigned to this exam           }       } else {           return false; // user is not logged in       }      and now i'm calling it on my single-exam.php file as                       <?php if (function_exists('rm_userauth_check')) : ?>                  <?php if (rm_userauth_check()) : ?>                  <?php if ( have_posts() ) while ( have_posts() ) : the_post(); ?>                      <?php get_template_part( 'content', 'single' ); ?>                  <?php endwhile; // end of the loop. ?>                <?php else : ?>                            <?php wp_redirect( home_url() ); exit; ?>                <?php endif; ?>         <?php endif; ?>      How does it look to you? Am i going the right way here or should i try another method?


Get excerpt using get_the_excerpt outside a loop

I have a code that call `get_the_title()` and it works, but `get_the_excerpt()` return empty. How can i make it work? This code is inside a plugin called "WP Facebook Open Graph protocol". Here's the part i want to change:               if (is_singular('post')) {       if (has_excerpt($post->ID)) {         echo "\t<meta property='og:description' content='".esc_attr(strip_tags(get_the_excerpt($post->ID)))."' />\n";       }else{         echo "\t<meta property='og:description' content='". [?] ."' />\n";       }     }else{       echo "\t<meta property='og:description' content='".get_bloginfo('description')."' />\n";     }      Here, `has_excerpt` always fail, and `get_the_excerpt($post->ID)` don't work anymore (deprecated). So, how can i display the excerpt there? ps: I'm using "Advanced Excerpt" plugin as well


Comments screen in backend, how to disable visual editor when replying to a comment

I'm almost done to create my project with WP and all the steps taken have brought me almost to the finish line. The following recent answers I had were able to help me customizing the comments area: Comments screen in backend, how to disable Quick Edit | Edit | History | Spam | for non admins Comments screen in backend, how to disable email address of commenter for non admins Now I need to disable the visual editor when a contributor/author replies to any comment received as I'd like not to let them easily add links to their reply. I've opened up the source and the visual editor is called here but I don't know exactly where:

     <link rel='stylesheet' id='editor-buttons-css'  href='http://www.dogsheaven.net/wp-includes/css/editor.min.css' type='text/css' media='all' />
     <textarea class="wp-editor-area" rows="20" cols="40" name="replycontent" id="replycontent">     </textarea>
      I've no idea about which filter should I add, any help? Thanks!


Can multiple custom post types share a custom taxonomy?

I'm considering rebuilding a drupal site in wordpress and am still wrapping my head around the differences between the systems - particularly cck/fields and custom content types and the different ways to use taxonomy. I would like to know if two custom content types can share one custom taxonomy. In drupal I can limit the posting of a particular content type to a group of users and then that posting can have taxonomy that is only shared with one or more other content types (but not all types). Leaving the user aspect out which appears possible with role scoper, can you do this with wordpress? I've only seen custom content type with custom taxonomy but no way to share a given taxonomy between 2 or more custom content types without recreating it in two places or enabling it globally through categories/tags... Thanks, -Chad.


get_template_part vs action hooks in themes

It seems to me both of these afford the opportunity for the end user to modify a theme without actually editing the themes files (via child themes). My question is, is one method preferred over the other. For example take a theme I am workig on now. I am trying to decide whether to go with template parts of hooks.               <?php get_template_part('before_sitecontainer' ); ?>     <div id="sitecontainer" class="sitecontainer" <?php //closed in footer ?>>          <?php get_template_part( 'before_topcontainer' ); ?>
              <?php get_template_part( 'before_topedge_navigation' ); ?>         <?php get_template_part( 'topedge_navigation' ); ?>              <?php get_template_part( 'before_site_header' ); ?>         <?php get_template_part( 'site_header' ); ?>              <?php get_template_part( 'before_second_navigation' ); ?>         <?php get_template_part( 'second_navigation' ); ?>              <?php get_template_part( 'after_second_navigation' ); ?>
     <?php get_template_part( 'after_topcontainer' ); ?>      The above allows the user of the theme to replace any section of existing code by simply creating an appropiately named file in their child theme folder as well as adding new code before/after each pre existing section by the same method - the before/after template part files don't exist in the parent theme at all and are there simply to allow them to insert code - and this method does not require they understand hooks/filters to accomplish this. I could of course achieve the same using hooks and filters. Is there an advantage to using hooks/filters instead? Bearing in mind the target audience that will be using this is decidely _not_ code savvy. I can give them relatively basic instruction they can follow to use the template method but will almost surely confuse the devil out of them with hooks. Or are there situations where one would be better than the other within the same theme?


Add Default Wordpress Formatting To Data From External SQL Tables?

I have a number of external SQL tables that have data in exactly the way I want and I would like to use them to populate various wordpress posts with shortcodes. The problem is that I don't understand how wordpress 'filters' text in get_content() so that the proper   and are added. IOW: I have a proper WP Post and I display the contents on a page it auto- magically includes   and tags. If I copy that text to my external table and then pull that field into the same WP post using               $result = $wpdb->get_col( "SELECT my_text FROM my_songs WHERE id = '" . $song_id . "'" );         ...the results has none of the `<br>` or `<p>`s unless I explicitly add them to the text. How can I take $result above and 'format' it so that it matches the same text from a WP Post using `get_content()` ?


I'm developing a theme which uses the NHP Theme Options Framework to add some theme options. Naturally, the theme options framework creates a single row in the database to store the theme's options into. If I create a child theme of the parent, it shares the same theme options as the parent, which leads me to my question: Should a child theme share the same theme options row as the parent, or should it have it's own options row? Is there a reason why one would be better than the other? If they are shared and you switched between the two themes, your options would be intact. This can be great if that was the intended behavior. On the other hand, you might go to great lengths to customize the child theme thinking it's independent, switch back to the parent and find your changes overridden. I'm having a hard time choosing one over the other. What are your thoughts?


Displaying images from external RSS feeds?

Is there any way to show an image for RSS feeds in my WordPress page? Currently the default WordPress RSS feeds will only show the text of feeds from other sites. How can I make my site show a thumbnail image of RSS feeds of the other sites?


Any amazing Wordpress MultiSite sites?

I'm just curious, because I love wordpress.


Wordpress shopping cart that supports 2 tier product variation options

I need a wordpress shopping cart that will produce 2 tier product variations. For example if you pick 'option 1' for a product, sub-options 'x' 'y' 'z' will be revealed and if you pick 'option 2', sub-options 'a' 'b' 'c' will be revealed. Im OK with a commercial cart, but I haven't found any that specifically list this functionality in their documentation and since they are commercial, I can't access their respective support forums to find out more with out first purchasing the cart. Is there a cart that supports this kind of functionality?


How do I access the menus produced by Dashboard > Appearance > Menus

A continuation to this question: Replacing WordPress menu functionality with a plugin Since I really rarely work with WordPress (I've done a lot of work with phpBB, myBB, Concrete5, and custom PHP scripts - but my WordPress experience is limited to one or two simple sites) I feel that I might get an answer quicker here than spending 3 hours reading through the documentation. I'm creating a plugin to replace the WordPress menu with my own. So far here is the code for this plugin (it's all in a single PHP file):               add_action('init', 'DEMenu::init');     class DEMenu {              public static function init() {             $DEMenu = new DEMenu();             load_plugin_textdomain ('de-menu', false, dirname( plugin_basename( __FILE__ ) ) . '/languages/');             /* Load CSS with wp_enqueue_style() */                  // If in admin page, then load admin page stuff             if (is_admin()) {                 add_action('admin_menu', 'DEMenu::admin');             }                // If not on admin page ...             else {                 // Load plugin core - doesn't require a hook                 $DEMenu->core();             }              }              public static function admin() {             add_options_page('DE Menu Options', 'DE Menu', 'manage_options', 'de-menu', 'DEMenu::options');     //      add_option('de_menu_maintenance', 'off');         }              public static function options() {             if (!current_user_can('manage_options'))  {                 wp_die( __('You do not have sufficient permissions to access this page.') );             }             echo '
';             echo '
Here is where the form would go if I actually had options.
';             echo '
';         }              public static function core() {                  /* Add support for various themes */             add_filter('wp_nav_menu', 'DEMenu::display');                  /* If I need to add more actions/filters they will go here... I may enqueue CSS here, too */              }              public static function display() {             print "Let's see if this displays. I'll add some text to ctrl+F for later";         }          }      This is mostly the culmination of various bits of advice from the WordPress documentation, plugin development tutorials, and basic OOP practices. Now I'm tasked with drawing the menu from the Dashboard > Appearance > Menus area. How can I access this menu object (as an array or other accessible data type) so that I can work with it? And I do realize it seems silly to completely override the `wp_nav_menu()` output if I'm just going to be using the same menu, however I can think of no other way to accomplish what I want. EDIT - I have been reading through `wp-includes/nav-menu-template.php` to learn how `wp_nav_menu()` gets the list of menu items, as well as how it displays it. I have been trying to essentially emulate the method used by this function only with slight variations to add in the multi-column structure. Here is what I have so far:               public static function core() {              /* Add support for varoius themes */         add_filter('wp_nav_menu', 'DEMenu::display', 1);              /* If I need to add more actions/filters they will go here... I may enqueue CSS here, too */          }              public static function display( $args ) {             /* The following is blatantly ripped from nav-menu-template.php */                      // *****************************************************************                 /* Excluded for ease of reading - this is an exact copy of nav-menu-template.php */                 // *****************************************************************                  // Here we can invoke our custom walker without editing the theme             $args->walker = 'DEMenu_Walker';                      $items .= walk_nav_menu_tree( $sorted_menu_items, $args->depth, $args );                 unset($sorted_menu_items);                      // *****************************************************************                 /* Excluded for ease of reading - this is an exact copy of nav-menu-template.php */                 // *****************************************************************          //          $nav_menu = apply_filters( 'wp_nav_menu', $nav_menu, $args );     //       //          if ( $args->echo )     //                  echo $nav_menu;     //          else     //                  return $nav_menu;                  // Rather than checking if we should echo the output, just return it.             // This is a filter, so the output will be echo'd by the calling function             return $nav_menu;         }      Then later (outside of the DEMenu class):               class DEMenu_Walker Extends Walker_Nav_Menu {              function __construct() {             die("We made it to the constructor!");         }          }      However I am getting the following error:               Warning: Attempt to assign property of non-object in /home/coupon/public_html/wp-content/plugins/DE-menu/index.php on line 146      This line number is referring to:               $args->walker = 'DEMenu_Walker';      Perhaps there is a far more reasonable solution that I have over-looked, however from what I can tell I need a custom walker class (along with private variables for keeping track of how many items have been displayed and how many items should be displayed per column) and this is the only way to use a custom walker class without editing the theme. However if I'm to use the solution that I'm currently working on then I need to understand why the `$args` variables is a non-object when `wp_nav_menu()` clearly has the following line of code near the very beginning of the function:               $args = (object) $args;      ANOTHER EDIT - I solved the non-object problem. When `wp_nav_menu()` calls the filter it is calling it like so:               $nav_menu = apply_filters( 'wp_nav_menu', $nav_menu, $args );      I failed to realize that this meant it was passing two arguments. I modified the display function like so:               public static function display( $nav_menu, $args ){      And of course modified the `add_filter()` call like so:               add_filter( 'wp_nav_menu', 'DEMenu::display', 1, 2 );      Although now I'm getting all sorts of fun new errors.               Fatal error: Using $this when not in object context in /home/coupon/public_html/wp-includes/class-wp-walker.php on line 185      Mind you I have made absolutely no modifications to WordPress core, so I don't understand why there's an error in `class-wp-walker.php`... I also don't understand why this error is just now showing up. Any ideas? FINAL EDIT - With help from http://stackoverflow.com/questions/6862887/replacing-wordpress- core-functionality-with-a-plugin I have finally realized that I can use the `wp_nav_menu_args` filter to pass my own walker class without copying the entirety of the `wp_nav_menu()` function. I will be using this solution (solving this problem), although as mentioned above - I am having a new problem where my walker class is causing its parent class to throw a fatal error. I will make a new question for that since it's an issue with the Walker class and not with accessing menu items or passing a custom walker. * * * **Task:** I need each sub-menu (second level or lower) to be divided into 5 columns (either 5 separate `<ul>` elements or `<div>` elements wrapped around certain `<li>` elements).


WordPress Export/Import for custom options.php values?

I've just discovered the WordPress export/import routine under the tools menu. However, upon testing it for the first time, several values stored in my wp_options table did not transfer over. Is there a way to include those values when exporting/importing a site?


get_categories returns an array with one category

I'm running a query on a custom plugin to display all categories and put them into a dropdown (the select parts are outside the loop) which looks like this:               <?php     $ember_categories = get_categories();     foreach($ember_categories as $ember_category) {         echo '<option value="' . $ember_category->cat_ID . '">' . $ember_category->name . '</option>';     }     ?>      For some reason though, it's only returning my default category (Uncategorized) - even though there are six more added to the system (including one I added afterwards, just as a curiosity). I'm wondering whether I'm doing something glaringly wrong?


Exporting Data from WordPress into a flat table

I need to be able to export the data within WordPress so that each `object` is contained in a single row, like a flat table. Imagine each post type as it's own database table, containing columns that represent all of the metadata. Right now, I'm having the hardest time trying extract all of the `key / value` pair metadata. I've tried `get_posts` and then looping over each post and extracting the metadata with `get_post_meta` ... but this just produces a bunch of convoluted array data. What would be the recommended way of doing this?


TinyMCE editor - new lines not rendered on front end

I've been working with a plugin making various tweaks and adding additional functionality. It uses custom post type to create a page with an associated download. In the admin area which allows you to create these new downloads, there is a box which allows you to add/edit a description for the download. This serves as the body content for the rendered page. However, the admin page only had a standard for this which was created by the following code;                   public function display_sdm_description_meta_box($post) {  // Description metabox     _e('Add a description for this download item.', 'sdm_lang');     echo '

';          $old_description = get_post_meta($post->ID, 'sdm_description', true);     ?>     <textarea id="sdm_description" name="sdm_description" style="width:60%;height:100px;"><?php echo $old_description; ?></textarea>     <?php     wp_nonce_field('sdm_description_box_nonce', 'sdm_description_box_nonce_check');      } I needed this to give the typical WP editor functionality so that the end user can create the page / body content much the same as on a normal page or post. As a result I was given the following code via another question I posted here on SO.               $old_description = get_post_meta($post->ID, 'sdm_description', true);      $editor_id = 'sdm_description';     $settings = array( 'media_buttons' => false );      wp_editor( $old_description , $editor_id, $settings ); So I now have;               public function display_sdm_description_meta_box($post) {  // Description metabox         _e('Add a description for this download item.', 'sdm_lang');         echo '

';              $old_description = get_post_meta($post->ID, 'sdm_description', true);              //adds TinyMCE capabilities         $editor_id = 'sdm_description';         $settings = array( 'media_buttons' => false );         wp_editor( $old_description , $editor_id, $settings );              ?>                  <?php         wp_nonce_field('sdm_description_box_nonce', 'sdm_description_box_nonce_check');     }      This render the tinyMCE editor in the admin section. However, if I hit enter to add a new line to the content this is only rendered as ` ` on the front end. Multiple 'enters' just result in more spaces, but never a new line or the equivalent of `<br/>` Why isnt the content output as expected? How can it be fixed? Thanks in advance! _-_ - _-_ EXTRA INFO If i click the 'Tools' > 'Source' button on the TinyMCE editor I get a pop up windows showing the content I've created as being: `<p>This is a test</p><p>Another line of testing!!!</p>` However on the front-end [eg the website] the source code shows as: `This is a test Another line of testing!!!` If I go into the DB, I can see that the data is stored literally like this:               This is a test                                Another line of testing!!!


Find sidebar.php in WP 3.9.2

I have tried to find sidebar.php in WP but I cant find it. Can anyone help me? I would like to remove achieve and META. I have been looking for this php file sidebar for a very long time now. Your sincerely


Admin encoding problem

My breadcrumbs plugin is taking blog name as starting point: blog name > category title > post title The problem is if I set the blog name in cyrillic characters it is desappearing as soon as "save" button is pressed. So in admin it looks like an empty field. On the site the question characters are shown where blog name should be. Check here k-gayduk.ru Any help appreciated.


Where can I access my custom page template?

I understand that to create a new page template, all I have to do is create my custom template (in this case, `page-custom.php`) file, and save it in `wp- content/themes/mytheme/`. However, where can I access this newly created template file? I want to edit it now... but it does not show up the page editor's Page Attributes options as an available template to use. This what I see on the page editor: ![enter image description here](http://i.stack.imgur.com/g3rG2.png) My newly created `page-custom` template isn't there. How can I make it appear as an option under Templates?


Media Library not displaying edited images when accessed through 'Add Media' button

I am experiencing an issue with edited photos not displaying in the media library when trying to add media to a post, they do however, display when you view the media library from the sidebar link. Here is what I see when I click on 'Media' from the WordPress dashboard sidebar.... ![enter image description here](http://i.stack.imgur.com/j2XEX.png) You can see the image that I have cropped using the WordPress image editing funcitonality and saved. If you then go to create a new post and click on the 'Add Media' button to insert an image into the post, you see this..... ![enter image description here](http://i.stack.imgur.com/zGZRw.png) Which is the original image, before editing. I have tried this on several different installs on several different server and all exhibit the same behaviour. Am I doing something wrong or have I discovered an issue that needs addressing?


Confusion about Site url and directory

I have installed my wordpress in root/mysubfolder so my standard path is example1.com/mysubfolder (example1.com is the domain i have registered the webspace with) Now i want the wordpress installation to work with example2.com (registered another domain) Therefore i have set the redirect for example2.com to the folder mysubfolder in my webspace admin area what do i have to change to get this to work? i have tried this in the wp-config.php file:               define('WP_HOME','http:example2.com');     define('WP_SITEURL','http:example2.com');      it works for the wp-admin and the homesite.. but if i click on a post the path is example2.com/post1 ..which doesn't work


Theme only supports one menu?

I would like to use the main menu but also have a menu in the footer for things like about, career, etc. Am I ~~fubared~~ foobared or can I do this?


Set thumbnail from URL, by grabbing image in functions.php

So I've written a whole bunch of functions, which are used to display Vine videos. I then have a shortcode which outputs the code. The last thing I have to do is set the post thumbnail. I want to be able to do this automatically when the post is published. On a Vine page, in the `<head>`, they have a piece of code which specifies an .jpg image of the video. I have been able to successfully grab this and upload it to the server in the uploads directory. However, the problem is that I can't seem to be able to set that image that's been grabbed + uploaded as the post thumbnail. Either, the same attachment is given to each post (an image I manually uploaded a while ago) or it doesn't set at all. Here's my code:               function vineThumb($id) {         $vine = file_get_contents("http://vine.co/v/{$id}");         preg_match('~<\s*meta\s+property="(twitter:image)"\s+content="([^"]*)~i', $vine, $matches);              // Add Featured Image to Post         $image_url  = $matches[2]; // Define the image URL here         $upload_dir = wp_upload_dir(); // Set upload folder         $image_data = file_get_contents($image_url); // Get image data         $filename   = basename($image_url); // Create image file name              // Check folder permission and define file location         if( wp_mkdir_p( $upload_dir['path'] ) ) {             $file = $upload_dir['path'] . '/' . $filename;         } else {             $file = $upload_dir['basedir'] . '/' . $filename;         }              // Create the image  file on the server         file_put_contents( $file, $image_data );              /* code works up to here. Image of the just-published Vine appears in the uploads directory. I now need this image to be set as the post-thumbnail. */              $attachments = get_posts(array(             'numberposts' => '1',              'post_parent' => $post->ID,              'post_type' => 'attachment',              'post_mime_type' => 'image',              'order' => 'ASC'         ));              $attachment = $attachments[0]->ID;              set_post_thumbnail($post->ID, $attachment);             /* here the same attachment ID is given - if I return $attachment; it will give the same ID, so when the code runs it just uploads the same attachment to each post. */     }         Hope I've been clear enough - it's quite difficult to explain :) thanks for any help :)


WordPress settings API error when checkbox unchecked

I am trying to creating some custom options for a template I am developing but I am getting an error when the checkbox (Line 130) is unchecked: > Warning: Illegal string offset 'show_admin_dev' in E:\composite- > cms\WordPress-Settings-Sandbox-master\lib\admin\pages\dev-page.php on line > 11 This is the line that seems to be throwing the error:               if ( $options['show_admin_dev'] == 1 )      The entire code can be found on GitHub.


Linking Javascript in functions.php file

Below is my raw javascript embeds from my html template. But I cannnot figure out exactly how to add it to my functions.php file. It seems pretty difficult. Can you please assist with the correct syntax using the `wp_enqueue_script` function.               <script src="../assets/components/plugins/ajaxify/script.min.js?v=v1.9.6&sv=v0.0.1"></script>          <script>var App = {};</script>          <script data-id="App.Scripts">     App.Scripts = {              /* CORE scripts always load first; */         core: [             '../assets/components/library/jquery/jquery.min.js?v=v1.9.6&sv=v0.0.1',              '../assets/components/library/modernizr/modernizr.js?v=v1.9.6&sv=v0.0.1'         ],              /* PLUGINS_DEPENDENCY always load after CORE but before PLUGINS; */         plugins_dependency: [             '../assets/components/library/bootstrap/js/bootstrap.min.js?v=v1.9.6&sv=v0.0.1',              '../assets/components/library/jquery/jquery-migrate.min.js?v=v1.9.6&sv=v0.0.1'         ],              /* PLUGINS always load after CORE and PLUGINS_DEPENDENCY, but before the BUNDLE / initialization scripts; */         plugins: [             '../assets/components/plugins/nicescroll/jquery.nicescroll.min.js?v=v1.9.6&sv=v0.0.1',              '../assets/components/plugins/breakpoints/breakpoints.js?v=v1.9.6&sv=v0.0.1',              '../assets/components/plugins/ajaxify/davis.min.js?v=v1.9.6&sv=v0.0.1',              '../assets/components/plugins/ajaxify/jquery.lazyjaxdavis.min.js?v=v1.9.6&sv=v0.0.1',              '../assets/components/plugins/preload/pace/pace.min.js?v=v1.9.6&sv=v0.0.1',              '../assets/components/plugins/owl-carousel/owl.carousel.min.js?v=v1.9.6&sv=v0.0.1',              '../assets/components/common/forms/elements/bootstrap-select/assets/lib/js/bootstrap-select.js?v=v1.9.6&sv=v0.0.1',              '../assets/components/plugins/less-js/less.min.js?v=v1.9.6&sv=v0.0.1',              '../assets/components/modules/admin/charts/flot/assets/lib/excanvas.js?v=v1.9.6&sv=v0.0.1',              '../assets/components/plugins/browser/ie/ie.prototype.polyfill.js?v=v1.9.6&sv=v0.0.1'         ],              /* The initialization scripts always load last and are automatically and dynamically loaded when AJAX navigation is enabled; */         bundle: [             '../assets/components/plugins/ajaxify/ajaxify.init.js?v=v1.9.6',              '../assets/components/core/js/preload.pace.init.js?v=v1.9.6',              '../assets/components/modules/admin/content/assets/news-featured-2.init.js?v=v1.9.6',              '../assets/components/modules/admin/content/assets/news-featured-1.init.js?v=v1.9.6',              '../assets/components/modules/admin/content/assets/news-featured-3.init.js?v=v1.9.6',              '../assets/components/core/js/sidebar.main.init.js?v=v1.9.6',              '../assets/components/core/js/sidebar.collapse.init.js?v=v1.9.6',              '../assets/components/common/forms/elements/bootstrap-select/assets/custom/js/bootstrap-select.init.js?v=v1.9.6&sv=v0.0.1',              '../assets/components/core/js/sidebar.kis.init.js?v=v1.9.6',              '../assets/components/core/js/core.init.js?v=v1.9.6',              '../assets/components/core/js/animations.init.js?v=v1.9.6'         ]          };     </script>          <script>     $script(App.Scripts.core, 'core');          $script.ready(['core'], function(){         $script(App.Scripts.plugins_dependency, 'plugins_dependency');     });     $script.ready(['core', 'plugins_dependency'], function(){         $script(App.Scripts.plugins, 'plugins');     });     $script.ready(['core', 'plugins_dependency', 'plugins'], function(){         $script(App.Scripts.bundle, 'bundle');     });     </script>         <script>if (/*@cc_on!@*/false && document.documentMode === 10) { document.documentElement.className+=' ie ie10'; }</script>


Manipulating wp_head content

I'd like to know if it is possible for me to manipulate the output of wp_head()? Right now I'm using the Yoast SEO plugin to add some social tags into my posts (og:*). Now this site is an remake of an older umbraco based blog, and the permalink structure is different, so the old urls are 301 to the new ones, but addthis requires the old url to keep the right count, so we have a custom field that provides the "addthis:url" when required... Unfortunately facebook & twitter do not use that url, but they use the pages "og:url" meta tag, that the plugin provides (which points to the new url), and seems that it can not be manipulated in the post. My idea is that before the wp_head is printed out, I would basically do an search-and-replace to change that "og:url" to correct one, but I have not found a way to do that... So what I'm asking is that is my idea correct and how to do it, or is there a better/official way to fix this solution?


This CSS Stuffing Works, But Is This A Good Practice?

I am trying to include a dynamic css in my plugin, I have been searching anywhere but doesn't find any case that is similar to what I do. And what I use to do it is by adding a css file directly into the end of my plugin php file after the closing php tag `?>` without adding any other stuffs like calling wp head etc. Here is the example of the code I put directly into the end of my plugin's file:               <style type="text/css">             .innertrow { background-color: <?php get_options('css_value');?>}          </style>      Is that a good practice?


How to create TEMPORARY Download links in a wordpress POST?

I'm creating a WordPress blog with some members-only page. In those members- only posts I have my own tutorial download links which i have uploaded for FREE. Problem is I want them to stop sharing the download link for the tutorials, instead of that I want to give them links which will only works once OR It will only work when it is accessed from mydomain.com .. Can anyone help me? any idea would be much appriciated. -Regards


Remove Ability for Administrators to Delete Administrators

I've been studying roles and capabilities and have worked with and worked up a bunch of awesome code for creating unique capabilities and roles. I have created a "Master Editor" role to maintain users with almost every capability... However, edit_users & delete_users obviously allows for an editor to CUD users, including the existing administrators... At the moment I'm to new at coding to be confident editing users.php but I have to be close to the solution:               if ( ! current_user_can( 'delete_users' ) )      // or is trying to delete an admin's $userids      wp_die(__('You can’t delete users.')); // or administrators          $update = 'del';     $delete_count = 0;          foreach ( $userids as $id ) {         if ( ! current_user_can( 'delete_user', $id ) )             wp_die(__( 'You can’t delete that user.' ) );              if ( $id == $current_user->ID ) {             $update = 'err_admin_del';             continue;         }         switch ( $_REQUEST['delete_option'] ) {         case 'delete':             wp_delete_user( $id );             break;         case 'reassign':             wp_delete_user( $id, $_REQUEST['reassign_user'] );             break;         }         ++$delete_count;     }      I can't figure out how to check that the $userids in question are an administrators user ID. Because if I can I could add that to the die... Am I on the right track? Thanks in advance.


Wrapping my head around add_filter

this is a very general question, which I have really researched. Maybe I'm just being stupid, but I can't quite get when I can use a filter. After some messing around earlier, it seems I can take any function in the core files, pass this as the filter name, and the second argument I can replace this with my own function in the functions.php or plugin file. Is that correct? Can I literally modify anything doing this? I've been trying to alter some fields on the user profile page, which sucks because some can be altered and some can't as the PHP and HTML doesn't come from a function or class I can work with - it seems certain things can only be changed by hacking around the core files, which I'm not about to do! So, in summary, can anyone please give me a very short and sweet explanation as to why and when I'd use an action or a filter. This has become I hurdle I wan't to get over! Many thanks ,Dan. Update: Sample code?               function get_stylesheet_directory() {         $stylesheet = get_stylesheet();         $theme_root = get_theme_root( $stylesheet );         $stylesheet_dir = "$theme_root/$stylesheet";              return apply_filters( 'stylesheet_directory', $stylesheet_dir, $stylesheet, $theme_root );     }


use query string in URL to display content on the page

I'd like to say something on my wordpress page, based on what page the person got there from. I can set up the link to that page to be www.website.com/page?parameter=myparameter, but is there a way I can access that parameter so that I can have it show on the page, somewhere in my content? Thanks! Update: With your help and some googling, I put together a shortcode that returns the value of any url parameter. here it is:               //THIS IS A CUSTOM SHORTCODE TO DISPLAY A PARAMETER FROM THE URL     function URLParam( $atts ) {           extract( shortcode_atts( array(             'param' => 'param',         ), $atts ) );         return $_GET[$param];       }     add_shortcode('URLParam', 'URLParam');       I use the shortcode like this: [URLParam param='trip_type'] to get the trip_type from my url. YAY! Next step: work on some conditional logic....


How do i know which action / filters are called when i call get_option()

I need to know which action / filters are called when i do a `get_option()` call, how can i do that?


wp_mail recipient array not sending?

I am using wp_mail to send an email to multiple recipients. my mail function looks like this:               wp_mail($group_emails, 'my subject', 'my message', $headers);      `$group_emails` is an array of email address's and gets outputed like this:               $group_emails = Array ( [0] => ceri@test.com [1] => craigj@test.com [2] => danyob@test.com [3] => geoffh@test.com [4] => ianc@test.com [5] => mark.butcher@test.com [6] => mickh@test.com [7] => mike@test.com [8] => stephd@test.com [9] => stuartj@test.com )      For some reason the email does not get sent to the above emails? If i remove the multiple recipients and just put a single email address, it works fine! Any suggestions?


buddypress: how do i make the group description excerpt shorter?

I set up a theme in buddypress and i want to have a teaser section for my groups on there. It works fine but i have a problem to shorten the group description... I'm using it like this:
<a href="<?php bp_group_permalink() ?>"><?php bp_group_name() ?>

<?php bp_group_description_excerpt() ?>
      If there´s a very long group-description it crashes my layout. Is it possible (like in wordpress) to make the excerpt shorter (with a function or something)? Like "maximum of 20 letters", or something like that? Thanks.


Wordpress: Loop Help

I was working on this site this morning and I ran into a bit of an issue with my static page. I have a "featured" post section and I use:
         <img src="<?php echo get_bloginfo('template_directory'); ?>/images/house.jpg" alt"Buy Me" />
          <?php query_posts(array ('tag'=> 'featured' )); ?>         <?php while (have_posts()) : the_post(); ?>
<a href="<?php the_permalink(); ?>"> <?php the_title(); ?>

<?php the_time('F jS, Y') ?> by <?php the_author() ?>
         <?php endwhile; ?>

      The above works great, however, the page content is where I am running into an issue. I have a content section that is pulling in the "pages" actual content, and I use:
     <?php if (have_posts()) : while (have_posts()) : the_post(); ?>                  <div <?php post_class() ?> id="post-<?php the_ID(); ?>">
<?php the_title(); ?>

                     <?php the_content(); ?>

              <?php endwhile; ?>              <?php include (TEMPLATEPATH . '/inc/nav.php' ); ?>              <?php else : ?>
Not Found
              <?php endif; ?>
      When I refresh the page, both of the sections are now displaying the featured post, and not the the page content. Does anyone have a clue to why this is happening?


Simple child theme modification but links are broken

I have created a simple child theme to modify the Minimal theme by Elegant Themes. The child theme loads with the changes I have made, but the links to pages in the header are all messed up. Rather than the page links I have selected appearing in the header, links to all categories appear in addition to links to these pages. Even if the only modification I make is as follows:               @import url("../Minimal/style.css");          a {         text-decoration: underline !important;     }      The links at the top are still messed up and the category links are improperly displayed in addition to the page links, even though I am not making any other changes. (But the underline does display.) What is causing this issue? EDIT: Clarified that category links are what is being display incorrectly.


Create WP account from an external email form submission?

I have a single email field form on a static, 1 page html website which upon submitting, I would like it to pass the entered email to a WordPress install to use as an email for a new account. The html website and the wordpress website are on different domains. Can WordPress handle this without a custom plugin? I have the html of my form from the static website below:               <form action="signup.php" id="contact_form" method="post" onsubmit="return validateForm();">

Just enter your email to start. Easy, with spam-free goodness.
     <input type="text" name="email" id="email" value="Enter your e-mail" class="requiredField email" onblur="if(this.value == '') { this.value = 'Enter your e-mail'; }" onfocus="if(this.value == 'Enter your e-mail') { this.value = ''; }" />
Add additional details later, no credit cards required!

<input id="submitted" class="input-submit" type="submit" value="Sign Up" name="submit" />

          </form>      Upon Submission, I have a javascript function which validates the email entered:                     The form action sets some variables and shoots me an email of the submitted email address:               <?php     $email_to = "accounts@xxxxxxxxxx.com";     $emailSubject = 'User Account Submission from xxxxxxxxxxx';     $email = $_POST["email"];     $text = "Email: $email
";     header("Location:http://xxxxxxxxxxx.com/signup.html");     mail($email_to, $emailSubject, $text);     ?>      How would I instead: 1) send this to WP so that WP can use the email to create an account 2) have wp setup a temp password 3) and then email the new account+pass to the user? I'm still a beginner when it comes to customizing WordPress and am not sure the best way to go about sending WP the form? Any help or insight on the proper places to look would be appreciated!


preg_match() not working with post content

I'm new to Wordpress, and I wrote the following function:               function find_my_image() {     if(is_single()) {              if (preg_match('#()#', $content, $result)){                  $content .= '
Image has been found
';              }         else{                  $content .= '
Sorry, no image here!
';              }               }     echo $content;          }     add_filter('the_content', 'find_my_image');      Basically, I just want to find out if my post has a image in it and display proper message. Currently, I'm always getting the false result, so I'm just wondering what am I doing wrong.


How to get search results in the backend admin on a custom post type?

I have a custom post type books and have many meta boxes for it...etc But in the backend, I am not able to search anything. For example I try to search the custom post type id in the search field, it comes back with no results. How can I add different search items into the search query?


Retrieve post tags from from main wp_query

I'm running a custom WP_Query and find the following SQL running as part of it.               SELECT t.*, tt.*, tr.object_id FROM wp_terms AS t INNER JOIN wp_term_taxonomy AS tt ON tt.term_id = t.term_id INNER JOIN wp_term_relationships AS tr ON tr.term_taxonomy_id = tt.term_taxonomy_id WHERE tt.taxonomy IN ('category', 'post_tag') AND tr.object_id IN (381, 383, 389, 395) ORDER BY t.name ASC      Now within the loop I'm using `wp_get_object_terms( $post->ID, 'post_tag' );` to retrieve post tags. This results in additional SQL queries for each post to retrieve post tags. Something I believe shouldn't be necessary when the post tags were fetched when the WP_Query initial ran. WordPress is smart enough not to do this with post meta, as any number of calls to `get_post_meta` within the loop never results in additional SQL queries. How can I retrieve the post tags and possibly the categories from the original WP_Query and avoid extra SQL queries.?


Filter orders by product in admin

I'm setting up Woocommerce store for a client who is selling tickets to multiple different live shows. On the night of a show, the box office manager needs to be able to view only orders that contain one specific product (the show). Does anyone know of a plugin that would allow a store manager to either view all orders that contain a specific product, or download a csv of those orders (ideally both)? Barring that, if anyone has had to do something similar and has any insights on adding custom filters to the order screen, I would really appreciate your input! Thank you.


Custom metabox with App Store / Google Play links

I've got a issue when trying to setup our app portfolio. (have a look at our portfolio page) Whats going on: I created a custom post type with 'apps'. Every post I'm going to create is a project we worked on. In this post there might be 3 properties: 1) App store link 2) Google Play store link \---- optional: ---- 3) Intern app (no link) Meanwhile, in our template this will be displayed: Is there a store link? If yes, make this image (http://www.dreamix-studio.com/images/ios_button.png) a link: Else: Create this image (http://www.dreamix- studio.com/images/ios_inactive_button.png). This also goes for the Google Store link. How do I create this? And how do I create this in our template?


Restrict post edit/delete based on user ID and custom field

I've been able to prevent deletion and editing of posts based on user ID and page ID however, I need to restrict access to editing and deleting based on a custom field. Not sure how to go about doing this. **Current working code for restricting user ID from editing/deleting based on page ID:**               function restrict_post_deletion($post_ID){         $user = get_current_user_id();         $restricted_users = array(1,2,3,4,5,6,25,54,19);         $restricted_pages = array(2,21,52,64);              if(in_array($user, $restricted_users) && in_array($post_ID, $restricted_pages)){         do_action('admin_page_access_denied');         wp_die( __('You cannot modify or delete this entry.') );         }     }     add_action('edit_post', 'restrict_post_deletion', 10, 1);     add_action('before_edit_post', 'restrict_post_deletion', 10, 1);     add_action('wp_trash_post', 'restrict_post_deletion', 10, 1);     add_action('before_delete_post', 'restrict_post_deletion', 10, 1);      So we'll say custom field is: $customstatus $customstatus is already defined within the post through a dropdown with two options 'available' and 'protected'. In this example, restricted_pages and post_ID are no longer relevant since I'm not restricting based on a custom field. I would like the restrict_post_deletion function to prevent editing/deleting of posts based on the user ID AND $customstatus == 'protected'. **The following is not working:**               function restrict_post_deletion($post_ID){             $user = get_current_user_id();             $customstatus = get_option('wp_customstatus');             $restricted_users = array(1,2,3,4,5,6,25,54,19);                  if(in_array($user, $restricted_users) && $customstatus == 'protected'){             do_action('admin_page_access_denied');             wp_die( __('You cannot modify or delete this entry.') );             }         }         add_action('edit_post', 'restrict_post_deletion', 10, 1);         add_action('before_edit_post', 'restrict_post_deletion', 10, 1);         add_action('wp_trash_post', 'restrict_post_deletion', 10, 1);         add_action('before_delete_post', 'restrict_post_deletion', 10, 1);      Where am I going wrong? Some help would be greatly appreciated.


Loop with array of posts using 'Advanced Custom Fields' plugin

i'm getting in trouble using Advanced Custom Fields (acf) plugin. I'm using the 'Post Object' using more less this code:               <?php          /*     *  View array data (for debugging)     */          var_dump( get_field('post_objects') );          /*     *  Loop through post objects (assuming this is a multi-select field) ( setup postdata )     *  Using this method, you can use all the normal WP functions as the $post object is temporarily initialized within the loop     *  Read more: http://codex.wordpress.org/Template_Tags/get_posts#Reset_after_Postlists_with_offset     */          $post_objects = get_field('post_objects');          if( $post_objects ): ?>
         <?php foreach( $post_objects as $post): // variable must be called $post (IMPORTANT) ?>             <?php setup_postdata($post); ?>
                 <a href="<?php the_permalink(); ?>"><?php the_title(); ?>                 Post Object Custom Field: <?php the_field('field_name'); ?>
         <?php endforeach; ?>
         <?php wp_reset_postdata(); // IMPORTANT - reset the $post object so the rest of the page works correctly ?>     <?php endif;      that is the example code from ACF site. Problem start when I try to paginate the posts in $post_objects variable because it's an array of posts but is not possible to apply the               <?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>      beautiful wp loop and I don't now how to paginate a foreach loop. Any suggestion? Francesco


Is there a way to get N number of WYSIWYG editors in a custom post type?

Is there way to have multiple WYSIWYG editors for a custom post type? For example, if I had a 2 column layout I wanted to have one editor for one column and another editor for the other.


Change Genesis <title> Tag from Page Template

I have made a page template for a Genesis theme in which I want to change the `<title>` tag but I can't find any API reference or example to do this. Does anyone have any idea how to do this?


In Settings>>General I am missing some fields

I am new to Wordpress and downloaded the 3.5.1 version from my hosting provider. I want to add www in front of my domain and I read from many sources how to do this. Go to settings then general and change it there. Thats fine except my screen in General looks nothing like the instructions I have been following It does not have a place to change the Site or Wordpress URL. Am I missing something ![enter image description here](http://i.stack.imgur.com/ZukYv.png)


Transfer of wordpress site from one domain and server to another domain and server

I have moved a wordpress site from one domain and server to another domain and server. Everything looks fine except all the links within the site are still pointing to the previous domain. Please let me know what went wrong with the transfer. I'll really be thankful for the kind response and help.


Add exception to WP Mobile Detector

In the function `websitez_detect_mobile_device` in `functions.php` of WP Mobile Detector there is the detection of a mobile device (smartphone). Now I want that my Samsung Galaxy Tab (GT-P5100) is not treated as a smart phone. It should not redirect the user and the user should get the desktop version. The user agent according to whatsmyuseragent.com is: > Mozilla/5.0 (Linux; U; Android 4.0.3;de-de;GT-P5100 Build/IML74K) > AppleWebKit/534.30 (KHTML, like Gecko) Version/4.0 Safari/534.30 How can I add an exception for this device? Can I use this code?               case (preg_match('/GT-P5100/i',$user_agent)); //Android         $mobile_browser = false;         $mobile_browser_type = "0"; //Tablet     break;      Or is there a better way?


upgrade plugin in wordpress

I am using wordpress on my live server which only uses sftp using an ssh key. I want to install and upgrade plugins, but it appears that you are required to enter your ftp login to install the plugins. Is there a way to install and upgrade plugins by manually uploading the files instead of having wordpress handle the entire process?


Make a category my homepage

I've been trying every way, reading every post, to find out how to get my homepage to show category only. In my case, I will only like to show "travel" I have tried another way is to set it as a menu first, however, the page does not show up as my home page, rather all my posts instead of posts only from the Travel menu unless I click on it Is there a way around this, as in step by step will be great!


Wordpress Permalinks 404 bug with "next" button

I have changed wordpress to use permalinks for post names. `/%postname%/` so that they are in the form `wordpress.com/sample-post`. The permalinks work great but it messes up the "next" and "previous" buttons. The default permalink structure works great, but whenever I change the permalinks to any other form, the next button link gets changed to `wordpress.com/page/2`. which doesn't exist... how do I get the buttons to link to the correct place? It appears this is a bug on wordpresses side, but I can't find any answers to this problem directly.


Are mu-plugins plugins still deployed via wordpress.org/plugins?

I'm getting ready to publish my first plugin. I've decided to put it in mu- plugin, because if you removed it, it would break other code dependent on it. (It's a developer tool for logging variables to a text file.) So, do can I submit this to wp.o? Or do they only accept plugins that go into the plugins directory?


Secondary Query Is Breaking Main Query

I registered a Custom Post type called "quote" and I am trying to show a single random quote on every page of my Wordpress site. I'm pulling out a single quote with the following code:               $args = array( 'post_type' => 'quote', 'posts_per_page' => 1, 'orderby' => 'rand' );     $posts = get_posts( $args );          //The code between here and the next comment doesn't really matter.  I can remove it     //and the problem will still exist.  As soon as I make the get_posts() call above     // I get the problem        if (sizeof($posts) > 0) {         echo '
"'.$posts[0]->post_content.'"
';         $author = trim(get_field("author", $posts[0]->ID));         if (!empty($author)) {echo '
- '.$author.'
';}      }       //End block      wp_reset_postdata();      This works and I'm able to show a single random quote. (I'm using the advanced custom fields plugin which adds the get_field method in the code above.) However, my main loop content gets corrupted. Instead of showing the main loop content on the page, my quote is repeated a second time in it's place. This is the code I'm using for my main loop.                <?php while(have_posts()) : the_post(); ?>          <div class="post" id="post-<?php the_ID(); ?>">
               <?php the_content(); ?>

       <?php endwhile; ?>       If I remove the code that displays the quote, my main loop content gets restored. I thought calling `wp_reset_postdata()` was the key to using a secondary loop with the main loop, but it doesn't seem to help in this case. Can anyone point me in the right direction?


Multiple instances of TinyMCE are removing <p> tag

I'm using the following code in functions.php to add a TinyMCE box on custom field textareas inside the Editor:               add_action('admin_print_footer_scripts','FT_TinymceCustom',99);     function FT_TinymceCustom()     {     ?>          <?php      } However, on any box I add this to, it seems to cause a bug that deletes paragraph tags. So if I enter this in the custom TinyMCE textarea (source view):
test
p>test
      After saving, this is what shows in the box:               p>test test
      This only occured after the latest 3.9 update, which forced me to modify my JS code above to make it work.


How to execute a shortcode?

I have a WordPress option that stores some data, like:
Header

Paragraph
     [shortcodesomething/]     [shortcode]Contents[/shortcode]      I'm displaying this option's value using `echo get_option('my_option'));`. Of course the shortcodes doesn't work, and I'm wondering how to force them to do what they are supposed to do? `echo do_shortcode(get_option('my_option'));` doesn't work either (I know this is an absolutely wrong approach, but I don't know any other way of displaying them).


delete uploaded file

I have a function wp_handle_upload() for uploads files.               $file = $_FILES['attachment_icon-' . $i];     $upload = wp_handle_upload($file, array('test_form' => false));      what is a function for delete a uploaded file?