Footnotes in custom fields

I am using Jquery Hover Footnotes plugin that allows adding footnotes and dynamically displays them on hover-over. In other words, I use `{{FOOTNOTE_NUMBER}}`, Then I embrace the actual footnote text with double brackets `[[FOOTNOTE_NUMBER]] Footnote text [[FOOTNOTE_NUMBER]]`. the plugin will find these "shortcodes" and auto place a box onhover on a footnote. For more information about this plugin thanks to visit http://wordpress.org/extend/plugins/jquery-hover-footnotes/ An example here: http://restoredisrael.org/blog/961/footnote-plugin-test-page/ I am in addition using custom fields , and I get their content by using:               echo get_post_meta($post_id, $key, $single);      The problem is that this plugin is only applied to the content (returned by `the_content()`). While looking at the plugin code, I found:               add_filter('the_content', 'jqFootnotes', 1, 1);      So I tried adding this filter also for the meta values:               add_filter('get_post_meta', 'jqFootnotes', 1, 1);     add_filter('key_name', 'jqFootnotes', 1, 1);       BUT IN VAIN. What should I do so that the plugin will be applied also on footnotes inside my custom fields?


How to display custom taxonomy

I have created `city` taxonomy in back end and i have added mumbai,pune,nashik city in `city` taxonomy like bellow snipe. My problem is that when i click the city for example `mumbai` i want display the all product in the `mumbai` city which i have set from the product tab means that product is in `mumbai` city category. I have tried with bellow code but not getting any thing. Custom Taxonomies display Template file used to render the Archive Index page for a Custom Taxonomy               taxonomy-{taxonomy}-{term}.php      As regrading above code i have changed my file name to `taxonomy-city- city.php` but its not working.tell me if have any body idea about this issue. Site Link:- Click Here and Click on select your city button 1) Taxonomy city:- ![taxonmycity](http://i.stack.imgur.com/r1PDz.png) 2) Added cities in Taxonomy `city` ![city](http://i.stack.imgur.com/5SRNz.png) 3) Taxonomy terms details ![terms](http://i.stack.imgur.com/TDTh6.png)


Enumerating shortcode attributes in JavaScript

I'm working on a plugin which uses a shortcode to call a JQuery function, and it requires three aspects to work:   1. The JQuery code + its own code, to be included on the pages it will be used on   2. The HTML element it will work on requires an "id" attribute, in order to reference it   3. A reference/initialization in a `$(document).ready(function())` block I've already implemented 1 and 2; 1 by using `wp_register_script` and, if the shortcode appears, `wp_print_scripts` to print it; and 2 by making "id" an attribute of my shortcode, which also gets returned, e.g. `[myshortcode id="foo"]` returns `id="foo"`. The problem is 3. The initialization is of the form:               $(document).ready(function()          {              $("#id").func( {attributes} );           }       );      I've considered using `wp_localize_script` over a variable for the ID; however, I do not know how many times the shortcode will appear on a given page, and it seems sloppy to register an arbitrary number of otherwise- identical scripts and just hope that the number won't be surpassed. This seems like it's probably pretty common, but I haven't been able to find anything related by searching. Any ideas? Thanks!


wp_nav_menu - show children of current menu item only?

I am trying to create a menu structure with a simple concept:   1. A horizontal, 1-level deep main menu   2. A vertical submenu, that contains children of the current main menu item (2 levels deep) Of course, the submenu should be shown in the following cases:   1. Viewing the main menu item   2. Viewing a direct child of the main menu item   3. Viewing a descendant of the main menu item (3rd level) Since I want to keep the menu clean, I need to show the 3rd level for the currently active 2nd level menu item only. Basically, I want to achieve the same thing as described in this topic: How to show only parents subpages of current page item in vertical menu? \- **BUT, using wp_nav_menu()** I would be happy to use filters or custom walkers if somebody could point me to a right direction. The important thing here to notice is that since wp_nav_menu can contain also custom links or category links, the solution should work for all of those cases.


Creating Search Engine Friendly URL's with Word Press

I own a website barrelandblade.com which was developed by a non SEO enlightened developer. I recently had the FV All in One SEO Pack installed as my site does not show up in the search engines at all. I understand my URLs should be representative of my page content but do not know how to go about it. Is there a way to do this that I can do or have someone setup so my site can get ranked?


qtranslate arabic shortcode?

Hello I used qtranslate in my site. Four language selections. English Russian Turkish Arabic But not work arabic. executed this url; site.com/ar does not work. Shows an error. Error code ; Warning: Cannot modify header information - headers already sent by (output started at /home/useruser/public_html/www.site.com/blog/wp- content/themes/tema/index.php:1) in /home/useruser/public_html/www.site.com/blog/wp-content/themes/tema/header.php on line 1


Access CSS Classes specified in Menu options

Is there a way to access CSS styles specified in the Menu CSS options in the code? I would like to access the names of the css classes (as shown here) in my php page. How would I do it?


Adding an external stylesheet to a plugin

I apologize in advance if this question has been asked before. I've created a plugin, and I'm trying to add an external stylesheet, but it's not working. Am I suppose to compress the plugin file and the stylesheet, and upload them then add a link to the stylesheet in the theme's php file?


Get post featured image id with $wpdb

I'm not a sql expert, but with some help and copying from queries I've found on the web I got this working one that gets the 20 closest places (custom post type) to a specific latitude and longitude ($lat and $long). How can I edit this query to have also the post thumbnail ID in it? I want to do this to reduce the number of queries in my pages, so I think that looking for the value directly with this query instead of using get_post_thumbnail_id() each time I will save some, right?               SELECT $wpdb->posts.ID, $wpdb->posts.post_title, $wpdb->terms.name,         wpcflat.meta_value AS latitude, wpcflong.meta_value AS longitude,          6371 * 2 * ASIN ( SQRT (POWER(SIN(($lat - wpcflat.meta_value)*pi()/180 / 2),2) + COS($lat * pi()/180) * COS(wpcflat.meta_value *pi()/180) * POWER(SIN(($long - wpcflong.meta_value) *pi()/180 / 2), 2) ) ) AS distance     FROM $wpdb->posts         LEFT JOIN $wpdb->postmeta AS wpcflong ON ($wpdb->posts.ID = wpcflong.post_id)         LEFT JOIN $wpdb->postmeta AS wpcflat ON ($wpdb->posts.ID = wpcflat.post_id)         LEFT JOIN $wpdb->term_relationships ON ($wpdb->posts.ID = $wpdb->term_relationships.object_id)         LEFT JOIN $wpdb->term_taxonomy ON ($wpdb->term_relationships.term_taxonomy_id = $wpdb->term_taxonomy.term_taxonomy_id)         LEFT JOIN $wpdb->terms ON ($wpdb->term_taxonomy.term_id = $wpdb->terms.term_id)     WHERE $wpdb->posts.ID NOT IN ($post->ID)     AND wpcflat.meta_key = 'wpcf-latitude'     AND wpcflong.meta_key = 'wpcf-longitude'     AND $wpdb->posts.post_status = 'publish'      AND $wpdb->posts.post_type = 'places'     AND $wpdb->term_taxonomy.taxonomy = 'countries'     ORDER BY DISTANCE     LIMIT 20      Thanks a lot in advance to everyone!


How do I create multiple post types in same menu section in WP-admin?

I am building a custom menu section (a new item with subitems in the main menu section on the left side) in the WordPress Administration of my website. The section shall include a main post type, and for this you should be able to link category and country. It would be possible to use taxonomies, but taxonomy only supports multiple choices. Therefore, I want to be able to create new post types for category and country instead of taxonomies. But it won't work out if I want it to be under the same menu section? Please help.


Best structure / rewrite rules to achieve the following url

I have been trying to achieve the following url structure in Wordpress and maintain a level of reusability in the admin area. It is for a client preview area and needs to reflect multiple versions of different file types. So the desired URL structure would be: http://preview.mysite.com/client-name/wireframes/v1/homepage/ /client-name/ is a dashboard view showing links to /wireframes/ as well as /mockups/ or anything else that is a design phase. /v1/ relates to the version number of /homepage/ The easiest way is to use pages and sub pages but there must be a better way. More of a CMS way. Maybe there isn't. Perhaps Wordpress is the wrong choice for this.


Video tutorials in Dashboard

I want to insert a few video tutorials in the wordpress dashboard, instead of creating a pdf manual for a client, as i think they are easier for this client, how would I go about that? I am thinking of having like 4 videos in the dashboard. Where would be the best place to host them as well, in order to keep them private?


Custom page template in warp7 (Yootheme template)

I am trying to add my custom page template to wordpress. I have created a page-portfolio.php to the folder > \wp-content\themes\yoo_master2_wp\layouts My php file has following content:               <?php     /*     Template Name: My Portfolio     */     // get warp         $warp = Warp::getInstance();              // load main template file         echo $warp['template']->render('template');          if (have_posts()) : ?>         <?php while (have_posts()) : the_post(); ?>
                  <?php if (has_post_thumbnail()) : ?>                 <?php                 $width = get_option('thumbnail_size_w'); //get the width of the thumbnail setting                 $height = get_option('thumbnail_size_h'); //get the height of the thumbnail setting                 ?>                 <?php the_post_thumbnail(array($width, $height), array('class' => '')); ?>             <?php endif; ?>
<?php the_title(); ?>
                  <?php the_content(''); ?>                  <?php edit_post_link(__('Edit this post.', 'warp'), '
 ','
'); ?>
              <?php endwhile; ?>     <?php endif; ?>          <?php comments_template(); ?>      Here is the tutorial, how it should work (last part). According to this tutorial I should do the following:               <?php     /*     Template Name: My Portfolio     */     <?php get_header(); ?>          Put your content here...          <?php get_footer(); ?>      But like this I get only a blank page. The code above is copied from the page.php in layouts and with the code from this post But I get following error message: > Fatal error: Class 'Warp' not found in C:\xampp\htdocs\wordpress\wp- > content\themes\yoo_master2_wp\layouts\page-portfolio.php on line 6 So, does anyone know the correct way to do in warp7? The documentation did not help


Custom post types - show specific posts

This is the url: HOUSE 1 I have custom post type "Properties".For each new property, I can select "Property Type", "Property Status", "Property Location" taxomony. This page is using its own template, so I was wondering - can I modify the query for that template to show other properties from one "Property Location", that would match the current Location? For example, if I open any "House 1" ("House 1" is Property Location) property, I don't want the page to show posts with ""House 2" Property Location, but posts from the current Location only. I tried few combinations using http://generatewp.com/wp_query/ , but can't figure this out. I am sure, though, that it's a simple thing to change.


Body classes in child theme

In the theme twentyfouteen, the `full-width` class is defined with the following code               if ( ( ! is_active_sidebar( 'sidebar-2' ) )     || is_page_template( 'page-templates/full-width.php' )      || is_page_template( 'page-templates/contributors.php' )      || is_attachment() ) {      $classes[] = 'full-width';      }      from this function               function twentyfourteen_body_classes( $classes ) {     if ( is_multi_author() ) {         $classes[] = 'group-blog';     }          if ( get_header_image() ) {         $classes[] = 'header-image';     } else {         $classes[] = 'masthead-fixed';     }          if ( is_archive() || is_search() || is_home() ) {         $classes[] = 'list-view';     }          if ( ( ! is_active_sidebar( 'sidebar-2' ) )         || is_page_template( 'page-templates/full-width.php' )         || is_page_template( 'page-templates/contributors.php' )         || is_attachment() ) {         $classes[] = 'full-width';     }          if ( is_active_sidebar( 'sidebar-3' ) ) {         $classes[] = 'footer-widgets';     }          if ( is_singular() && ! is_front_page() ) {         $classes[] = 'singular';     }          if ( is_front_page() && 'slider' == get_theme_mod( 'featured_content_layout' ) ) {         $classes[] = 'slider';     } elseif ( is_front_page() ) {         $classes[] = 'grid';     }          return $classes;     }     add_filter( 'body_class', 'twentyfourteen_body_classes' );      I'm adding a selection of sidebars to the sidebar-content.php file. These sidebars must also have the same body class as `sidebar-2`. Is it correct for me to just use a different fuction name as to that of the twentyfourteen theme and to still hook on the `body_class`, keep the same class name (full-width), and change the above code in a child theme to               if ( ( ! is_active_sidebar( 'sidebar-2' ) &&  ! is_active_sidebar( $sidebar_option ) )      || is_page_template( 'page-templates/full-width.php' )      || is_page_template( 'page-templates/contributors.php' )     || is_attachment() ) {      $classes[] = 'full-width';      }      I'm getting a lot of stuff that tells me how to ad a new body class and removing one, but nothing on how to change an existing body class of a parent theme in a child theme or if it is even possible


Getting error of unexpected output during activation

I have seen one plugin named lordlinus business hours When I am trying to install it, I am getting error : > The plugin generated 2 characters of unexpected output during activation. If > you notice “headers already sent” messages, problems with syndication feeds > or other issues, try deactivating or removing this plugin. How can I resolve this error?


custom menu not found

I am trying to use a menu which I have partially working, I have setup functions.php:               if (function_exists('register_nav_menu')) {       register_nav_menu('main-menu', 'Main Menu');     }      I have configured the menu in Appearance -> Menus with 2 Pages: Home & Sample Page. My Problem: When I call the menu using wp_nav_menu() like this: CODE#1               wp_nav_menu( array( 'theme_location' => 'main-menu', 'container' => false ) );      I get no menu - nothing prints to screen When I access the elements manually like this: CODE#2               $menu_name = 'main-menu';          if ( ( $locations = get_nav_menu_locations() ) && isset( $locations[ $menu_name ] ) ) {            $menu = wp_get_nav_menu_object( $locations[ $menu_name ] );       $menu_items = wp_get_nav_menu_items($menu->term_id);       $menu_list = '
';            foreach ( (array) $menu_items as $key => $menu_item ) {         $title = $menu_item->title;         $url = $menu_item->url;         $menu_list .= '
' . $title . '
';       }       $menu_list .= '
';     } else {       $menu_list = '

No Menu

';     }     echo $menu_list;


How can I list URLs of all audio files within my media gallery?

I have a music player in my theme that generates its playlist from a javascript file that looks like this               var myPlaylist = [          {             mp3:'track url goes here',             title:'title here',             artist:'artist',         }         {             mp3:'track url goes here',             title:'title here',             artist:'artist',         }      etc...          ];      How can I query the media library so it will echo the track url, title text and maybe an existing audio parameter like "description" for the artist value? I know enough about php to put them in the right places once they're queried, I just needto know how to pull them from the wp database!


Filter custom comment type from Manage Comments & Dash Widgets

I use comments with a custom comment type in my plugin to notify users of various events created by the plugin. The problem is I don't want these cluttering up the standard comments so I need to filter out those custom comments from the manage comments screen as well as the recent comments dashboard widget. Does anyone have any ideas on how to do this?


Count user posts by user ID, Post type and Post status

What I am trying to do is modification of this function on codex http://codex.wordpress.org/Function_Reference/count_user_posts Check the title **adding post type support** bottom of the page. The function is:               function count_user_posts_by_type($userid, $post_type='post') {       global $wpdb;       $where = get_posts_by_author_sql($post_type, TRUE, $userid);       $count = $wpdb->get_var( "SELECT COUNT(*) FROM $wpdb->posts $where" );       return apply_filters('get_usernumposts', $count, $userid);     }      What I want is to add post status to the function. So, I assume I have to add a WHERE to the query but not sure how to do it. Any help will be appreciated. Thanks!


List archive year - post by post

I want to do a list archive "post by post", but separated by year. Like this:
2014

     Post 4     Post 3     Post 2     Post 1

2013

     Post 3     Post 2     Post 1
      is there a way to do this?


Localizing strings that come from outside of plugin?

Plugin queries remote API and under certain circumstances (mostly errors) displays textual messages from API responses. All messages in API responses are in English, but since they are more or less integrated in plugin it would make sense to make them localized and display-able in different language to match plugin's interface. Theoretical question - should such messages be localized at all or are they out of scope for localization? Coding question - how do you even localize such and retain compatibility with related tools? Does something like `__( $message );` even make sense? In the past I used Codestyling Localization which relies on scanning plugin's source to extract strings... But there is nothing to extract since strings are not contained in plugin's body.


URL to an image in a post is changing when permalink is set to custom. Can I avoid this?

I have a buy-button image set in all posts on the entire site. When permalink settings are default the URL to that image file is www.mydomain.com/images/buy-button.gif. When permalink settings are custom the URL to that image file is generated dynamically to www.mydomain.com/permalinkcustom/images/buy-button.gif. The result is that the buy button is not visible any more on the posts as its URL remains the same as if when permalink settings is still default. How can I configure this URL- rewrite? Many thanks for any help. Ruediger


Not receiving mail using wordpress function

I'm not receiving emails when using the following function. Is there another method that works or that I can test?               <?php      $data = ob_get_clean();          require_once(dirname(__FILE__).'/make-pdf.php');     require_once(dirname(__FILE__).'/attach-mail.php');          $pdf = make_pdf($data);     $filename = 'confirmation_'.date('Ymd_his').'.pdf';          $to = $_POST['admin_email'];     $from = 'my@email.com';     $subject = "Enquiry";          mail_attachment($filename, $pdf, $to, $from, $subject, $message);     echo $data;          } ?>      attach-mail.php               <?php     function mail_attachment($filename, $data, $mailto, $from_mail, $subject, $message) {         $file_size = strlen($data);         $data = chunk_split(base64_encode($data));         $uid = md5(uniqid(time()));         $header = "From: ".$from_mail."\r\n";         $header .= 'Cc: my-other@email.com' . "\r\n";         $header .= "MIME-Version: 1.0\r\n";         $header .= "Content-Type: multipart/mixed; boundary=\"".$uid."\"\r\n\r\n";         $header .= "This is a multi-part message in MIME format.\r\n";         $header .= "--".$uid."\r\n";         $header .= "Content-type:text/html; charset=iso-8859-1\r\n";         $header .= "Content-Transfer-Encoding: 7bit\r\n\r\n";         $header .= $message."\r\n\r\n";         $header .= "--".$uid."\r\n";         $header .= "Content-Type: application/octet-stream; name=\"".$filename."\"\r\n"; // use different content types here         $header .= "Content-Transfer-Encoding: base64\r\n";         $header .= "Content-Disposition: attachment; filename=\"".$filename."\"\r\n\r\n";         $header .= $data."\r\n\r\n";         $header .= "--".$uid."--";         mail($mailto, $subject, "", $header);     }     ?>


Does loading of sub pages in menu cause load to the server?

I am working on a wp site where I need to manage 500s of child pages for a single page such as About menu can have more child pages need to manage those child pages as sub menu and I have more than 5 such menus. My client is saying that it will cause load to the server. Does this create a problem in server? If yes, is there any way to load the menu that will not cause any problem to the server. Thanks in advance...


Creating multiple pages

I have a few pages and I'm trying to import subpages into each like this:                wp_insert_post (       array(         'post_title' => $something,         'post_type' => 'page',         'post_author' => 1,         'post_status' => 'publish',         'post_parent' => array(17, 25, 27, 29)       )      );      So the structure should looks like:               first->imported_name     second->imported_name     ...      But this doesn't work, it creates only 1 subpage. Should I copy that code 5 times for 5 pages?


404 permalink errors on Pages only

I am having a strange issue with permalinks while using the `/%postname%/` structure. I can access my custom post types using the pretty permalink `localhost/cpu/<post-type>/<post-title>/` but I am getting a 404 error on Pages. The url of a page is `localhost/cpu/<page-title>/` My `.htaccess` file (generated automatically when saving permalinks):               # BEGIN WordPress     <IfModule mod_rewrite.c>     RewriteEngine On     RewriteBase /cpu/     RewriteRule ^index\.php$ - [L]     RewriteCond %{REQUEST_FILENAME} !-f     RewriteCond %{REQUEST_FILENAME} !-d     RewriteRule . /cpu/index.php [L]     </IfModule>          # END WordPress      My WordPress(version 3.4.2) installation is in a folder called `cpu`. I don't have any issues with the default permalink structure `url/?p=123`. The problem does not go away when I disable all plugins. Any possible solution? Is there a way to debug what's happening? **UPDATE:** Following _Code Monkey_ 's answer, I added the following to functions.php I changed the filter from `rewrite_rules_array` to `page_rewrite_rules` \- the WP_Rewrite Class reference suggests: > To filter the rewrite rules generated for your Pages, use > page_rewrite_rules. So, here's the code I added:               add_filter('page_rewrite_rules', 'rewrite_rules_array_filter_debug', 10000);          function rewrite_rules_array_filter_debug($rules){       echo '<pre>';         var_dump($rules);       echo '</pre>';       return $rules;     }      And the output from saving the post permalinks on `wp-admin/options- permalink.php`:               array(11) {       [".?.+?/attachment/([^/]+)/?$"]=>       string(32) "index.php?attachment=$matches[1]"       [".?.+?/attachment/([^/]+)/trackback/?$"]=>       string(37) "index.php?attachment=$matches[1]&tb=1"       [".?.+?/attachment/([^/]+)/feed/(feed|rdf|rss|rss2|atom)/?$"]=>       string(49) "index.php?attachment=$matches[1]&feed=$matches[2]"       [".?.+?/attachment/([^/]+)/(feed|rdf|rss|rss2|atom)/?$"]=>       string(49) "index.php?attachment=$matches[1]&feed=$matches[2]"       [".?.+?/attachment/([^/]+)/comment-page-([0-9]{1,})/?$"]=>       string(50) "index.php?attachment=$matches[1]&cpage=$matches[2]"       ["(.?.+?)/trackback/?$"]=>       string(35) "index.php?pagename=$matches[1]&tb=1"       ["(.?.+?)/feed/(feed|rdf|rss|rss2|atom)/?$"]=>       string(47) "index.php?pagename=$matches[1]&feed=$matches[2]"       ["(.?.+?)/(feed|rdf|rss|rss2|atom)/?$"]=>       string(47) "index.php?pagename=$matches[1]&feed=$matches[2]"       ["(.?.+?)/page/?([0-9]{1,})/?$"]=>       string(48) "index.php?pagename=$matches[1]&paged=$matches[2]"       ["(.?.+?)/comment-page-([0-9]{1,})/?$"]=>       string(48) "index.php?pagename=$matches[1]&cpage=$matches[2]"       ["(.?.+?)(/[0-9]+)?/?$"]=>       string(47) "index.php?pagename=$matches[1]&page=$matches[2]"     }      Anything wrong in it? **UPDATE 2:** I found my error when using `var_dump($wp);`. I got this response:                 ["query_string"]=>       string(25) "statut-membre=sample-page"       ["request"]=>       string(11) "sample-page"       ["matched_rule"]=>       string(10) "([^/]+)/?$"       ["matched_query"]=>       string(25) "statut-membre=sample-page"       ["did_permalink"]=>       bool(true)      Wordpress was querying a taxonomy called `statut-membre` while looking for my pages. I noticed I had an empty rewrite slug(`'rewrite' => array('slug' => ''),`) in that `register_taxonomy` function. I added a slug and resaved my permalink structure, now my I can access my pages. Now the query looks fine too:                 ["query_string"]=>       string(20) "pagename=sample-page"       ["request"]=>       string(11) "sample-page"       ["matched_rule"]=>       string(20) "(.?.+?)(/[0-9]+)?/?$"       ["matched_query"]=>       string(26) "pagename=sample-page&page="       ["did_permalink"]=>       bool(true)


Site admin in a network install can't edit users?

For the Stack Exchange Community Blogs, we have a network install that we've set up. I am being told that the site administrator role is not allowing an option for user editing. On the site's users page when hovering over a user, there is only an option for `delete`, not one for `edit`. The only option related to user permissions is the following, but not really what I'm going for here... ![add new users](http://i.stack.imgur.com/a8s0v.png) How can I enable the site administrator to have full control over the users on that specific site?


Post thumbnails not working in my new install of WP 3.1 with Twenty Ten theme

I am working in a new project, and I just realized that in the page/post edit pages, I don´t have the option to set a featured image/ post thumbnail. I have checked and Twenty Ten has thumbnails support by default ( add_theme_support( 'post-thumbnails' is in functions.php). I also tried setting the thumbnails size with set_post_thumbnail_size, but no luck. Any ideas? P.D: I installed this in a new server, is it possible that it has something to do with that? Are there any specific requirements to use post thumbnails?


adding a URL to a post meta

OK, a pretty dorky question, but I am new to PHP so bear with me. How would I add an a href link to the code below so the custom meta field is linked on the front-end?                 <?php if(get_post_meta($post->ID, "leetpress_website", true)) { ?>

Movie Website:       <?php echo get_post_meta($post->ID, "leetpress_website", true); ?>

     <?php } ?>      Thanks for putting up with my dorky-ness... UPDATE: Got it working! Thanks for the help pointing me in the right direction Bainternet!               <?php if(get_post_meta($post->ID, "leetpress_website", true)) { echo '

Movie Website:  ID, "leetpress_website", true).'" target="_blank">'.get_post_meta($post->ID, "leetpress_website", true).'

'; } ?>


Changing subdir multisite install to subdir core directory structure

Now that WordPress 3.5 is supposed to work with core files in subdirectory, I decided to move my local development setup (subdirectory multisite) to that configuration. Fast forward and what I have is following: `wordpress` (3.5 core) `wp-content` (content dir, configured via `WP_CONTENT_DIR` and `WP_CONTENT_URL`) `.htaccess` with:               RewriteEngine On     RewriteBase /     RewriteRule ^index\.php$ - [L]          # uploaded files     RewriteRule ^([_0-9a-zA-Z-]+/)?files/(.+) C:\server\www\dev\wordpress/wp-includes/ms-files.php?file=$2 [L]          # add a trailing slash to /wp-admin     RewriteRule ^([_0-9a-zA-Z-]+/)?wp-admin$ $1wp-admin/ [R=301,L]          RewriteCond %{REQUEST_FILENAME} -f [OR]     RewriteCond %{REQUEST_FILENAME} -d     RewriteRule ^ - [L]     RewriteRule ^([_0-9a-zA-Z-]+/)?(wp-(content|admin|includes).*) C:\server\www\dev\wordpress/$2 [L]     RewriteRule ^([_0-9a-zA-Z-]+/)?(.*\.php)$ C:\server\www\dev\wordpress/$2 [L]     RewriteRule . index.php [L]      `wp-config.php` with:               define('MULTISITE', true);     define('SUBDOMAIN_INSTALL', false);     define('DOMAIN_CURRENT_SITE', 'dev.rarst.net');     define('PATH_CURRENT_SITE', '/');     define('SITE_ID_CURRENT_SITE', 1);     define('BLOG_ID_CURRENT_SITE', 1);      `index.php` with:               define('WP_USE_THEMES', true);     require('./wordpress/wp-blog-header.php');      Status:   * network admin works at `/wordpress/wp-admin/network/` but all links try to point to `/wp-admin/network/` which errors `Forbidden` with `The given path was above the root path: AH00127: Cannot map GET /wp-admin/network/ HTTP/1.1 to file`   * root site works at `dev.rarst.net` with admin at `dev.rarst.net/wordpress/wp-admin`   * other subdir sites (`dev.rarst.net/*`) have broken uploads, and links to admin and stuff, hadn't got to them yet. The question in a nutshell - **in what direction do I need to move from here to get everything working?** What admin links are even supposed to be with this setup (since core is in "real" subdir and sites are in "virtual" subdirs)?


custom post type and custom taxonomy url conflict

I have custom post type called `paintings` and it has a custom taxonomy called `paintings_category`. Currently I have this situation:   * `example.com/paintings/` > A page using `page-paintings.php`   * `example.com/paintings_category/landscape/` > Lists all `landscape` items in `taxonomy.php`   * `example.com/paintings/landscape/painting-title/` > Displays single painting post types, eg. `single-paintings.php` If I try changing the slug as below, I get a 404 error on: `example.com/paintings/landscape/painting-title/`               register_taxonomy(          'paintings_category', array('paintings'),          array(              'hierarchical' => true,              'label' => 'Categories',              'singular_label' => 'Category',              'rewrite' => array( 'slug' => 'paintings' )         )     );      I'd like behaviour to be:   * `example.com/paintings/` > ideally list `paintings_category` as links   * `example.com/paintings/landscape/` > lists all items of `landscape` taxonomy   * `example.com/paintings/landscape/painting-title/` > displays single item Any thoughts on how I can achieve this? I tried adding `paintings` as a parent of `landscape` category in `paintings_category` but this still leaves me with a 404 on the single.


custom fields cannt be seen with version 3.1

I had a Theme that worked OK with ver 2.7. Now that I upgraded to 3.1; I cannot see the "custom fields" in the posts(may be hidden??). Can someone help.Thanks


Problem with comment box

The "Reply" option on the comment box is not working. Please let me know how to make that work? Note: I am able to reply on comments from admin area (wp->comments->...) but the site visitors are not able to reply. For example check this: www.linuxstall.com/linux-command-line-tips-that-every- linux-user-should-know/ Click on "Reply" there. You will not be able to reply to that comment. You can add new comment though but "reply" will not work. Let me know how to solve this issue. Thanks.


Ajax request sends url rather than data

I have a very weird error running on my plugin. I am currently developing a plugin that will allow the user to create routes and specific dates for the route. The dates are more or less tickets that can be purchased by the visitor. I am running ajax request for the data creation and removal of a date. The return of these ajax requests are HTML snippets that are used to update the table that shows the available dates for the route. When I create a route I get the proper HTML back and put it into the table via jQquery. However, when I run pretty much the same request to delete a row from the table I do not get the same result back. Instead of getting the HTML back I am getting the URL back of my website. I have looked everywhere and cannot find anything why this could happen. The codex says, that in term of an error I get -1 or 0 back. The ajax request works fine and the row gets deleted just as I request. I hope somebody could find the little devil who is preventing my code from being executed properly. Here are the following files: PHP: witchroute/index.php witchroute/wit_witchroute.class.php witchroute/wit_date.class.php HTML: witchroute/views/date-display.html witchroute/views/date-display- table.html witchroute/views/date-insert-form.html What you should know: The ajax remove request is located in the wit_witchroute.class.php in the constructor               add_action('wp_ajax_remove_date_from_route', function()                     {                         $wit_date = wit_date::getInstance();                         $wit_date->removeDate($_POST);                     });      the actual method is in the wit_date.class.php The jQuery request is started in the date-display.html with the following testing code:               jQuery(function() {             jQuery(".witchroute_delete_btn").click(function(){                      var id      =   jQuery(this).attr('date-id');                      var deleteData  = { id: id,                                       action: "remove_date_from_route",                                     security: '<?php print wp_create_nonce("adsfadsfasdfadsfd"); ?>'                                 };                      var r2 = jQuery.ajax({                     url: ajaxurl,                     type: "POST",                     data: deleteData,                     dataType: "html"                 });                      r2.done(function(msg) {                     //jQuery("#witchroute_date_display_body").html(msg);                     alert(msg);                 });              });              });      Please not, that I am fairly new to the plugin development. I havent done any form validation yet as I am still testing, so please dont comment on that. However, if you had some tips for structuring or so I would appreciate any help- that might even help solving my problem ? I am looking forward to your help and hope somebody can see what I cannot see :) All the best, Richard


Is it possible to remove the "standard" post format?

I'm using post formats heavily on a project, but have no current need for the standard option. Beyond being an unnecessary bit of UI, it actually causes broken behavior if it does get mistakenly selected. I might, with some convoluted logic, be able to set up a template for Standard that properly handles the incoming content of other formats, but all that would really do is hide the fact the posts are assigned incorrectly, making them even harder to hunt down. (And this workaround may or may not always be viable.) The real problem is that the radio button just shouldn't be there. The only option I've seen for removing format support in any way is `remove_theme_support('post-formats')` which kills the feature altogether. I just want that one option gone.


Deleting first four characters from all Post Titles

I have a wordpress autoblog.. I need to delete first four characters from each single post title automatically.. How can I achieve it?


How can I add text on top of slideshow?

I would like to add text on top of the slide show of the following theme: http://themeforest.net/item/newcastle-a-woocommerce-powered-wordpress- theme/full_screen_preview/3887883 The home page is a specific template and writing on the home page template adds text below the slideshow as opposed to above. I would like to have text above and below. How do you recommend doing this?


Video playing from featured image?

If I embed a YouTube video into a post, how do I put a play button over the featured image so that the video can be played without having to open the whole post? I.e Flipboard the iOS app has a function which allows you to watch videos from the featured image stage.


Grey out nav buttons unless is_user_logged_in()

I'd like to show my users some features I offer if they register in a special nav bar. I've created this for a logged in version and a logged out version:               if ( is_user_logged_in() ) {         $menu = wp_nav_menu( array( 'theme_location' => 'logged-in-menu', 'container' => '0', 'fallback_cb' => 'wp_page_menu', 'echo' => '0' ) );         echo $menu;         } else {         $menu = wp_nav_menu( array( 'theme_location' => 'main-menu', 'container' => '0', 'fallback_cb' => 'wp_page_menu', 'echo' => '0' ) );         ?>          <style>#menu-item-1046{opacity : 0.4; filter: alpha(opacity=40);}</style>         <?php         echo $menu;     }      I'm trying to grey out (disable but leave visible) nav buttons by ID. Obviously my CSS in there works but doesn't disable the button... I tried `<script>$('#menu-item-1046').button('disable');</script>` But I've barely dabbled in jQuery as of now.


How to bypass the username as a required field in registration and just use email address instead?

Is there a clean way of doing so? I would prefer doing that in functions.php using some action and/ or filter hooks. The 2nd-best option would be using some good plugin out there. (I haven't seen 1 suitable though) I can always generate random and unique strings to be usernames in the registration forms and just hide it with CSS. I would imagine meddling with wp-login.php but that would be so ugly. I am able to let users log in using email address and password, but not username now, partly referencing this. However, username still appears as a required field on the registration page which confuses people. **Updates**   I've found that Register Plus Redux handles the login using email address instead of username well. However, I need to be able to modify the labels and texts on the registration page too (I need to put in Thai). It looks like there's no clean way but one will have to edit the codes in the plugins directly


Ordering posts by custom taxonomy in admin area

**EDIT** @kaiser - this question is slightly different to the answer you posted in that I am talking about sorting by clicking the column title rather than adding a dropdown to filter by taxonomy term (which you'll see I've already done in the screenshot). Like Otto says in the answer Milo linked to: 'it is not possible to order by taxonomy, because from a certain type of standpoint, that doesn't actually make much sense...the point of having a taxonomy on posts would really be to have terms in that taxonomy that are shared between posts'. I see his point, as you can have multiple terms attached to a post, sorting by them is a bit pointless. I've decided to scrap the idea, so feel free to delete this post if it's of no use. Thanks. **ENDEDIT** Been scouring the net for the solution to this, but not finding the specific answer to my issue. I've registered a custom post type and a couple of custom taxonomies, but I'm trying to allow admins to _sort_ posts by a taxonomy, just like you can with the Date column - see screenshot here: ![enter image description here](http://i.stack.imgur.com/wWF0N.png) Does anyone know how to do that? Here's how I'm registering the custom post type if it's of any use:               Class OSUFestivals         {             public static function init()             {                 add_action( "init", array( __CLASS__, "register_directory_cpt" ) );                 add_action( "init", array( __CLASS__, "register_workshop_type_taxonomy" ) );                 add_action( "init", array( __CLASS__, "register_day_taxonomy" ) );             }                  public static function register_directory_cpt()             {                 $labels = array(                     'name'               => 'Festival Items',                     'singular_name'      => 'Festival Item',                     'menu_name'          => 'Festival',                     'name_admin_bar'     => 'Festival Item',                     'add_new'            => 'Add New Item',                     'add_new_item'       => 'Add New Item',                     'new_item'           => 'New Item',                     'edit_item'          => 'Edit Item',                     'view_item'          => 'View Item',                     'all_items'          => 'All Items',                     'search_items'       => 'Search Items',                     'parent_item_colon'  => 'Parent Items:',                     'not_found'          => 'No Items found.',                     'not_found_in_trash' => 'No Items found in Trash.',                 );                 $args = array(                     'labels'        => $labels,                     'public'        => true,                     'hierarchical'  => false,                     'has_archive'   => true,                     'show_in_admin_bar' => true,                     'menu_position' => 5,                     'supports'      => array( 'title', 'editor', 'thumbnail', 'author', 'excerpt', 'revisions', 'page-attributes' ),                     'rewrite'       => array(                         'with_front'    => false,                         'slug'          => 'festival-Items'                     )                 );                      register_post_type( 'lkfestival', $args );             }                  public static function register_workshop_type_taxonomy()             {                 $labels = array(                     'name'                      => 'Workshop types',                     'singular_name'             => 'Workshop type',                     'search_items'              => 'Search workshop types',                     'all_items'                 => 'All workshop types',                     'parent_item'               => 'Parent workshop type',                     'edit_item'                 => 'Edit workshop type',                     'update_item'               => 'Update workshop type',                     'add_new_item'              => 'Add new workshop type',                     'new_item_name'             => 'New workshop type',                     'choose_from_most_used'     => 'Choose from most used workshop types'                 );                      $args = array(                     'hierarchical'      => true,                     'labels'            => $labels,                     'show_admin_column' => true,                     'rewrite'           => array( 'slug' => 'event-type' ),                     'capabilities'      => array (                         /* Only let Andrea assign workshop types */                         'manage_terms'  => 'manage_options', // by default only admin                         'edit_terms'    => 'manage_options',                         'delete_terms'  => 'manage_options',                         'assign_terms'  => 'edit_posts'  // means administrator', 'editor', 'author', 'contributor'                     )                 );                      register_taxonomy( 'lktypes', 'lkfestival', $args );             }                  public static function register_day_taxonomy()             {                 $labels = array(                     'name'                      => 'Festival days',                     'singular_name'             => 'Festival day',                     'search_items'              => 'Search festival days',                     'all_items'                 => 'All festival days',                     'parent_item'               => 'Parent festival day',                     'edit_item'                 => 'Edit festival day',                     'update_item'               => 'Update festival day',                     'add_new_item'              => 'Add new festival day',                     'new_item_name'             => 'New festival day',                     'choose_from_most_used'     => 'Choose from most used festival days'                 );                      $args = array(                     'hierarchical'      => true,                     'labels'            => $labels,                     'show_admin_column' => true,                     'rewrite'           => array( 'slug' => 'day' ),                     'capabilities'      => array (                         /* Only let Andrea assign festival days */                         'manage_terms'  => 'manage_options', // by default only admin                         'edit_terms'    => 'manage_options',                         'delete_terms'  => 'manage_options',                         'assign_terms'  => 'edit_posts'  // means administrator', 'editor', 'author', 'contributor'                     )                 );                      register_taxonomy( 'lkdays', 'lkfestival', $args );             }              }              // Load Class         OSUFestivals::init();      I thought the 'sort' parameter in `register_taxonomy()` would allow sorting, but it looks like that's related to the order in which terms are added to objects.


has_term() does not return when term is assigned post?

Ok, I have an archive loop. In this loop I have this...               <?php if ( has_term('race') ) { ?>        <?php the_title($event); ?>     <?php } ?>      But it does no show whats anything!? And I have these terms assigned to the post...   * Tax: report-type Term: race   * Tax: season-year Term: motogp-2013 My question is why does this not return nothing? Or what function should I be using to display something (in the loop) if the post has the term assigned to it? Weirdly this works...               <?php if ( has_term('race', 'report-type', $post->ID )) { ?>


Custom Field Search

I'm trying to create a custom search form that searches a custom post type that I have created. The form would need to search two custom taxonomies (similar to tags and categories) and the body text of the post. There would be a search input that would search the body text and tags and a dropdown that would filter by category (Any, Category 1, Category 2, Category 3). What kind of templates would I need to make and what kind of code would this require? Thanks a ton!


DataTables plugin, javascript not working

The javascript (sorting, number of rows, paging) is not working although i have datatables js options enabled in the tablepress plugin. The console does not show any error (like unknown datatables()). Here is the page Here is my setting:               · Website: http://koerner.li/wordpress     · TablePress: 1.0     · TablePress (DB): 18     · TablePress table scheme: 3     · Plugin instal          led: 2013/07/24 10:00:46     · WordPress: 3.6     · Multisite: no     · PHP: 5.4.23     · mySQL (Server): 5.1.72-log     · mySQL (Client): 5.1.72     · ZIP support: yes     · UTF-8 conversion: yes     · WP Memory Limit: 40M     · Server Memory Limit: 256M     · Magic Quotes: off     · WP_DEBUG: false


Wordpress working only in directory named "wordpress"

I have this strange problem. Can't get wordpress running in any sub directory except domain.com/wordpress. Files are clean wordpress download and working on other hosting (tested). Any recomendations? edit: wordpress gives "white screen of death" when moved to other than domain.com/wordpress directory, except root (domain.com)


get_template_directory adding FTP root folders in urls

I am creating a theme, and now I am adding some functionality for my custom post type, such as different metaboxes in post page, extra post config page. It seems when I try to get the sites theme directory so I can enqueue a custom css file and php file for the seperate post page I am getting FTP root folders in the url, causing it to 404. Here is the way I am adding it. I have a seperate file with all of the custom post type functions in it, and I am adding it as a dependency through my functions.php. I wanted to go with the separate file, for neatness so I don't have a million functions in my functions.php. I also have a css file in a folder inside of my includes dir. The CSS is for the backend, for the custom post pages in the admin. EDIT: I just checked and it adds the FTP root info even if I manually add the path instead of a function(get_template_directory()), now this really confuses me as all of the functions anywhere else work fine, just in this file with the post_type functions. I have other post_type functions in my functions.php folder and they work fine too. Anyone care to lend a brain? When using get_template_directory() :               wp_register_style('PostTypeStyleSheet', get_template_directory() . '/inc/post-types-functions/css/cpadminstyles.css');     wp_enqueue_style( 'PostTypeStyleSheet');      I get a url like this back:               Failed to load resource: the server responded with a status of 404 (Not Found) http://mythemesite.com/home2/jname/public_html/sandbox/wp-content/themes/mytheme/inc/post-types-functions/css/cpadminstyles.css?ver=3.5.1      I am not sure why this is happening, I use get_template_directory() almost everywhere else and do not have this issue. Can anyone tell me why it could be happening?


Amazon S3 + Cloudfront with Wordpress

I put together a wordpress site on a heroku free instance and I'm making all images to go to an S3 bucket and a Cloudfront distribution with this plugin . The thing is, it only uploads the images to S3 and serves them with the proper CNAME I set up. What I want is to serve the wp-content (all my plugins and themes) through S3. I know it's possible because I've read about it, but all tutorials around are explaining the Origin pull and not this configuration. Can anyone tell me more about how can I achieve this? Thank you!!


Get posts that have been read by logged in users

I am using buddypress. I want to know what posts each user has read, and show a list of read and unread post for users. I don't know how to do this. Should I be using custom fields, via `add_user meta`? What do you think is the best way?


wp_mail file attachment not being placed in upload folder?

I have a form where I want users to be able to select an image to upload. The image gets temporarily uploaded to the wp-content/uploads folder, is attached to the e-mail and then is destroyed. Right now, the form is submitting and I can see that the image is being processed in the response headers, but there is no image included in the e-mail and there is no image file in the uploads folder. Does anyone see any issues with this code? Here's the form:               <form id="shareForm" action="<?php echo get_template_directory_uri(); ?>/library/file-form.php" method="post" enctype="multipart/form-data">         <input type="text" id="name" name="name" placeholder="Name" />         <textarea rows="4" cols="50" name="message" id="message" placeholder="Message"></textarea>         <input type="file" id="photo" name="photo" class="upload">         <input type="submit" name="submit" value="Submit">     </form>      And here's my PHP mail script:               <?php         require( '../../../../wp-load.php' );          if(isset($_POST["name"])){              $name = $_POST["name"];         $message = $_POST["message"];              $fName = str_replace(array(' ', ',', '\'' ), '-');              $date = new DateTime(null, new DateTimeZone('America/Chicago'));         $myDate = $date->format("m/d/Y H:i");         $fileDate = $date->format("m-d-Y");         $homeUrl = home_url('/');              if($_FILES["file"]["type"] != ""){                  $allowedExts = array("jpg", "png", "gif");             $extension = end(explode(".", $_FILES["file"]["name"]));             $newFileName = $fName . $fileDate."." .$extension;                  if ($_FILES["file"]["error"] > 0) {                 $myPath =  $homeUrl . 'share/?upload=error';                 wp_redirect($myPath); exit;                       } else {                 move_uploaded_file($_FILES["file"]["tmp_name"], WP_CONTENT_DIR . "/uploads/user-submitted/" . $newFileName);             }              }              $to = 'my@email.com';         $subject = $fName . " submitted a photo";              $message = "Date: " . $myDate . " EST \n";         $message .= "Message:  " .$message. "\n";              $attachments = array(WP_CONTENT_DIR . "/uploads/user-submitted/".$newFileName);          $headers[] = 'From: Photo Submissions <my@email.com>';              wp_mail( $to, $subject, $message, $headers, $attachments);              unlink(WP_CONTENT_DIR . "/uploads/user-submitted/" . $newFileName);              $myPath =  $homeUrl . 'share/?upload=success';         wp_redirect($myPath);          exit;             }          ?>


I do not want my front page sticky post to show up in a category

I have a welcome paragraph on me front page. I did this using sticky post. But the welcome to my website sticky post also shows in my category? Is there a way to have it show on the front page only?


modify default HAVE_POSTS() Loop without inserting new variable (i.e. $loop->HAVE_POSTS)

i want to modify               while ( have_posts() ) : the_post();      the default way is:               $loop = new WP_Query($args);     while ( $loop->have_posts() ) : $loop->the_post();      but i dont want to insert a new $loop variable, but want to have still `while ( have_posts() ) : the_post();` with modified parameters. how to do that?


Pre-Populate $wp_query settings with custom rewrite rules and custom template_redirect

I'm currently working on a file browser plugin which requires frontend editing capabilities for a registered user. For this scenario, I have registered some custom rewrite rules for my custom post type. ## Rewrite Analyzer ![Rewrite Analyzer Window](http://i.stack.imgur.com/rRhSC.png) As you can see in the screenshot above, the plugin has a basic CRUD interface for managing the downloads. The routing is made through the `template_redirect` hook, which checks if the query variable `action` is set and then make a call to the appropriate action method.               add_action('template_redirect', array($this, '_requestHandler'), 9);     // ...     public function _requestHandler() {         try {             $requestedPage = get_query_var('pagename');                  if((isset($requestedPage) && $requestedPage == 'webeo-download')) {                 $action = get_query_var('action');                 $this->action = (isset($action)) ? $action : null;                      $downloadId = get_query_var('download');                 $this->downloadId = (isset($downloadId)) ? (int) $downloadId : null;                      if(isset($this->action) && !is_null($this->action) && strlen($this->action) > 0) {                     $method = 'action' . ucfirst($this->action);                          if(method_exists($this, $method)) {                         call_user_func(array($this, $method));                     } else {                         throw new Webeo_Exception(sprintf(__('Action method <code>%s</code> does not exists.', WEBEO_DOWNLOAD_TEXTDOMAIN), $method));                     }                 } else {                     $this->actionIndex();                 }                      echo $this->view->render($this->view->viewTemplate);                 exit();             }         } catch (Webeo_Exception $e) {             $this->view->assign('error', $e);             echo $this->view->render('default.phtml');             exit();         }     }      This works really well, except one thing. I wanted to prevent WordPress from generating any default rewrite rules for my custom post type. Access to my posts from outside should also be restricted. Only my controller above should be responsible to serve any download data to the user. To do this, I have set the arguments `public` and `publicly_queryable` to false inside the `register_post_type` function. I've also set the argument `exclude_from_search` to `true`. This seems to work. No post is showing under the default rewrite rule (e.g. `example.com/downloads/<postname>`) nor is a download listed in the default search results. Unfortunately the `$wp_query` arguments are also not set anymore. Therefore I'm not able to use `comments_template()` or any other loop-function inside my templates. It's clear: WordPress doesn't know my page structure and is not able to generate the correct settings. I've tried to manually pre-populate the `$wp_query` arguments before the redirect inside the `template_redirect` method. But this doesn't seem to work. I'm probably to late in the chain.               global $wp_query, $post, $withcomments;     $wp_query->is_single = true;     $wp_query->is_page = true;     $post = get_post($this->downloadId);     $withcomments = true;     wp_reset_query();      Any suggestions? Thanks in advance Roman


How to add search form in main page body?

I'm fairly new to wordpress. I'm trying to develop a website with search option to find available room information. I would like to add a search box where people would be able to enter their information and hit the Search button. Then it'll display the available rooms. Something like the below website http://www.easytobook.com/?amu=1972100201 If it's a duplicate question please accept my apologies. Thanks.


Crop image sizes directly from Media Library across network (not attached to post or page but sidebar)

I have a MU network setup and I'm pulling in media library images and displaying 4 of those images randomly from across the entire network. I've seen a few people on here using similar codes to do the same thing, my questions is: **How do I crop images pulled directly from the media library dynamically?** Currently the code works however it merely scales the image size and on right click > view image it shows the image in full size and not as a cropped thumbnail etc. This obviously boosts the page size if each image is 5mb (x4 = 20mb) which is unnecessary, here is the code:               function get_images_from_media_library() {         $args = array(             'post_type' => 'attachment',             'post_mime_type' =>'image',             'post_status' => 'inherit',             'posts_per_page' => 4,             'orderby' => 'rand'             );         $query_images = new WP_Query( $args );         $images = array();         foreach ( $query_images->posts as $image) {             $images[]= $image->guid;         }         return $images;     }          function display_images_from_media_library() {         $imgs = get_images_from_media_library();         $html = '
';         $html .= '
Oriel / Gallery
';         foreach($imgs as $img) {             $html .= '';         }         $html .= '
Weld mwy o / View more
';         $html .= '
';         return $html;     }      Any help or suggestions would be much appreciated.


Recents posts pulling from different post type

This blog page is pulling from a Page Template called full-width-blog.php. The left of the content is where the supposed general posts should appear. On the right is the sidebar. How could you make the main left area pulling from Recent Articles and not from Testimonials? See image for an example: http://i.imgur.com/gVsnb.png full-width-blog: http://pastebin.com/R6BD1R8u


Find first image on paginated post for Pinterest

I've been looking for days, yet can't find a good answer. Perhaps the SE crowd can be of assistance. Any help is much appreciated. I am using a custom-coded pinterest button included on posts that pulls the first image of the post OR the featured image (if exists).               <a href="http://pinterest.com/pin/create/button/?url=<?php echo urlencode(get_permalink($post->ID)); ?>&media=<?php      if ( (! has_post_thumbnail()) || ($paged != 0) ) {      echo catch_that_image();     } else {      // Has featured img     $image = wp_get_attachment_image_src( get_post_thumbnail_id( $post->ID ), 'medium' );     echo $image[0];      }      ?>&description=<?php the_title(); ?>" class="pin-it-button" count-layout="horizontal">Pin It      Now, the function that fetches the first image of a post looks as follows:               function catch_that_image() {     global $post, $posts;     $first_img = '';     ob_start();     ob_end_clean();     $output = preg_match_all('//i', $post->post_content, $matches);     $first_img = $matches [1] [0];          if(empty($first_img)){ //Defines a default image     $first_img = "http://static.purseblog.com/default.jpg";     }     return $first_img;     }      Any idea how to modify the catch_that_image function to take into account the pagination and find the first image on the current page a user browses? I'd like to then send the URL to pinterest for more accurate pinning. Thanks so much in advance.


Switching database on the fly

I have read here about switching the current wp database on the fly using               $wpdb->select('database_name');      Once done, I understand that i will have to issue the same statement to the original database. Questions:   * Right after changing the database, do i need to flush caches or similar stuff to get things working properly? Will I need to call again WP header?   * Potential issues?


How do I turn off wordpress comments ability to capture a users ip address?

Going through the comments table on my wordpress site, I noticed that wordpress is storing the ip address of everyone who makes a comment on my site. How do I remove this functionality? I'm not just talking about the display of the ip in the template, I mean I don't want wordpress to capture it in the first place.


Randomise results from a category page?

I have my standard category page. On this page, I'd like to put a button which, when clicked, randomises the results shown on the category page. I know I could make a rand-category.php page and send the user on to that page. Ideally though, I'd like a more elegant solution, possibly something that refreshes the results without moving the user on/away from the page.


Featured image loads correctly while gallery images returns 404

I can't get why the featured image is loading correctly while those in the gallery returns a 404 if the links is to the attachment page. If i link to the file, the file is shown but if activate the "jQuery lightbox for native galleries" plugin, they won't load anymore. I tried deleting the .htaccess file to force the creation of a new one entering in the permalinks option page but nothing is changed.


how to show a category from a CPT?

I have a custom post type called 'seasons' and in there i have 3 categories (summer,winter and spring.) I want to show 10 random post from the winter category on a page. Please help.


Cron job to call php to email last 24 hours posts

We have been trying to call via CronJob a PHP script that will email the past 24 hours posts using the `'post_type' = 'reservations'` filter.               <?php       query_posts( array( 'post_type' => 'reservations', 'showposts' => 10 ) );       if ( have_posts() ) : while ( have_posts() ) : the_post();     ?>     <?php _res_name; ?>          <?php endwhile; endif; wp_reset_query(); ?>      I know this is wrong but for the life of me I cannot get my head round the sequence for this. Any advice?


Posting error with P2 theme

I'm getting the error: "Whoops! Looks like you are not connected to the server. P2 could not connect with WordPress." when trying to reply to comments/posts on P2, I'm on v1.5.2 Anything I can do to fix this?


Pull the content out of a page

I wanna pull the data from this area "see the red area on the image below" ![enter image description here](http://i.stack.imgur.com/CQXVs.jpg) Out to a specific template I have a page template named page.php
             <?php while ( have_posts() ) : the_post(); ?>                 <?php get_template_part( 'content', 'page' ); ?>                 <?php comments_template( '', false ); ?>             <?php endwhile; // end of the loop. ?>

      but this just send me a comment field.. i need the text in the page and i need the header


How to resize images due to container width automatically server side/without CSS

Does anyone know how to resize the served images, so the image has a width due to the content containers width. I do not mean to resize the image via 100% width css, but instead resize the actual dimensions and size if the image itself. For e.g.: An image in an article which has the dimensions of `400px × 300px`. But in the overview I only need `200px × 150px`. But I do not want to edit every part of my theme to do so, because there are a lot of different sizes. Is there any possibility that this works automatically?


How do I know what variables are passed in a filter/action and what their meaning is?

Something I have seen several times now and I don't understand is the following: In a theme's `functions.php` a function is defined and then attached to a hook, like so (simplified example):               function do_stuff($a, $b) {         // Do stuff with $a and $b     }     add_filter( 'bloginfo_url', 'do_stuff', 10, 2 );      Basically I think I understand whats happening there, but how do I know what `$a`and `$b`is?   In a "traditional" PHP way, one would call the function maybe like that:               do_stuff("var a content", $var_b_content);      Then its clear what `$a`and `$b` contain, but how can I know that with Wordpress? Real life example, take the following function (credit to Frank Bültge):               if ( ! function_exists( 'fb_css_cache_buster' ) ) {             function fb_css_cache_buster( $info, $show ) {                     if ( ! isset($pieces[1]) )                             $pieces[1] = '';                     if ( 'stylesheet_url' == $show ) {                                  // Is there already a querystring? If so, add to the end of that.                             if ( strpos($pieces[1], '?' ) === FALSE ) {                                     return $info . "?" . filemtime( WP_CONTENT_DIR . $pieces[1] );                             } else {                                     $morsels = explode( "?", $pieces[1] );                                     return $info . "&" . filemtime( WP_CONTENT_DIR . $morsles[1] );                             }                     } else {                             return $info;                     }             }                  add_filter( 'bloginfo_url', 'fb_css_cache_buster', 9999, 2 );     }      The function can be used for CSS versioning by attaching the date of the last change (using `filemtime`) as querystring to the CSS call. You can see, the uses `$info` and `$show` as variables that are passed to that function. But how can I know what these variables contain? He even uses these variables in conditional logic (`'stylesheet_url' == $show`) so somehow there something must be passed automatically?


I don't have comments.php... how do I customize my comment fields

My page in question is here. I have tried to add a `comments.php` to my custom theme so I can remove the website field and so I could edit the default values of the fields and remove the labels. When I add a `comments.php` all of my comments disappear and the comments are no longer functional. I have no idea how to make these modifications. I've tried editing `comments-template.php` but removing the field in that file doesn't remove it from the site, I am assuming because it is already in the database. I am new to PHP so any details on how I can get these text fields edited would be great.


Recent comments per tagged post?

Could you please help me with some code to get all recent comments for posts that are tagged with for example "XYZ"? Thanks in advance, you guys are great!


How to have different header.php based on the user logged in?

I’ve a created wordpress membership site using wishlist member plugin. But I want to have different `header.php` based on different logins. Eg: Users are: Print, Web and Free   1. When Free user logs in – I want `header1.php` to load and stay till he logs out    2. When Print user logs in – I want `header2.php` to load and stay till he logs out    3. When Web user logs in – I want `header3.php` to load and stay till he logs out If nobody has logged in the default `header.php` stays. Please assist on how to do this. Regards, Raghav.


why does get_option( 'home' ) not work while using in plugin

I'm working on a wordpress plugin and am running into an inssue with `get_option( 'home' )`. What I'm trying to do: if the user (or admin) is not logged in then a login form will appear on a custom page I've built (from the plugin). I had tried doing this from scratch but everything I was finding was telling how to do it from in the root theme folder... if anyone can help me do this (from scratch) from within a plugin I'm willing to try! Here is my source code...               <?php get_header(); ?>

                     <?php if ( is_user_logged_in()) { ?>                       <?php } else { ?>                                                             <form name="loginform" id="login_form" class="login_form wpcf7-form" action="<?php get_option( 'home' ); ?>/wp-login.php" method="post">
                             <input type="text" name="log" id="user_login" class="input" placeholder="Username" />

                             <input type="password" name="pwd" id="user_pass" class="input" placeholder="Password" />
                              <button name="wp-submit" id="wp-submit" class="btn wpcf7-submit"><?php _e("Sign in", "shorti"); ?></button>                          </form>                                           <?php } ?>

          <?php get_footer(); ?>      This is from a custom page template file that the plugin has created. The problem I'm having is when I go to sign in I'm redirected to a 404 error page saying, "url can't be found"... the reason for this is that it's only looking for `/wp-login.php`. I'm new to working with plugins... so it might be just a simple path defining issue or something noobish like that. My plugin folder looks something like this: photo-uploadr (main folder)/photo- uploadr.php (main file)/templates (secondary folder)/custom-uploadr.php (file with issue) Thanks & if you see anything that might not be best practice, let me know. ;)


Set posts of a custom post type to be private by default?

Say I created a custom post type called 'Private Posts' (`$post_type` = `itsme_private_posts`) and want all posts under the custom post type to be set to 'Private' automatically when published i.e. by default. How do I do it? Based on @brasofilo's answer to a related question on StackOverflow, I tried this:               add_filter( 'wp_insert_post_data', 'itsme_cpt_private', '99', 2 );     function itsme_cpt_private( $data , $postarr ) {         if( $postarr['post_type'] == 'itsme_private_posts' ) {             $data['post_status'] = 'private';         }         return $data;     }      It doesn't work i.e. it doesn't do anything; everything's the way it was before adding the function. It's as though the function doesn't exist or simply does nothing. Then, based on this article titled, "Force custom post type to be private", I tried this:               add_filter( 'wp_insert_post_data', 'itsme_cpt_private' );     function itsme_cpt_private( $post ) {         if( $post['post_type'] == 'itsme_private_posts' ) {             $post['post_status'] = 'private';         }         return $post;     }      It works, in that, when I publish or update a post it turns private. Good! But when I create a new post ('Add New') and leave without doing anything, it creates a 'private' (auto-)draft and saves it. Moreover I can't even trash that thing! Essentially I can't figure out how to do it. So, how do I set posts of a custom post type to be private by default?


I'm trying to insert Highcharts JS into one of my blog posts. Inserting the code into the text view didn't work and seemed messy anyway. I've also tried using `wp_register_script()` and `wp_enqueue_script()` in functions.php               global $post;     if( is_page() || is_single() )         {             switch($post->post_name)              {                 case 'test-post':                     wp_register_script( 'charts', get_template_directory_uri() . '/js/standalone-framework.js', array('jquery'));                     wp_enqueue_script('charts');                     wp_register_script( 'mychart', get_template_directory_uri() . '/js/my-chart.js', array('jquery'));                     wp_enqueue_script('mychart');      Using `is_page()` in header.php to create an if statement to output the script tags.               <?php if ( is_page('test-post')) { ?>         <script type='text/javascript' src="<?php bloginfo('template_directory'); ?>/js/standalone-framework.js"></script>         <script type='text/javascript' src="<?php bloginfo('template_directory'); ?>/js/my-chart.js"></script>     <?php } ?>      Finally I tried using custom fields without much luck either. What's the most efficient way to include this javascript in only a single post? There are lots of questions and answers with many being fairly old now.


Retrieve Array from within Array

I have an array being created within another array in Wordpress and I need to get the ID value from each Array. This is the code I am using to pull the array               <?php $pages = get_field('products');     get_field('product_id', $pages->ID); ?>      If I use `print_r($pages)` I get the following output:               Array     (         [0] => Array             (                 [product_id] => WP_Post Object                     (                         [ID] => 35238                         [post_author] => 13                         [post_date] => 2014-06-05 15:33:27                         [post_date_gmt] => 2014-06-05 15:33:27                         [post_content] => 40G parallel optics transceivers (40GBASE-SR4) ...                         [post_title] => 40G QSFP+ (MTP/MPO) to 4x10G SFP+ (8xLC) Assembly                          [post_excerpt] =>                          [post_status] => publish                         [comment_status] => closed                         [ping_status] => closed                         [post_password] =>                          [post_name] => 40g-qsfp-mpomtp-4x10g-sfp-8xlc-assembly                         [to_ping] =>                          [pinged] =>                          [post_modified] => 2014-07-01 08:34:38                         [post_modified_gmt] => 2014-07-01 08:34:38                         [post_content_filtered] =>                          [post_parent] => 36259                         [guid] => http://www.fibrefab.com/?page_id=35238                         [menu_order] => 0                         [post_type] => page                         [post_mime_type] =>                          [comment_count] => 0                         [filter] => raw                     )                  )              [1] => Array             (                 [product_id] => WP_Post Object                     (                         [ID] => 34484                         [post_author] => 13                         [post_date] => 2014-06-05 15:16:04                         [post_date_gmt] => 2014-06-05 15:16:04                         [post_content] => MTP/MPO QSFP+ trunk/ patchcord assemblies are ...                         [post_title] => 40G QSFP+ (MTP/MPO) to QSFP+ Assembly                         [post_excerpt] =>                          [post_status] => publish                         [comment_status] => closed                         [ping_status] => closed                         [post_password] =>                          [post_name] => mtpmpo-microcable-qsfp-40gb-trunk-patchcord-assembly                         [to_ping] =>                          [pinged] =>                          [post_modified] => 2014-07-01 08:34:24                         [post_modified_gmt] => 2014-07-01 08:34:24                         [post_content_filtered] =>                          [post_parent] => 36259                         [guid] => http://www.fibrefab.com/?page_id=34484                         [menu_order] => 0                         [post_type] => page                         [post_mime_type] =>                          [comment_count] => 0                         [filter] => raw                     )                  )          )      How I display the [ID] from each of these arrays?


Custom Fields and performance

My question : how many custom fields or even taxonomies WordPress can handle without affecting performance? The reason I ask, is because I started building a custom theme and I might need to have around 10 to 20 custom fields, and thinking if this will affect the speed of the site. I understand that speed also depends on server/hosting and number of visits, cache techniques, etc... I also expect that a post with one custom field will be faster then one post with ten custom fields. But, let's say a site that haves around 10,000 visits a day with a post with one custom field will the speed difference be much more different from a site with the same 10 000 visits a day with a post with 10 custom fields. Just trying to figure it out how much of a difference a custom field can make. Also in terms of custom searching using wp_query and custom fields parameters will the speed be affected. Thank you.


Best Way to Upgrade from WP 2.8 (!)?

I offered a friend to help translate from English some parts of his (mostly) Hebrew install. Then he told me two things: 1) That he's running 2.8 (he was worried about updating because he didn't want the design to break) and 2) That he has reason to suspect that the site is infected with a trojan horse since it gets blocked by some antiviruses. 1) What is the best way to go about upgrading? is it even feasible to start on a fresh installation and still have everything intact? including redirects? or will I have to go about it as per WP's documentation: step by step upgrading. 2) What can be done about the trojan horse? this is why I'm contemplating a fresh install, which I know is probably not recommended. Thank you in advance


Upgrading from 3.4.2

I recently took on a new client who runs a fairly active news site powered by WordPress. Part of what he wishes me to do is upgrade his WordPress version, something he's neglected to do since 3.4.2, my question is now: Would it be feasible to upgrade to 3.8.1 straight away or should I opt for taking it in small steps (start by upgrading to 3.5, then 3.6 etc.)? What would be appropriate security measures to take to prevent loss of data when doing this? I reckon problems will arise with the active plugins and his current theme so will I need to do a full backup of all files a database dump or will less suffice? Thanks in advance


sub CPT and CRUD

I need to create a child CPT for a parent CPT and display CRUD for the child CPT in a metabox of the parent CPT 'create post page'. For example: Suppose a vendor have different products. I need to display related product CRUD feature right under VENDOR creation page in a metabox. I don't want to use any plugin. Is there any wp way to do it? I can create hidden post type + meta and display them in metabox. Mostly I need the CRUD functionality like wordpress's **_view all post_** page. Can you please give me some hints?


How to migrate a database from a server to another

I try the export method of phpmyadmin, but the user is exported with the data... so there is no way to re import it into another database without error message. The old user is name : oldserver_username, and the new server user is called : some_text_server_name_new_user So there is NO WAY i can have the same username to export-import... how can i export and re import without having to have username check or bypass that ? i am completely lost in MySQL !


Custom permalinks - post type - hierarchical taxonomy's

I did folowed the steps / solution from Jeff it helped me alot with he's settings, got it for about 90% working properly. But getting stuck on the post / postname. It loads now the producten/%taxonomy_products%/ without the 404 errors. But when i click further on a post i get the 404 errors again. Maybe you can see what i'am doing wrong? **Custom post type and taxonomy settings 'Sorry for the dutch words' :**                   add_action( 'init', 'products_taxonomy_options' );     function products_taxonomy_options() {          //=============== Register custom post type - PRODUCTS ================          register_post_type('products',       array( 'label'                    => __('Producten'), // Postype              'labels'                   => array( 'name'                => __('Producten'),                                                   'singular_name'       => __('Producten'),                                                   'add_new'             => __('Product toevoegen'),                                                   'add_new_item'        => __('Nieuw product'),                                                   'edit_item'           => __('Wijzig product'),                                                   'new_item'            => __('Nieuw product'),                                                   'all_items'           => __('Alle producten'),                                                   'view_item'           => __('Bekijk producten'),                                                   'search_items'        => __('Zoek producten'),                                                   'not_found'           => __('Er zijn geen producten gevonden'),                                                   'not_found_in_trash'  => __('Geen producten gevonden in de prullenbak')                                                                            ),               'public'                  => true,               'can_export'              => true,               'show_ui'                 => true,    // UI in admin panel               '_builtin'                => false,   // It's a custom post type, not built in               '_edit_link'              => 'post.php?post=%d',               'capability_type'         => 'post',               //'menu_icon'             => get_bloginfo('template_url').'/images/favicon.ico',               'hierarchical'            => true,               'rewrite'                 => array(   "slug" => "producten"), // Permalinks               'supports'                => array(   'title',                                                     'editor',                                                                                'thumbnail',                                         ),                              'show_in_menu'            => true,               'taxonomies'              => array('productcat')             )         );               //=============== Register custom taxonomy - PRODUCTS CATEGORY ================           register_taxonomy(  "productcat",                      array(  "products"  ),                      array ( "hierarchical"      => true,                              "label"             => "Product categorieën",                              'labels'            => array(   'name'              => __('Product categorieën'),                                                             'singular_name'     => __('Product categorie'),                                                             'search_items'      => __('Categorieën zoeken'),                                                             'popular_items'     => __('Populaire categorieën'),                                                             'all_items'         => __('Alle categorieën'),                                                             'parent_item'       => __('Huidige categorie'),                                                             'parent_item_colon' => __('Huidige categorie:'),                                                             'edit_item'         => __('Wijzig categorie'),                                                             'update_item'       => __('Update categorie'),                                                             'add_new_item'      => __('Nieuwe categorie toevoegen'),                                                             'new_item_name'     => __('Nieuwe categorie')                                                 ),                                'show_ui'         => false,                               'query_var'       => true,                               '_builtin'        => false,                               'paged'           => true,                               'rewrite'         => array(   'hierarchical'      => true,                                                              'slug'              =>'products',                                                             'with_front'        => false                                                 ),                             )                     );          }      **Jeff's settings:**               add_filter('rewrite_rules_array', 'mmp_rewrite_rules');     function mmp_rewrite_rules($rules) {         $newRules  = array();         $newRules['producten/(.+)/(.+)/(.+)/(.+)/?$'] = 'index.php?products=$matches[4]'; // my custom structure will also have the post name as the 5th uri segment         $newRules['producten/(.+)/?$']                = 'index.php?productcat=$matches[1]';               return array_merge($newRules, $rules);     }          function filter_post_type_link($link, $post)     {         if ($post->post_type != 'products')             return $link;              if ($cats = get_the_terms($post->ID, 'productcat'))         {             $link = str_replace('%taxonomy_products%', get_taxonomy_parents(array_pop($cats)->term_id, 'productcat', false, '/', true), $link); // see custom function defined below         }         return $link;     }     add_filter('post_type_link', 'filter_post_type_link', 10, 2);          // my own function to do what get_category_parents does for other taxonomies     function get_taxonomy_parents($id, $taxonomy, $link = false, $separator = '/', $nicename = false, $visited = array()) {             $chain = '';            $parent = &get_term($id, $taxonomy);              if (is_wp_error($parent)) {             return $parent;         }              if ($nicename)                 $name = $parent -> slug;             else                 $name = $parent -> name;              if ($parent -> parent && ($parent -> parent != $parent -> term_id) && !in_array($parent -> parent, $visited)) {                 $visited[] = $parent -> parent;                 $chain .= get_taxonomy_parents($parent -> parent, $taxonomy, $link, $separator, $nicename, $visited);              }              if ($link) {             // nothing, can't get this working :(         } else                 $chain .= $name . $separator;             return $chain;         }      **Permalink settings:**               /producten/%taxonomy_products%/%postname%/      Working with the Taxonomic SEO Permalink plugin Thanks!


Add 'Description' to taxonomy 'Quick Edit'

This seems fairly straight forward, but I cannot find a definite guide on how to add the taxonomy description field to the quick edit box. I've followed several tutorials on adding fields to the custom quick edit box, but the core fields (name, description and slug) do not follow the same guidelines as adding custom fields to the taxonomy quick edit box. Is it even possible to do so? If not - I guess the best alternate is to create another 'Description' meta-field and that way add it to the taxonomy quick edit box. Thanks for any input. Roc.


Downgrading a WP3.3.1 Network Install

Good Morning-- Today I need to downgrade a site from a WP network install to a normal WP install. I thought this would be simple -- just removing these lines from wp- config.php: define( 'MULTISITE', true ); define( 'SUBDOMAIN_INSTALL', false ); $base = '/xxx/blog/'; define( 'DOMAIN_CURRENT_SITE', 'xxx.xxx.xxx' ); define( 'PATH_CURRENT_SITE', '/xxx/blog/' ); define( 'SITE_ID_CURRENT_SITE', 1 ); define( 'BLOG_ID_CURRENT_SITE', 1 ); and changing define('WP_ALLOW_MULTISITE', true); to define('WP_ALLOW_MULTISITE', false); But I consistently am getting a: You do not have sufficient permissions to access this page. when I try to login as an administrator on the site. Any thoughts on how to accomplish this? Thanks in advance for all your insights! Stephen


Get basic Image Uploader on User Profile Page

I am trying to add an image uploader to the user profile pages. I do have it up and running on a basic registration page, but somehow the same, but slightly adjusted code does not work when added to functions.php. The field is loaded and WordPress does allow easy updating, but in profile view no image is shown. To get the image and store it I use               /********************************************************************     Profile Image Upload Field Code     *********************************************************************/     require_once( STYLESHEETPATH . '/img_upload_resize_crop.php' );          add_action( 'init', 'custom_img_uploader' );          function custom_img_uploader () {              if (isset($_FILES['profilePicture']['name'])!= "" ) {          if ( $_FILES['profilePicture']['name']!="" ) {         $your_image = new _image;         $upload_dir = wp_upload_dir();         //To Upload         $your_image->uploadTo = $upload_dir['basedir'].'/';         $upload = $your_image->upload($_FILES['profilePicture']);                   //To Resize         $your_image->newPath = $upload_dir['basedir'].'/thumbs/';         $your_image->newWidth = 150;         $your_image->newHeight = 200;         $resized = $your_image->resize();         $profilePicture=str_replace($upload_dir['basedir'].'/thumbs/', "", $resized );         unlink($upload);     }else{         $profilePicture='';     }     }     }      To display the field in HTML I have:
     <?php _e("Profile Image"); ?>	          <input type="file" name="profilePicture" id="profilePicture" style="float:left;" />
      And to save it I use this:               update_user_meta( $user_id, 'userphoto_thumb_height', 59);     update_user_meta( $user_id, 'userphoto_thumb_width', 80 );     update_user_meta( $user_id, 'userphoto_thumb_file', $profilePicture );      Does anyone see why in Profile View this code:               <?php if(get_the_author_meta( 'userphoto_thumb_file', $getId )!=""){?>                             <img src="<?=$uploads['baseurl'];?>/thumbs/<?=get_the_author_meta( 'userphoto_thumb_file', $getId );?>" />      does not load a stored image? **Update I and II** Basic debugging **Update III** After adding an `isset()` I got a little further:               [28-Mar-2012 07:14:46] PHP Notice:  Undefined variable: profilePicture in /home/user/public_html/wp-content/themes/theme-name/functions.php on line 346      On that line I have `update_user_meta( $user_id, 'userphoto_thumb_file', $profilePicture ); ` ~~Seems like even though I have the variable`profilePicture` defined, it is not grabbed~~ Was just a notice and does not seem to be relevant nor causing the upload issue. **Update IV** I wrapped the image uploader code in a function and added it as an action. See code with updates above. I still have an undefined variable `profilePicture` nor is the image uploaded. Entire functions.php file is here http://pastebin.com/YGYz3Qnv **Update V** I just realized I do not not have a good $_POST option for the profilePicture. Looking at the plugin mentioned by a @brasofilo at http://plugins.svn.wordpress.org/user-avatar/trunk/user-avatar.php I see this code I might be able to use, but I need to adjust it a lot:               <form enctype="multipart/form-data" id="uploadForm" method="POST" action="<?php echo admin_url('admin-ajax.php'); ?>?action=user_avatar_add_photo&step=2&uid=<?php echo $uid; ?>" >                 <?php _e('Choose an image from your computer:','user-avatar'); ?>
<input type="file" id="upload" name="uploadedfile" />                 <input type="hidden" name="action" value="save" />                 <?php wp_nonce_field('user-avatar') ?>
<input type="submit" value="<?php esc_attr_e('Upload'); ?>" />
         </form>      I just wonder if a form is needed as it wasn't for the other text fields and how I need to add `$user_id` and how to adjust `update_user_meta` **Update VI** Made `$profilePicture` global as recommended by contributor **Update VII** Considering using option from Unrelated Media here. But as it will still take quite a bit for time for me to integrate this into my current functions.php I will keep this thread opened until I have managed to do this.


Why won't is_search work inside functions.php?

I'm trying to use is_search to output some stuff from functions.php. I'm using is_search on the actual search page itself and it works fine:               if(is_search()) {        echo get_search_query( '<h1>', '</h1>' );     }       But from functions.php this doesn't work:               function data_scroll_all(){        if(is_search()) {          $offset = $_POST['offset'];          $category = $_POST['cat'];          $args = array('posts_per_page' => 3, 'category__not_in' => 1, 'offset' => $offset, 'orderby' => 'date', 'cat' => $category);          $loop = new WP_Query($args);            if($loop->have_posts()) {            while($loop->have_posts()){            $loop->the_post();             get_template_part( 'content-archive' );            }         } wp_reset_postdata();      } else {         echo "Nope!";        }     die('');      } With this I just get "Nope!" when I'm on the search page. I have my search template setup like this:               <?php     /*     Template Name: Search Page     */     ?>     <?php     global $query_string;          $query_args = explode("&", $query_string);     $search_query = array();          foreach($query_args as $key => $string) {         $query_split = explode("=", $string);         $search_query[$query_split[0]] = urldecode($query_split[1]);     } // foreach          $search = new WP_Query($search_query);     ?>      I have a a waypoint "infinite-scroll" function that triggers when reaching the bottom of the page:               var ajax_url = $('.loadAll').attr('data-url');     var cat = $('.loadAll').attr('data-cat');     var offset = -3;     $('#infinite-load').waypoint(function (direction) {         if (direction === 'down') {             offset = parseInt(offset) + 3;             $.ajax({                 dataType: "HTML",                 url: ajax_url,                 type: 'POST',                 data: {                     action: 'data_scroll_all',                     cat: cat,                     offset: offset                 },                 beforeSend: function () {                     $(".loading").show(); //show image loading                 },                 success: function (data) {                     $(".loading").hide();                     $('#infinite-load').append(data);                     $.waypoints('refresh');                 }             });         }     }, {         offset: 'bottom-in-view'     });


How to handle image resize in media_handle_sideload?

I am using `media_handle_sideload` function to upload images in my plugin. Is it possible to disable image resize or set it to a specific size and do not make copies (upload only resized image).


Remove custom taxonomy column from my custom post type columns

I am using wp 3.5 i have a custom post `(sp_product)` and also i have custom taxonomy. I want to remove that custom taxonomy filter column but i don't want to make `'show_admin_column' => false`. I wanna unset from `$columns['']` . How should i do that ? i also want to add some css/js when it will show in column and top select menu. (showing in this image like)


Is it safe to use the file editor to make customizations?

I'm constantly reading stuff on the wordpress forum where people are making all mannar of customizations by modifying php or css files using the file editor. But aren't all those files generated? Don't these files get reverted when a change is made to the website through the wp-admin console or when wordpress updates?


Reservations as Post

I am creating a multi-user, multi-product, multi-product-category reservations engine proof of concept. As I need to build it really fast I am using Wordpress's custom post types to manage a lot of the data. I have reached a cross roads as I have modelled individual reservations as a post type, however, as the ones who will be making said reservations may not be registered and/or will be users with the subscriber role. Is it possible for them to still create a reservations post type?


wordpress blog in subdirectory or subdomain

I'm using Wordpress for my website. Now I'd like to add a blog section to my website. I'd like it to be accessible like this: http://www.mywebsite.com/blog or even better, as a subdomain: http://blog.mywebsite.com I've done some research and my understanding is that the second option would be possible using a multiple-site configuration. I've tried and I broke everything :) Otherwise I could just install a new wordpress instance but it's going to be tedious. So the first option seems more feasible but I'm not sure how to implement it ?


When is wp_trim_excerpt() called?

There doesn't appear to be any reference to wp_trim_excerpt() outside of it's declaration - I've checked both the Trac and Xref - when does it work its magic?


Show menu only if_page is

I have created 4 menus (submenus) in wordpress. I need to know how show this menus only if pages ids are "10 and 11 for example. Is possible? I'm desperated after two hours... thanks! This is my code for one of them:               <?php if( has_nav_menu( 'smone-menu', 'responsive' ) ) { ?>             <?php wp_nav_menu( array(                                    'container'      => '',                                    'menu_class'     => 'smone-menu',                                    'theme_location' => 'smone-menu'                                )             );             ?>              <?php } ?>