title: Debugging - trying to add search box to menus

text:
I have already asked a similar question at stackoverflow (http://stackoverflow.com/questions/22492292/add-filter-in-wordpress-how-do-i- know-if-it-is-run), but maybe that was the wrong place? As you can see there I am trying to add a search box in the way I have seen recommended:               add_filter('wp_nav_menu_items','menu_search');     function menu_search($items){       $search = '
';       $search .= '<form method="get" id="searchform" action="/">';       $search .= '<input type="text" class="field" name="s" id="s" placeholder="Search" />';       $search .= '</form>';       $search .= '
';       return $items . $search;     }      However I see no trace of the search box in the menu. In fact it looks like the code added to add_filter is not even run. There are a couple of things I do not know here. I am doing this in a new theme, based on the underscore theme (see http://underscores.me/) since I needed a really light weight theme. I am starting to wonder if the code for filtering is run in the underscore theme. What is the best way to check that? (I do not know php debugging at all. I just added Debug Bar etc.) And did I miss something in the underscore theme here? I mean should I have added anything for it to run the filtering?


title: Get all categories

text: I'm trying to create a list of all the categories exist for my custom post type. For each category i would like to create a Category Name Link. Could anyone help me in this loop?


title: Delete original attachment files after editing

text: I am looking to obtain an certain workflow using WP Media Uploader and Image Editor and I am getting a lot of generated images that I do not need and I do not want to keep them. ![wp problem](http://i.stack.imgur.com/XXYxS.png) You can see in the image above what I am trying to accomplish. I am looking to keep only the generated files after I edit them ( the ones in the red rectangle ). I have searched for an filter or something but I can't find one.


title: Change base URL of pages created by certain users

text: Currently on wordpress all pages are created under the base URL (example.com/{PAGE}). Currently I am aware you can change the permalink of posts to **example.com/{author}/{POST}** but can this also be done for pages? On my site I have a main user ‘ _admin_ ’ using id ‘ _1_ ’ and user profiles set as **example.com/members/{author}** If possible I’d like all pages created by 'admin' to be set as **example.com/{PAGE}** With pages created by other users set to **example.com/members/{author}/{PAGE}** The only code i have in place in regards to permalinks is included below incase this will cause any issues.               function change_author_permalinks() {              global $wp_rewrite;              // Change the value of the author permalink base to whatever you want here         $wp_rewrite->author_base = 'members';              $wp_rewrite->flush_rules();     }          add_action('init','change_author_permalinks');


title: Pagination on static Posts page

text: I'm having an issue with pagination on the static blog page. Under Settings > Reading, "Posts page" is set to a static page. "Blog pages show at most" is set to 10 posts. The first ten posts show up fine, but the pagination doesn't work (returns a 404 for "Previous posts"-link). I've searched for an answer to this problem, it seems to be fairly common and even mentioned in the WP Codex, although for static Front Page (as opposed to statics Posts page)(http://codex.wordpress.org/Class_Reference/WP_Query#Pagination_Parameters). However all the solutions (involving modyfying/filtering the default query) haven't been working for me, e.g:               $paged = (get_query_var('page')) ? get_query_var('page') : 1;     $args = array('post_type'=>'post','posts_per_page'=>10,'paged'=>$paged);     query_posts($args);      OR               function qm_blog_pagination( $query ) {         if ( $query->is_home() && $query->is_main_query() ) {             $paged = (get_query_var('page')) ? get_query_var('page') : 1;             $query->set( 'paged', $paged );         }     }     add_action( 'pre_get_posts', 'qm_blog_pagination' );      Any ideas? Would be greatly appreciated. Thank you, Pim


title: Updating plugins results in deleting them

text: 1: Update a manually installed plugin Wordpress it's auto updating doesn't work right, but it sometimes does! Anyway when it doesn't work right it shows the most viewed error of the wordpress system. 2: 'Could not remove the old plugin/theme/...' For this problem lots of people have come with multiple solutions similar to `chown` the folder or `chmod` it. But these changes are not secure for your website. What I used to update stuff, was by changing (chowning) the owner and group to appache. This was not how I was going to update everytime I was asked to update, so I started digging myself by putting my wordpress admin and direct admin panel along each other. After that I tried every possible options to click or enter, but when I follow these steps I got a totally **new error**. 3: Chmod your outdated plugin folder (recursively?) to 777 (unsecure) 4: Run the updater, this will give back an error what says that it couldn't create a directory on the location where the outdated plugin folder you just chmoded. This is of course because it already exsists. 5: Now refresh your page/restart the update, this is where I really get confused. Sometimes wordpress deletes some files of my plugin what makes my plugin dissapear from the plugin list, that also happens without performing step 5. What also happens is that it returns the message 'the plugin is already up to date..' what is not true and the plugin gets deactivated ((auto) deactivation bug) * * * So what I would like to know is, why wordpress is not able to replace my plugin for a newer downloaded one (because it says it has no permissions). But than why wordpress still can remove certian files from a plugin??


title: Passing a shortcode attribute to a sub-function

text:
This is both a WordPress and a PHP question, since a PHP programmer may know a technique that the WP group doesn't. I have been attempting to write a shortcode that fires the Foundation Reveal code for use inline with the WP Editor. I envision having it work like this:               [reveal size="medium" bg="true" slug="page-slug"]Open a modal with this link![/reveal]      The shortcode specifies the modal size, whether or not to use the black background, and which page slug to incorporate content from in a custom single-page loop (which allows us to use a non-public custom post type to hold the modal data). There are additional attributes but I haven't written them in yet in the interest of simplicity. Here's where it gets tricky. A modal comes in two parts, the link and the hidden DIV. The DIV typically goes at the footer of the site. I could put it inline and solve my problem, but that would play havoc on Google's webcache. No, the modal needs to be an aside in the footer. So I got a bit clever. I had the short code return the target link, but I also had it register a hook (placed in footer.php) to which a content DIV is attached. Everything was working fine until I realized a problem with my variable scope. First, here's my current code:               /**      * Foundation Reveal Shortcode      */          // Create an action to be placed in the site footer. We will target this with the second half of the function     function foundation_reveal() {         do_action('foundation_reveal');     }          // Set up the shortcode for the modal     function reveal_setup($atts, $content) {              // Extract the attributes         extract(shortcode_atts(array(             'size'  =>  'medium',             'slug'  =>  'dummy',             'bg'    =>  'reveal-modal'         ), $atts));              $modal_link  = '';         $modal_link .= $content;         $modal_link .= '';              if ($slug == 'dummy') {             $the_modal = '
' . 'reminder/dummy content goes here' . '
';         } else {             $the_modal = '
' . 'post loop based on page slug goes here' . '
';         }              function reveal_content($the_modal) {             echo $the_modal;         }              add_action('foundation_reveal', 'reveal_content');              return $modal_link;     }               /**      * Setup shortcodes for this theme      */          // Register all shortcodes     function gmfi_shortcodes() {         add_shortcode('reveal', 'reveal_setup');     }          // Add shortcodes to the init hoook     add_action( 'init', 'gmfi_shortcodes');      And since it's kind of helpful to see this whole thing color coded by my IDE, here's a link to that image. The problem will be evident to any PHP programmer right away. In order to pass something like $slug to the secondary function, which gets hooked into the footer, I would need to pass the variable by reference. i.e., I would have to do this:               add_action('foundation_reveal', 'reveal_content($slug)');      That, unfortunately, is not how WordPress works. So here's the question then... can you think of another way to pass that variable by reference? Because if not, I may have to suck it up and write a custom hook/action script. That option seems wasteful if there is a way to do it using the available WordPress components. But, then again, _if there was another way_ , one of the WordPress/Foundation plugin suites probably would have done it already. Either way, I need you all to help me figure out my next step. Thanks so much for sticking with me as I explained all of that! Additional note: The foundation_reveal() hook in the footer definitely gets fired, it just doesn't get any of the class or ID data passed to it.


title: how to move particular functionality to staging server

text: I have local development environment, which i am using to development project in and once it is finished i need to move it to Staging server. Once it is confirmed from the client i need to move it to production. Now my question is how can i move only specific change to staging server. If i changed files than i can move it staging but what if I change something from admin or install a new plugin?


title: Wordpress can't echo brackets

text:
I am trying to make a simple plugin that will output the URL and title of a post. It should look like this: http://mysite.com/test-2/{Test 2} However when I use the code that I posted below, it prints as follows: http://mysite.com/test-2/Test 2 {} I can't figure out why. I've tried to escape them, separating each bracket into a string and combining them, but nothing seems to work. Heres the code               function P2S_menu(){         echo '
This is a Test
';              $query = new WP_Query($query_string . '&orderby=title&order=asc&posts_per_page=-1');         while($query->have_posts()){             $query->the_post();             $url = the_permalink();             $keyword = the_title();             Print('
' . $url . '{' . $keyword . '}' . '

');         }         echo 'Done';          }


title: Twenty Eleven NOT valid

text: How come the default theme Twenty Eleven fails validation test, both for HTML5 and CSS3? I checked: http://twentyelevendemo.wordpress.com/ Should I be bothered that the validation fails?


title: Merge multiple menus into single dropdown menu

text: I have multiple menus in my blog. I have Top Menu and Header menu. These menus appear separately in the desktop version of my website. However, I would like to merge both these menus into a single dropdown menu with the appropriate headings. Example follows:               <select>       <optgroup label="Top Menu">         <option value="Home">Home</option>         <option value="Contact Us">Contact Us</option>       </optgroup>       <optgroup label="Header Menu">         <option value="Category 1">Category 1</option>         <option value="Category 2">Category 2</option>         <option value="Category 3">Category 3</option>         <option value="Category 4">Category 4</option>       </optgroup>     </select>      I am currently using the Walker function below to populate the existing dropdown with a **single menu item list** :               //Code in header.php          <?php wp_nav_menu(array(                           'theme_location' => 'menu_main', // your theme location here                           'walker'         => new Walker_Nav_Menu_Dropdown(),                           'items_wrap'     => '<select id="nav_iphone" name="nav_iphone" onchange="if (this.value) window.location.href = this.value;"><option value="">Select an option to navigate</option>%3$s</select>',                             ));                         ?>          //Code in function.php             class Walker_Nav_Menu_Dropdown extends Walker_Nav_Menu{                      var $to_depth = -1;                      function start_lvl(&$output, $depth)                 {                          $output .= '</option>';                      }                      function end_lvl(&$output, $depth)                 {                          $indent = str_repeat("\t", $depth); // don't output children closing tag                      }                           function start_el(&$output, $item, $depth, $args)                 {                          $indent = ( $depth ) ? str_repeat( " ", $depth * 4 ) : '';                          $class_names = $value = '';                          $classes = empty( $item->classes ) ? array() : (array) $item->classes;                          $classes[] = 'menu-item-' . $item->ID;                                    $class_names = join( ' ', apply_filters( 'nav_menu_css_class', array_filter( $classes ), $item, $args ) );                          $class_names = ' class="' . esc_attr( $class_names ) . '"';                                    $id = apply_filters( 'nav_menu_item_id', 'menu-item-'. $item->ID, $item, $args );                          $id = strlen( $id ) ? ' id="' . esc_attr( $id ) . '"' : '';                                    $value = ' value="'. $item->url .'"';                          $output .= '<option'.$id.$value.$class_names.'>';                                    $item_output = $args->before;                          $item_output .= $args->link_before . apply_filters( 'the_title', $item->title, $item->ID ) . $args->link_after;                          $output .= $indent.$item_output;                      }                           function end_el(&$output, $item, $depth)                 {                          if(substr($output, -9) != '</option>')                              $output .= "</option>"; // replace closing </li> with the option tag                      }             }      **How can I extent the above solution to accommodate my requirement as I specified? Or is there a totally different solution?** If yes, I am open to it as well.


title: Recommended method for updating/adding menus when adding new theme

text: I'm working locally on a completely new theme. Once I'm done I'm going to use the "test drive" plugin to allow admins to test the theme before switching over to it. The problem is that with the new theme there are more menus & updates to the existing ones. How do I manage adding/updating the menus without messing with the live site? Can I somehow import them? Or while I'm test driving the new theme, can I add the menus or will they be added globally? In the meantime, what I've started to implement is: 1. Check if the menu exists. If it does then build it the normal WP way. 2. As a fallback, revert to a hardcoded menu. So I'd upload the theme, activate it, add the menus and after launch I'd then have to go and remove the fallbacks. Not sure if this is right. Seems a bit awkward.


title: Requirements for hosting a single WordPress Blog (upgrades / backups)

text: I would like to start a single WordPress Blog. As I already have some experience with one provider and as it is really cheap, I would like to use the same service for my planned blog. They offer:   * **1 GB webspace** : I will not upload many big pictures and I guess almost no audio/video files, so I guess this is more than enough   * **PHP 5.1 and PERL scripts** : PHP 5.3.6 seems to be the latest version. Although they say on their website, that they support PHP 5.1, phpinfo() tells me they actually have 5.2.17-pl0-gentoo.    * **MySQL** : according to phpinfo(): Client API version: 5.1.56. The latest MySQL-Version is 5.5.14   * **mod_rewrite** : I guess it is enabled. This website uses mod_rewrite, doesn't it? I know that it is hosted by the provider I'd like to chose, so if mod_rewrite works there, it will work for me, too.   * .htaccess files may be used   * **FTP access only! No ssh! No execution of binaries.** The requirements-page of worpress states:   * PHP 5.2.4 or greater   * MySQL 5.0 or greater   * The mod_rewrite Apache module I would now like to know if it is easily possible to update wordpress when I only have FTP-access and phpMyAdmin. I would also like to know if it is easily possible to make backups. (I ask, because I made the experience that creating backups with MediaWiki is impossible (or at least extremly difficult and laborious) without ssh access or mysqldump. It's the same for upgrading MediaWiki)


title: Integrating Human Time Difference and Traditional Timestamps?

text: My goal is to use human_time_diff only when the post was added on the current day. When it wasn't, I would like to revert to the traditional timestamp (the second code). I'm unsure how this would be achieved and need some help. I have provided the two codes I would be combining below. The code for grabbing the difference between the posting time and current time (i.e. 25 minutes ago):               <?php echo human_time_diff( get_the_time('U'), current_time('timestamp') ) . ' ago'; ?>       The code for stating the post was added on X date at X time:               <?php the_time('F j, Y'); ?> at <?php the_time('g:i a'); ?>


title: Open Graph in posts loop page

text: I have a loop where all the posts have their own like button, when i click it the facebook window appears but it does not show the right post thumbnail. I think this is normal because in a posts loop the thumbnails are multiple so the script can not figure which one goes where - on the contrary the like button works perfectly on my single post pages. So my question: is it possible to have the facebook like button work correctly on a loop page so that it grabs the right post thumbnail even if there are, say 10 posts in that page? Maybe i should have multiple Open Graph metas, a set for each post in the loop, but i guess this would just cause a mess, is there something that i can do?


title: Magazine subscription sales through WP?

text: I am looking for a way to sell magazine subscriptions for the company I currently work for. They publish magazines that are currently being sold through a regular shopping cart plugin for wordpress. This does not provide any reporting for us or automatic reminders for the subscribers. Is there such a thing that even Google has failed to inform me of? I would prefer a Wordpress Plugin as I am much more familiar with development with this CMS. I am not looking for a membership plugin as these are a dime a dozen.


title: Custom Post Type and Taxonomy Rewrite Error

text: The following code is adapted from Jan Fabry's answer. Mixing custom post type and taxonomy rewrite structures?               <?php     add_filter('post_type_link', 'client_area_permalink', 10, 4);     function client_area_permalink($post_link, $post, $leavename, $sample) {         if ( false !== strpos( $post_link, '%client_category%' ) ) {             $glossary_letter = get_the_terms( $post->ID, 'client_category' );             $post_link = str_replace( '%client_category%', array_pop( $glossary_letter )->slug, $post_link );         }         return $post_link;     }     ?>      When I go to add a new post, `array_pop` throws an error. I believe it is because there is no taxonomy associated yet with the post. ![array_pop error](http://i.stack.imgur.com/SQkN8.png) How do I go about fixing this error? I have thought about using `get_post_permalink` as a base because that is where `post_type_link` is hooked into.


title: How to add pagination to category templates

text: I have a function which named `kriesi_pagination`, which is a function for showing page numbers in php. I copied the code into the `functions.php` for my site. The I call this function in the `index.php` file for showing the page numbers on the index page of my site. I use this code like this inside `index.php`: `<?php kriesi_pagination(); ?>` What should I do if I want to show the page numbers in other places such as on category pages? It just shows the page numbers in home page of site not any other places. I want to have page numbers for the categories like sports, musics, technology, etc.


title: How to determine current active language in qtranslate plugin?

text: I have a situation where I want to give specific style to my Navigation Menu when the website is in German language. My website works well in English language but when I switch to German, it causes a css problem. So how do I determine which language is currently active with qTranslate plugin?


title: Using jQuery toggle() in WordPress post to show/hide Tweet button?

text: What is the appropriate way to use jQuery toggle() function in a WordPress post to show/hide a Twitter "Tweet" button? The problem I am encountering is when I put the code in my content-post.php, the toggle feature and tweet functionality only work on the first (most recent) post in the stream. How would I go about putting this in the Wordpress loop? Right now, I am including this code my content-post.php file:               <?php if (!is_singular()) { require('post_buttons.php'); }?>      The above code includes the Tweet button from another file with this toggle code:               <script>     jQuery(document).ready(function() {         jQuery('#social_trigger').click(function() {             jQuery('#tweet_button').toggle();         });     });     </script>


title: How do I add the featured image to the_content after the first paragraph?

text:
**My problem:** I'm trying to create a filter that will add the featured image of a post to the_content, so that I can have the first paragraph of the_content displayed before this image. **What I basicly want to achieve:**
First Paragraph of the_content
     The Post's Featured Image
The rest of the_content
      I someone is able to help me. Thanks in advance!


title: Theme recommendation: Hotel/Hostel/Bed & Breakfast

text: I searched on different Marketplaces so far, but haven't found anything that wouldn't take me hours or even days to make a wordpress theme from. ### Here's the list of things I need: **1.** Slider or some photo gallery. Something fancy, eyecatching. **2.** (Ajax?) Contact Form (minor issue - got some small plugin close to finished) **3.** Registration/Booking **4.** Maybe list the already booked dates. **5.** Any other ideas what might be needed? * * * It can be for free or paid. Doesn't make any difference. If you know a theme or just a plugin that solves part of the issue: Tell me. Happy to upvote every single, tiny hint. If you got search terms that might bring up better results on google or marketplaces, please tell me also. English is not my mother tongue.


title: Memory usage when querying users

text:
I'm having a small issue with one of my queries here. I cannot increase my wordpress memory limit as long as hostgator sets it to 64mb. I'm not sure if its possible to reduce the amount of memory used making some changes to my code, here is the code I'm using to query users from a specific role and displaying their name, profile and avatar:               <?php $users = get_users('role=s2member_level3'); ?>      <?php foreach ($users as $user) {         $avatar = get_avatar($user->ID, '96');         if (get_the_author_meta('description', $user->ID) == "" && stristr($avatar,"gravatar.com/avatar")) { continue; }         ?>

                 <?php if ($avatar == "") {                      echo '';                  } else {                      echo $avatar;                 } ?>

<?php echo $user->display_name; ?>

<?php the_author_meta('description', $user->ID);  ?>

     <?php } ?>


title: Wordpress Wysiwyg Content not being displayed

text:
My Wordpress website really isn't working to how I want?! It was working fine, with nothing being touched, Then lately I find every-page is displaying the same content on each page. Not the individual content that is in the wysiwyg editor. This is doing my head in, I have a modified theme in which I have already replaced with the original theme files, page.php, index.php and single.php to see if it is a problem with them pages. But it is not!? The link is http://www.alleanza.co.uk and I was suppose to hand it over last weds and I still can't because no content is being pulled through. Does anyone have any ideas that may help? However I have noticed that it is pulling information from the Hello World Post instead of the page's wysiwyg content. However, here is the content for page.php               <?php     /*     Template Name: Normal Template     */     ?>          <?php get_header(); ?>

<?php if (function_exists('dimox_breadcrumbs')) dimox_breadcrumbs(); ?>
          <div <?php post_class(); ?> id="post-<?php the_ID(); ?>">                          <?php while ( have_posts() ) : the_post(); ?>                              <?php the_content(); ?>                              <?php comments_template( '', true ); ?>                          <?php endwhile; // end of the loop. ?>                   <?php edit_post_link('Edit this entry.', '
', '
'); ?>

          <?php get_sidebar(); ?>          <?php get_footer(); ?>


title: Inconsistent bloginfo information

text: I'm doing a little bit of work on a theme I just inherited from another developer. The site just broke, and I'm trying to fix it. You can see the site here: www.bowlingventures.com What's happening is this. As you can see, the home page loads unstyled. All of the images are being pushed out using "bloginfo('template_directory');" If you click on one of the links to another page, you'll see that that page loads correctly. Inspecting the page source, the paths to the image directory differ slightly. Both paths are output using "bloginfo('template_directory');" Additionally, when logged in, the home page loads just fine. How is this possible? Also, I tried adding some information to the header.php template file to be printed on every page. This information was only visible on the non-home pages. Heads up, the site is _slow_  I'll be fixing that later today.


title: get php variable from functions php and echo it in theme template files

text: This may seem like a silly question but I cannot figure this out. I've created a variable in my functions.php - and I'm trying to echo it in my template files. I'm guessing it's because of scope. What's the simpliest what to echo a variable or create a function to allow me to output this facebook ID in various template files. This is what I've currently got in my functions.php...               $fb_app_id = '68366786876786';      And this is how I was trying to echo it...               <?php echo $fb_app_id; ?>         Any ideas would be hugely helpful, thanks you very much


title: How can I get the term_id from the action hook 'set_object_terms'?

text: I have the following code and I want to use the term_id inside that function. I aware that the variable $terms contains the term; however, I do not know how to get the term id from it.               add_action('set_object_terms','wpse5123_set_object_terms',10,4);          function wpse5123_set_object_terms($object_id, $terms, $tt_ids, $taxonomy){            if($taxonomy == 'category'){                echo '<pre>';                print_r($terms);                exit;            }     }      I tried the following but it does not work:               foreach (  $terms as $term) {         $term_id[] = $term->term_id;         }


title: Is this a WordPress security bug?

text: <?php     if ( ! is_admin() ) return;     echo 'You should not see this if you\'re not logged in!';     ?>      If you put this in a mu-plugin, and go to your admin, e.g., `example.com/wp- admin/` while you are _not logged in_ , should you be able to see the `echo`?


title: Custom shortcode editor [BackboneJS & TinyMCE)

text: I'm using Wordpress 3.9.1 and I wrote a custom shortcode that working, but I'd like to custom it a little bit When I use my shortcode, this is the render in the admin page : [toggles title="zaez"]aezaezae[/toggles] I can edit, add text or link to the text "aezaezae". And i'd like to keep this behavior but make it more good to look. So I used some code from wordpress (gallery's code) and did that :                   (function($){          var views = {},         instances = {},         media = wp.media,         viewOptions = ['encodedText'];          // Create the `wp.mce` object if necessary.     wp.mce = wp.mce || {};          wp.mce.toggles = {         shortcode: 'toggles',         toView:  function( content ) {             var match = wp.shortcode.next( this.shortcode, content );                  if ( ! match ) {                 return;             }                  return {                 index:   match.index,                 content: match.content,                 options: {                     shortcode: match.shortcode                 }             };         },         View: wp.mce.View.extend({             className: 'editor-toggles',             template:  media.template('editor-toggles'),                  // The fallback post ID to use as a parent for galleries that don't             // specify the `ids` or `include` parameters.             //             // Uses the hidden input on the edit posts page by default.             postID: $('#post_ID').val(),                  initialize: function( options ) {                 this.shortcode = options.shortcode;             },                  getHtml: function() {                 var attrs = this.shortcode.attrs.named,                     content = this.shortcode.content,                     options;                      options = {                     content: content,                     title: attrs.title                 };                      return this.template( options );                  }         })          };     wp.mce.views.register( 'toggles', wp.mce.toggles );     }(jQuery));      And this is the template that is called


title: Search Custom Post Type Custom Fields

text: There are tutorials that explain how to limit a search to a specific category. My question is, is there a way to configure wordpress' search to, within a custom post type, search for a custom field value. So for example, if I search for "hello", the results would come up with posts that have a certain custom field equal to "hello". The certain post would also be a certain custom post type. Any help is appreciated.


title: How to disable the_excerpt from one post

text: I have this code for the_excerpt :               function get_excerpt(){         $excerpt = get_the_content();         $excerpt = preg_replace(" (\[.*?\])",'',$excerpt);         $excerpt = strip_shortcodes($excerpt);         $excerpt = strip_tags($excerpt);         $excerpt = substr($excerpt, 0, 640);         $excerpt = substr($excerpt, 0, strripos($excerpt, " "));         $excerpt = trim(preg_replace( '/\s+/', ' ', $excerpt));         $excerpt = $excerpt.'<a class="read-more" ID) . '">read more.';         return $excerpt;     }`      I want to disable from one post the_excerpt. I think that this part of function helps but this is not happened.               if( in_array( $post->ID, array(post_ID) ) )          get_the_content();     else         get_excerpt();


title: What plugins can I use to feature (affiliate) products on my blog (from Amazon.com)?

text: I know Amazon.com will pay affiliates (in some states, depending on tax laws) who send users to their website to buy a product. I've also seen some Wordpress sites that feature Amazon.com products with links that seem to be affilate links. Are there any good plugins for featuring affilate products from Amazon.com (or other services?)


title: Get plugin download URL from slug

text: Is there a way to take a plugin slug (e.g. 'akismet') of a plugin that is NOT currently installed and somehow retrieve the download URL of the current version (e.g. 'http://downloads.wordpress.org/plugin/akismet.2.5.3.zip')? This is for a command line script I am trying to develop that will enable plugin installation from the command line.


title: Taxonomy landing pages

text: I like to create a landing page for my custom taxonomies. Right now ive created three custom taxonomies               /country/[terms]     /person/[terms]     /interrests/[terms]      i like to create a listing page for each of the taxonomy, this listing page should list all the [terms] they contain. And link to the normal (`taxonomy-[term].php` `/taxonomy/[term]`) url. What is a proper way to implement this? First i was thinking something along the lines with template_redirect and create a custom `taxonomy-list.php` file to include in the action which manually query using a `WP_Query()`


title: Buddypress ajax problem after adding new groups sub nav

text: This problem has been bugging me for couple of days. After adding a new subnav, I got the following error when trying to use the drop down groups filter: 404 Not Found – mysite.com/wp-admin/admin-ajax.php” Basically I wanted to add a new subnav items under a member’s main nav “groups”. Currently there are two subnav items there: “memberships” and “invitations”. I would like to add my own subnav item called “My Customized Groups”. When this subnav is clicked, it will show groups of certain feature. Okay the first step is to create a new subnav items. I did it by adding the following code to my functions.php               //add new subnav items     bp_core_new_subnav_item( array(     'name' => __( 'My Customized Groups', 'buddypress' ),     'slug' => 'my-custom-groups',     'parent_url' => $groups_link,     'parent_slug' => $bp->groups->slug,     'screen_function' => 'groups_screen_my_custom_groups',     'position' => 20     ));      To make sure my subnav works, my screen_function “groups_screen_my_custom_groups” is a exactly copy of the default “groups_screen_my_groups”. Now the subnav is added, and groups loop show up correctly. But when I select the drop down filter ( “last active”, “most members”, “newly created”, etc), the following error shows up: 404 Not Found – mysite.com/wp-admin/admin-ajax.php” if I set this new subnav as the default by adding the following code in functions.php               $args = array(     'parent_slug' => $bp->groups->slug,     'screen_function' => 'groups_screen_my_custom_groups',     'subnav_slug' => 'my-custom-groups'     );          bp_core_new_nav_default($args);      Then the ajax works correctly for my-custom-groups, but it doesn’t work for other subnav items anymore. It seems ajax only works for the default subnav? This is strange. It must be something minor, but I still can’t figure out what’s been wrong after searching everywhere for two days. Thanks in advance for the help. Wordpress version: 3.4.2 buddypress version: 1.6.1


title: Fetch and display Image stream

text: I would like to show on my website some images on a map. I.e. the user uploads an image and fills in his/her address. Then he/she can see his image on a google map when panning to the address they filled in. Are you aware of any support for achieving this ? If not, would you recommend some plugin which would ease fetching images from a Facebook page and eventually display them (at best on a map, based on geolocation) ? Thank you.


title: WPAlchemy - Checkboxes not saving

text: I'm using have_fields to loop through an array and create a list of checkboxes. Everything seems to be working great, except that the checkboxes aren't consistently showing as "checked" on the backend. Here's the code I'm using:               <?php $items = array(             'bio',              'youtube',             'articles',              'learn-more',              'testimonials',              'twitter',             'custom',         ); ?>              <p>         <?php while ($mb->have_fields('t_enabled_widgets', count($items))): ?>                  <?php $item = $items[$mb->get_the_index()]; ?>                  <input type="checkbox" name="<?php $mb->the_name(); ?>" value="<?php echo $item; ?>"<?php $mb->the_checkbox_state($item); ?>/> <?php echo ucwords(str_replace("-", " ", $item )); ?><br/>              <?php endwhile; ?>         </p>      For example, when I check the first 4 boxes, (Bio, Youtube, Articles, and Learn More), all is well. When I check the 5th, it _saves_ to the database, but when the page reloads, it's unchecked. This is obviously a problem because when you then "Update" the page _again_ it's submitted as a blank value. Any ideas?


title: Redirect after successful registration with fronted registration form

text: I am trying to redirect users after failed and successful registrations and logins. Everything works fine, except the redirection after a successful registration. Right now, I get redirected to `http://mysite.com/register/?login=failed.` I can't figure out why I am not redirected to `http://mysite/com/login/?redirect_to=mysite.com/change-password` which I specified at the bottom using `add_action('registration_redirect','redirect_after_success_registration');` Here's my code:               // hook failed login     add_action('wp_login_failed', 'my_frontend_login_fail');           function my_frontend_login_fail($username){         // Get the reffering page, where did the post submission come from?         $referrer = add_query_arg('login', false, $_SERVER['HTTP_REFERER']);              // if there's a valid referrer, and it's not the default log-in screen         if(!empty($referrer) && !strstr($referrer,'wp-login') && !strstr($referrer,'wp-admin')){             // let's append some information (login=failed) to the URL for the theme to use             wp_redirect( add_query_arg('login', 'failed', $referrer) );                  //wp_redirect($referrer . '?login=failed');          exit;         }     }          //hook empty login submit     add_action( 'login_head', 'my_frontend_login_no_pass_no_username' );          function my_frontend_login_no_pass_no_username(){         $referrer = add_query_arg('login', false, $_SERVER['HTTP_REFERER']);         if ( (!isset($_REQUEST['user_login']) || ( isset( $_REQUEST['user_login'] ) && trim( $_REQUEST['user_login'] ) == '' ) ) || (!isset($_REQUEST['user_pass']) || ( isset( $_REQUEST['user_pass'] ) && trim( $_REQUEST['user_pass'] ) == '' ) ) ){             wp_redirect( add_query_arg('login', 'failed', $referrer) );              exit;          }        }               // unsuccessfull registration     add_action('register_post', 'binda_register_fail_redirect', 99, 3);          function binda_register_fail_redirect( $sanitized_user_login, $user_email, $errors ){         //this line is copied from register_new_user function of wp-login.php         $errors = apply_filters( 'registration_errors', $errors, $sanitized_user_login, $user_email );         //this if check is copied from register_new_user function of wp-login.php         if ( $errors->get_error_code() ){             //setup your custom URL for redirection             $redirect_url = get_bloginfo('url') . '/register';             //add error codes to custom redirection URL one by one             foreach ( $errors->errors as $e => $m ){                 $redirect_url = add_query_arg( $e, '1', $redirect_url );                 }             //add finally, redirect to your custom page with all errors in attributes             wp_redirect( $redirect_url );             exit;            }     }          function redirect_after_success_registration () {     $redirect_url=get_bloginfo('url').'/login/?redirect_to='.get_bloginfo('url').'/change-password';     return $redirect_url;     }     add_filter('registration_redirect','redirect_after_success_registration');      I appreciate your ideas and solutions on this one! Thank you


title: Display content of page template (get_page)

text: My problem is that I displayed content of 3 pages on index.php by using get_page(). The problem is that each of those pages have own page template               /*     Template Name: another page template     */      which contains the loop with 3 posts in category. This way I can see only content of page typed in WP editor but no trace of queried posts on pages. How to display three posts from page template on index.php? For displaying pages on index.php I'm using:               <?php      $id = 1;      $post = get_page($id);      $content = apply_filters('the_content', $post->post_content);      echo $content;     ?>      and pages have own template with the_loop:               <?php query_posts( array( 'category_name' => 'name', 'posts_per_page' => 3 ));       while (have_posts()) : the_post(); ?>     <?php the_content(); ?>     <?php endwhile; ?>


title: Point domain to different webhost's subdirectory wordpress

text: Now there may seem to be duplicates for this question but nothing concise so I'm going to try: I have a wordpress install setup at mydomain.com/subdir - hosted on fatcow. I went ahead and bought a domain from godaddy.com(cos it was dirt cheap) -pointed the name servers where needed.(fatcow's servers) Opened fatcow control panel: -added the newdomain.com and pointed it to mydomain.com/subdir.  On opening it points to the mydomain.com/subdir when I update the site url to newdomain.com(from the WP admin panel) it opens the homepage as newdomain.com but when I open any links it gives me a 500 server error. If I try to login to the website, the login screen just refreshes every time i enter the correct credentials. I've gone through the codex extensively, it's very ambiguous considering the scenario I'm facing. Some background about my setup: I have a newdomain.com-redirect folder in my hosting space. I want to host two sites in different sub folders such that : mydomain.com/ points to mydomain.com/blog and newdomain.com/ points to mydomain.com/subdir any help will be hugely appreciated. Regards, Rishav S **Solution:** After you update the site-url and cannot access anything apart from the homepage, you will need to update the permalinks of your website, access the backend using domain/wp-login.php instead of domain/wp-admin/ and save the permalinks once again. don't need to do a string replace in your database(however it is recommended otherwise your assets will be requested from the old domain), moving folders etc.


title: MF2 and qTranslate problem with custom post types post titles

text: I'm creating custom post types with Magic Fields v2.0.1 and i use the qTranslate v2.5.32 plugin for a second language on Wordpress 3.4.2. The problem is that on Magic Fields in the settings of the custom post type when i select to support only "Title" (and not "Editor") there is no extra Post tile field for the translation in the Custom Post Type write panel. If the "Editor" in the settings is on, there are 2 fields for the post title for each language as normally. Is there a way to hide the default visual editor but keep the title field with the translation. I want just the English and second language Title fields. I tried to hide it with the Adminimize plugin but it seems that Magic fields overrides it. Also i tried to hide the visual editor from the general settings of the Magic Fields but still the options in the Custom Post type settings override that. Also there are no translation fields for custom taxonomies. Has anyone run on this? Any work around?! Please help!


title: How do I get the category slug from wp_dropdown_categories

text: This might be a newb question, but I'm not sure. I did wuite a bit of searching, but i can't find anything to answer my question... I am customizing a plugin I needed it to show a list of the categories in hierarchy, which I got working with all of the functions of the plugin. I'm using wp_dropdown_categories, but I'd like to display the list of categories as their slugs, and not as their category name. Any suggestions? Here's what I have so far:               <?php                 function replace_id_for_slug($option){                 $categories = get_categories("hide_empty=0");                      preg_match('/value="(\d*)"/', $option[0], $matches);                      $id = $matches[1];                 $selectID = $nextItem;                 $slug = get_cat_slug($id);                          foreach($categories as $category){                         if($category->cat_ID == $id){                          }                 }          return preg_replace("/value=\"(\d*)\"/", "value=\"$slug\"", $option[0]);     }          $select = wp_dropdown_categories("hierarchical=1&hide_empty=0&echo=0&name=field_$nextItem&id=$selectID&class=categoriesBox");          echo $select;          ?>        * * * Hi Toscho, thanks for the reply. I forgot to mention in my question that this is for the admin backend. I've tried playing around with the walker class, but I am at a loss. do you know of any other way this could be accomplished? Thanks, Chase


title: Call to undefined function get_header() in index.php

text: I am trying to create a theme. I created a `header.php` file and call this file in `index.php` using               <?php get_header();?>      When I try to run my index.php file it shows this error: > Call to undefined function `get_header()` What could be wrong?


title: Why does abstracting html from plugin code result in loss of access to wordpress functions?

text: When defining the callback that produces the HTML content for an admin settings page, I'd like to abstract the HTML into a separate file, but the HTML uses some wordpress functions, specifically current_user_can and screen_icon. These are claimed to be undefined when called through the included file but work fine inline.               function admin_menu_page_content() {                  if ( !current_user_can( 'manage_options' ) )  {                 wp_die( __( 'You do not have sufficient permissions to access this page.' ) );             }             ?>             <div class="wrap">                        <?php include(plugins_url('plugin_name/forms/admin_form.php')) ?>             </div>              <?php         }


title: querying posts by custom taxonomy terms right from a querystring based URL

text: The following URL seems to work for cats and tags only. `yoursite.com?cat=2&tag=bread1+bread2` what if you wanted to get into custom taxonomy and terms and do something similar? is there an equivalent to something like the following? `yoursite.com?taxonomy=food&tag=bread1+bread2`


title: Manual excerpt length on recent posts slider

text: I need to change the character/word limit of manual excerpts which will be displayed on recent posts slider. I think it's 55 characters right now without counting spaces and punctuation marks. Am i right? I researched and accordingly tried to add some codes on `functions.php` but none of them worked. I thought they were out of date or unrelated. I also edited the following code in `recent-posts-slider.php` but didn't work:               $excerpt_length = 100;      Besides, how many words that recent posts slider shows isn't consistent anyway. It displays 10-15 words for a post then it displays properly 50 words for another. What should i do? * * * You're right, i'm sorry. I'm just doing what i saw from some articles. I really don't know much about coding. My 'recent posts slider' is a function that comes with the theme i use, called 'Big City'. So in themes/bigcity direction there is a recent-posts-slider.php file. I can set a 50 words limit for automated excerpts via wp-admin but couldn't set one for manuals. I won't use excerpts in homepage, i just want those excerpts displayed in the slider. These are some codes about excerpts in recent-posts-slider.php :                   $excerpt_length = '';     $excerpt_length = abs( (($width-40)/20) * (($height-55)/15) );     /*if ( ($width) > $height)     $excerpt_length = $excerpt_length - (($excerpt_length * 5) /100);     else     $excerpt_length = $excerpt_length - (($excerpt_length * 30) /100);*/      * * *               function create_excerpt( $post_content, $excerpt_length, $post_permalink, $excerpt_words=NULL){         $post_excerpt = strip_shortcodes($post_content);         $post_excerpt = str_replace(']]>', ']]>', $post_excerpt);         $post_excerpt = strip_tags($post_excerpt);         $read_more = get_option_tree('blog_read', '');               if( !empty($excerpt_words) ){                if ( !empty($post_excerpt) ) {                 $words = explode(' ', $post_excerpt, $excerpt_words );                 array_pop($words);                 if($read_more){                 array_push($words, ' '.$read_more.'');                 }                 else{                 array_push($words, ' ');                 }                 $post_excerpt_rps = implode(' ', $words);                 return $post_excerpt_rps;             } else {                 return;             }         }else{             $post_excerpt_rps = substr( $post_excerpt, 0, $excerpt_length );             if ( !empty($post_excerpt_rps) ) {                 if ( strlen($post_excerpt) > strlen($post_excerpt_rps) ){                     $post_excerpt_rps =substr( $post_excerpt_rps, 0, strrpos($post_excerpt_rps,' '));                 }                    $words = explode(' ', $post_excerpt, $excerpt_words );                 array_pop($words);                 if($read_more){                 array_push($words, ' '.$read_more.'');                 }                 else{                 array_push($words, ' ');                 }                 return $post_excerpt_rps;             } else {                 return;             }         }     }


title: Is it possible to change the attributes of a registered style or script before it fires?

text: I'd like to modify the properties of a registered style(or script - same applies) before it's been loaded. Right now i'm trying to modify a registered style just before it gets enqueued, so i can point it at another file(ie. change the `src` property, maybe others to). Looking for some ideas specifically about where to hook on and modify the `$wp_styles` object so that the enqueue fire as normal, but with my changes to the registered style's properties. I'm making an admin color scheme and thought it would be awesome if i could rewrite/tweak the existing enqueue, instead of adding an additional request to every page(ie. colors-fresh.css + my stylesheet - i'd rather have one request, why include the original stylesheet only to redefine every style in another)... Unregister the style and register my own? - I'd then have to unregister both color schemes(classic/fresh) when i'd prefer to simply hook on and tweak the styles object before the enqueue fires. I'm pretty sure it's possible, but simply lacking the brain power to wrap my head around it right now.. (been wired in too long).. Any suggestions welcome.... ;)


title: why am i getting the 'fatal error' msg when uploading photos within specified MB?

text: Fatal error: Allowed memory size of 67108864 bytes exhausted (tried to allocate 16000 bytes). this is the message i'm getting trying to upload a 4.6MB photo, way under the 200MB max allowed. the photo is then appearing in Gallery, but i can't change size, the 'full size' circle is ticked and it won't come off that for thumbnail, medium etc. i've already uploaded similar size photos in 3 other posts successfully. does it mean i've reached my limit and can't use photos in any further posts? can anyone help in non-techy speak?


title: Moved WP from example.com/blog to example.com, cannot add pages now

text: I just moved my WordPress blog from a directory up a folder and I've changed my wp-config.php by adding these 2 lines:               define('WP_HOME','http://example.com');          define('WP_SITEURL','http://example.com');      Most things are working fine now, but I'm having trouble creating pages... I can create them without a problem but when I view them it gives me a 404 error. Any help? EDIT: I should say when I add a page like 'About', the URL: www.example.com/about show's an error page.


title: 404 on child page template

text: I have a page called **portfolio** and I have created several child pages for it like **Video page, audio page** etc … I also created custom page template for portfolio and named its file `portfolio-template-ahsan.php`. But when I use it on my child page as a custom template, it gives me the 404 error page. Now what I am confused about is how this naming convention works, and how should I name the child custom page templates, if I remove the Parent page from Video page, then the template works fine, but when I use Portfolio page as parent page, it gives me 404 error here is the code for the inner page template, could it be a problem if the parent page have different template and child page have different page template               <?php          /*      Template Name: Portfolio template column four simran     */     ?>     <?php     get_header('ajax');      include('portfolio_loop.php');     get_footer();      ?>


title: Custom Post Templates

text: **The Issue:** I am looking for _custom_ single post templates, to add or remove individual elements as a function of a normal single post. There are a lot of ways to create custom post templates for single posts within WordPress. Especially post formats are a great chance to use _default_ templates for default cases; however I need real _custom_ templates for every post. **The Idea:** My first approach was to add an if/else statement according to the post ID:               // check if custom post     if ( is_single('999') )         // check if there is a custom post template file         if ( file_exists(TEMPLATEPATH . '/single-999.php' )             // use custom post template             return TEMPLATEPATH . '/single-999.php';      // use normal post template for everything else     include(TEMPLATEPATH . '/single.php');      Well, this isn't wrong, but it would totally mess up my template code if there will be more and more special cases. So maybe I can use a filter to always use a custom template if there is one that corresponds with the post ID:               add_filter( 'single_template', function( $template ) {         // check if there is a custom post template file         if ( file_exists(TEMPLATEPATH . '/single-' . $GLOBALS['post']->ID . '.php') )             // use custom post template             return TEMPLATEPATH . '/single-' . $GLOBALS['post']->ID . '.php';         // use normal post template for everything else         return $template;     });      But now I will end up with a lot of custom template files, that are all the same except some minor changes. **More Thoughts:** I think I would rather like to add dynamic sections within the `single.php` template, to hook in with custom includes/filters? **The Question:** Is there a different (more exclusive) approach to get those kind of _custom_ post templates? **Update:** In a lot of these special cases I need to add some additional StyleSheets or JavaScripts, but also custom container with HTML and also PHP content (this is why I tried to do it with custom templates instead of custom fields). Most of the time the additional elements are above, below or beside `the_content()`.


title: Is there an easy way to flag posts in the admin area?

text: I'm looking for a plugin, or maybe a bit of code (even another example I can look at that does something similar)... I'd like to be able to have certain users 'flag' posts, such that when something has been edited once, there could be a checkbox to say 'flag this for subediting', and then that post can be highlighted in the 'posts' section and easily picked out for subbing and then queued for publishing. Does anyone know of a plugin or something that might accomplish this? I don't really know where to start and my googlings have turned up nothing so far.


title: How to debug a blank page?

text: I'm not being able to load this page, although I can easily load all other posts that load the same custom post type template (please look for "// From now on, WP is throwing a blank page" on that template to pin point where exactly this situation occurs). When turning debugging on, I only get: `Notice: wpdb::escape is deprecated since version 3.6! Use wpdb::prepare() or esc_sql() instead. in /nfs/c01/h04/mnt/38315/domains/joao.pt/html/wp- includes/functions.php on line 2905` What else can I do to understand what's going on here? It doesn't even timeout, it just serves a blank page—tested in all major browsers. Because of the fact that pretty much all other posts with the same template load correctly, I really have no idea how to debug this weird blank page.


title: How can I remove categories in menu in custom post type?

text: I'm creating a custom post type and have added categories taxanomy. This can be done in two ways:               // In $args array     'taxonomies' => array('category'),          // or calling a function     register_taxonomy_for_object_type( 'category', 'my_custom_post_type_name' );      In both cases, an additional child-menu item appears in my custom post menu in the left admin menu. Categories are already showing under `Post` menu, so I don't need it to display again. Any way of preventing this?


title: personal_options hook on Wordpress multisite

text:
I have a working script that hooks to user profile. This is my hook:               add_action('personal_options', array(&$this,'show_bounce_email_warning_to_user'),10,1);       As you can see it will show bounce email warnings at the profile page. This works well when the user access his user profile by this URL for example:               http://my-multisite.com/wp-admin/profile.php      However most users do not login using the root admin page. But to their specific websites (which is a subdomain of the multisite) for example:               http://userwebsite.my-multisite.com/wp-admin/      But the email warning at the personal options page (at user profile) does not appear in any of the user websites under the multisite:               http://userwebsite.my-multisite.com/wp-admin/profile.php      I need the warnings to appear in all user profiles that the user is logged-in. Not just when accessing the root WP admin URL. What is the hook to use? Any tips is highly appreciated thanks! Cheers. **UPDATE:** This is my code for show_bounce_email_warning_to_user function:                function show_bounce_email_warning_to_user($user_id) {          global $current_user;          //Get user ID     $user_id=$current_user->ID;          //Get user email     $user_email_affected=$current_user->user_email;              //Check the status of mailer_bounce_email_detected meta key         $mailer_bounce_email_detected_status=get_user_meta($user_id, 'mailer_bounce_email_detected', true);              if ($mailer_bounce_email_detected_status=='true') {          ?>
         Bounce email detected, please update your email address
     <?php                 }               }      It is fully working but I have problems making that appear in user profiles of the user in his/her other site in a multisite environment. Thanks again.


title: how to add_filter to non hook function

text: the idea is apply some filters if the user select the option in the theme, but i have a problem i made a function that replace the post_thumbnail_html for a personalized html then, i create other function that create thumnails for timthumb i'm trying to apply the add_filter to the timthumb function, but it doesn't work because is not a wordpress hook can you helpme?               function kandombe_theme_thumb($id, $width, $height, $align='') {                  //some code                  $html = '';                  return $html;              }          if ($data['speed_lazy_loading']) {               function kandombe_lazy_loads( $html ) {                  //some code                  $html = preg_replace( '#]+?)src=[\'"]?([^\'"\s>]+)[\'"]?([^>]*)>#', sprintf( '', $placeholder_image ), $html );              return $html;         }          add_filter( 'the_content', 'kandombe_lazy_loads');     add_filter( 'post_thumbnail_html', 'kandombe_lazy_loads');     add_filter( 'kandombe_theme_thumb', 'kandombe_lazy_loads');     add_filter( 'get_avatar', 'kandombe_lazy_loads');          }


title: How to Add And Remove WordPress User Profile Fields And Display Them Within the Theme?

text: I tried the tutorials available at http://teachingyou.net/wordpress/add-and- remove-wordpress-user-profile-fields/ and http://justintadlock.com/archives/2009/09/10/adding-and-using-custom-user- profile-fields Both works quite fine ! My problem is , i want to upload a file (a Doc file )instead of a picture and dispays the download link(of the file) on the user profile page with a Download Button. Also, My site is already Live and has got a few users who are already registered. After , Apllyying this Custom Profile field/s , the new users will automitically add the data where as the old users has to update the field themself. I want myself to update the field by myself in a easy way without loggin in to thier profile . Where can i find the field data in the wordpress Database . Suppose i want to upload/link a Document file for each user , how do i proceed? Many Thanks in advance !


title: How to get Wordpress Adminmenu items?

text: I want to get all the menu items in the admin menu in the backend. To be clear, the menu which is generated from `/wp-admin/menu-header.php`. How can I do this, I see that plugins for instance `Adminimize` does the same, but I have a hard time finding out exactly how. Thanks in advance.


title: How to add a menu to wp admin area?

text: I'm looking for a way to add a menu to wordpress admin area,so admin can publish and edit posts on a specific category through this menu(just like POSTS menu we already have inside wp admin). This section is completely separate from wp POST menu. Posts are separate and shouldn't be shown in other menus.


title: Does theme customizer need theme-customizer.js?

text: I am just getting into using the theme customizer in WordPress. I found a great answer on this site about adding a slider and I got it working just fine. I was reading in the codex about the theme-customizer and it says that after you add your settings, you need to add to the theme-customizer.js file to update your settings. Does this really need to be done? I noticed that without adding my settings to this file that the slider images that I just got working seem to work just fine. So I am a little confused on this step. I can't even find the information that the codex is talking about in the default theme. If you check "Step Two" in this link You will see that it is talking about adding a bunch of javascript to the theme. I don't see that it is needed. Things seem to update just fine without adding any javascript. Even with these settings. The codex says that this stage is optional. I have added 3 photo uploads for a slider. Just to test out the customizer. The theme updates in real time without adding this kind of information about my new controls               $wp_customize->get_setting( 'blogname' )->transport = 'postMessage';     $wp_customize->get_setting( 'blogdescription' )->transport = 'postMessage';     $wp_customize->get_setting( 'header_textcolor' )->transport = 'postMessage';     $wp_customize->get_setting( 'background_color' )->transport = 'postMessage';


title: Display and Allow users to edit their own profiles

text: I'm working on a site that would have different categories of users, and each user will have his own user profile page with a vanity URL, which he can share with others. The users are divided into three categories:   * Admins   * Type 1 (Allow them to edit their profiles)   * Type 2 (Allow them to contact Type 1 users) Here's where I am stuck:   * I'm not able to arrive at a solution which would allow the user to edit his profile page, and add content to it (Like his latest presentation at a conference and such).    * I'm not able to arrive at a solution which would allow the regular users (Type 2) to search for Type 1 users based on their meta (like country or city). It would be great if someone could help me out in this.


title: relating business and products with custom taxonomy?

text: This isn't a code question so much as a how would you do that kind of question. What I can't figure out is how to relate businesses to the the products that they sell. If I've got a custom post type and related taxonomy for a product (post type of product and taxonomies for price, quality, etc.). And I've got the same for businesses (custom post type and custom meta for location details). How do I relate a product to a business? If a user adds a product to the database (ie creates a new post) how can I associate this item with the store it was purchased at? Any help is appreciated. Thanks.


title: Retrieve posts in custom post type and specific taxonomies

text: I'm struggling with what seems like should be so simple looking at the codex. I have a custom post type, let's call it 'portfolio'. A custom taxonomy for that, let's call it 'clients'. I can use get_posts() to list all 'portfolio' items but also need the ability to pass in / filter by the 'clients' taxonomy slugs or display all. ("acme,ibm,tbs" - or null/blank) I've torn apart my sample code so many times that I don't remember anymore what I haven't tried. Maybe I should instead go with WP_Query()? Sorry for probably such a stupid question, I just can't interpret the example apparently.


title: Defined image size not being used when dynamically loading images

text: I'm using an `add_image_size();` of 70x70, in a custom theme. During an ajax request I load a `template_part();` with the defined image size, locally all of these images load fine and at the correct dimensions. When live, though, these images stop being loaded with the correct dimensions and revert to their original size. So basically I could have a 500x500 image loaded and resized to 70x70, not ideal. But this only happens live and not locally, I even uploaded the exact same uploads folder to the live site to make sure I wasn't just missing the 70x70 sized images. Everything is exactly the same theme. Here's an example link of the local image: http://lart.co.uk/wp- content/uploads/2014/02/1-70x70.png Then the exact same image on the live site: http://lartmagazine.co.uk/wp- content/uploads/2014/02/1.png As you can see it's not using the resized image, even though I just literally replaced the live uploads folder with the local one. I don't understand what's going on. here's the image code:               <?php        $title = get_the_title();       $attID = get_post_thumbnail_id($post->ID);       $size = "category-thumb";       $image = wp_get_attachment_image_src( $attID, $size );            if ( get_the_post_thumbnail() != '' ) { ?>          <img alt="<?php echo $title; ?>" title="<?php echo $title; ?>" src="<?php echo $image[0]; ?>"/>     <?php } ?>      and I call this function when I trigger the ajax request:               function side_scroll(){         $offset = $_POST['offset'];         $category = $_POST['cat'];         $args = array('orderby' => 'date','posts_per_page'=>10, 'offset' => $offset, 'orderby' => 'date', 'cat' => $category,'post_status' => 'publish');          $loop = new WP_Query($args);         while($loop->have_posts()) {         $loop->the_post();          get_template_part( 'sidebar-posts-template' );         } wp_reset_postdata();         die('');     }      and of course the image size:               function add_image_size() {          add_image_size( 'large-landscape', 1600, 9999 );          add_image_size( 'gallery', 500, 9999 );         add_image_size( 'large-portrait', 330, 9999 );         add_image_size( 'home-thumb', 200, 9999 );          add_image_size( 'category-thumb', 70, 70 );      }


title: If in_category not working for multiple single.php pages

text: I searched far and wide (on here & Google), reading about how to have **multiple single.php pages** for different categories of posts. The consensus was to do something like this:               <?php     /*         Template name: Single     */     ?>     <?php          $post = $wp_query->post;          if ( in_category('blog') ) {         //echo 'category is 3 which is blog-single';         include(TEMPLATEPATH . '/blog-single.php');      }           elseif ( in_category('projects') ) {         //echo 'category is 4 which is project-single';         include(TEMPLATEPATH . '/project-single.php');      }           else {         //echo 'category is neither of the above so default is selected';         include(TEMPLATEPATH . '/project-single.php');     }          ?>      But for whatever reason this is not working for me. It always goes to the `else` statement when I click on a blog post of a project post. The page above is called `single.php` and the two other pages are named `project-blog.php` & `blog-single.php` exactly. I attempted to comment out the `include(TEMPLATEPATH..` and just echo some text, but it always would go straight to the `else` no matter which post I click on. I have triple checked the the category ID is correct for each `if` statement (see image below). I also tried to make it `is_category` instead of `in_category` as well as also trying to put the category name in place of the category_id (for example blog or projects). What am I doing wrong? Here's a screen shot of the URL from when drilling into a Category showing that the category_id (tag_id) is indeed correct. I hope this is enough info... ![http://i.imgur.com/obsIT1w.jpg](http://i.imgur.com/obsIT1w.jpg) **edit:** I even tried this...               if ( in_category('blog') || is_category(blog) || is_category('blog') || in_category(blog) || is_category(3) || is_category('3') || in_category('3') || in_category(3) ) {      And I changed my permalinks to include the category in them. So now project- single is working but not blog...


title: Multi-image upload doesn't work

text: I just installed Gravity Forms 1.8 and made a form with a multi-upload field. The field shows up alright, but the field just, doesn't works. Clicking the Select Files does nothing, and dragging files in the zone only opens the file in my browser. There is no errors in the console of Chrome and Firefox What could prevent the field from working?


title: Post Fetching Ignoring Sort_Column?

text: I am using the code below subpages for my portfolio. For some reason, it seems to be ignoring the ordering I have set on my pages. Any help?                  <?php         $args = array(             'post_type' => 'page',             'sort_column' => 'menu_order',             'post_status' => 'publish',             'posts_per_page' => -1,             'post_parent' => $post->ID,         );         $query = new WP_Query($args);         while ($query->have_posts()) {         $query->the_post(); ?>


title: Save jQuery UI Sortable on Wordpress

text: I have basic jQuery UI sortable code that works perfectly. I just want the position of each item to save when a user changes it. I am using Wordpress multisite version 3.8.1 and each site will have it's own sortable area so it needs to save in a different database for each site. I did see this post but it isn't quite what I was looking for. It might help though. HTML:                   `<ul id="sortable">          <li class="ui-state-default">Item 1</li>          <li class="ui-state-default">Item 2</li>          <li class="ui-state-default">Item 3</li>          </ul>`      jQuery:                   `<script>          $(function() {          $( "#sortable" ).sortable();          });          </script>`


title: Embed phpBB within Wordpress?

text: Using Wordpress v3.1.1 to setup a new CMS.   BBPress is not satisfactory, therefore I have chosen to use phpBB for the forum platform. I have the wordpress bones laid out, and also settled on the boldy theme (Site5).   I would like to retain this theme for the Forum, so I need to find out how to embed a phpBB forum within Wordpress. **How do you embed a phpBB forum within a Wordpress theme?** _I had heard good things about WP-United, but their website has been down for over 3mths now, and the author has not responded to my emails. Therefore I am concluding that the developer is retiring the plugin, and my confidence in it being futureproof is low._


title: Calling Data from Custom Meta Box

text:
I have created a custom meta box which I have pasted in functions.php (minus the `<?php` call of course) I have two fields in this meta box, one is labeled 'Primary Title' and the other is labeled 'Secondary Title'. How do I call data from each of these boxes _individually_ so that I can insert them into the template of a page?               <?php     $prefix = 'dbt_';     $meta_box = array(       'id' => 'my-meta-box',       'title' => 'Custom meta box',       'page' => 'post',       'context' => 'normal',       'priority' => 'high',       'fields' => array(         array(          'name' => 'Primary Title',          'id' => $prefix . 'text',          'type' => 'text'         ),         array(          'name' => 'Secondary Title',          'id' => $prefix . 'text1',          'type' => 'text',           )          )     );          add_action('admin_menu', 'mytheme_add_box');          // Add meta box     function mytheme_add_box() {       global $meta_box;       add_meta_box(         $meta_box['id'],         $meta_box['title'],         'mytheme_show_box',         $meta_box['page'],         $meta_box['context'],         $meta_box['priority']       );     }          // Callback function to show fields in meta box     function mytheme_show_box() {       global $meta_box, $post;       // Use nonce for verification       echo '<input type="hidden" name="mytheme_meta_box_nonce" value="';       echo wp_create_nonce(basename(__FILE__)), '" />';       echo '
';       foreach ($meta_box['fields'] as $field) {         // get current post meta data         $meta = get_post_meta($post->ID, $field['id'], true);            echo '
';         echo $field['name'];         echo '	';         switch ($field['type']) {           case 'text':             echo '<input type="text" name="' . $field['id'] . '"';             echo ' id="' .$field['id'] . '"';             echo ' value="' . ( $meta ? $meta : $field['std'] ) . '"';             echo ' size="30" style="width:97%" />';             echo '
' . $field['desc'];             break;         }         echo '
';       }       echo '
';     }          add_action('save_post', 'mytheme_save_data');          // Save data from meta box     function mytheme_save_data($post_id) {         global $meta_box;         // verify nonce         if (!wp_verify_nonce($_POST['mytheme_meta_box_nonce'], basename(__FILE__))) {           return $post_id;         }         // check autosave         if (defined('DOING_AUTOSAVE') && DOING_AUTOSAVE) {           return $post_id;         }         // check permissions         if ('page' == $_POST['post_type']) {           if (!current_user_can('edit_page', $post_id)) {             return $post_id;           }         } elseif (!current_user_can('edit_post', $post_id)) {           return $post_id;         }         foreach ($meta_box['fields'] as $field) {           $old = get_post_meta($post_id, $field['id'], true);           $new = $_POST[$field['id']];             if ($new && $new != $old) {             update_post_meta($post_id, $field['id'], $new);           } elseif ( '' == $new && $old ) {             delete_post_meta($post_id, $field['id'], $old);           }         }     }     ?>


title: my example with ajax doesn't work

text:
i'm trying to use ajax with a simple example, i took the example from : http://ocaoimh.ie/2008/11/01/make-your-wordpress-plugin-talk-ajax/ example N°5 (which doesn't work actually as it is) So i'm trying just to get the result from the php page, located in /wp- content/ajax-php.php, but nothing, except the alert, seems to react. Could you have a look and tell me if you see something wrong? :               <?php                 /*                 Plugin Name: ajax with images                 Plugin URI: http://ocaoimh.ie/                 Description: A simple hello world plugin, taken from here                 Version: 0.1                 Author: Donncha O Caoimh                 Author URI: http://ocaoimh.ie/                 */                      function helloworld5_scripts() {                         global $current_user;                         if( !$current_user->ID )                                 return;                         if( is_single() ) {                                 wp_enqueue_script('jquery');                         }                 }                 add_action( 'wp_print_scripts', 'helloworld5_scripts');                      function helloworld5_head() {                         global $current_user;                         if( !$current_user->ID )                                 return;                         if( !is_single() )                                 return;                         ?>                                          <?php                 }                 add_action( 'wp_head', 'helloworld5_head' );                      function add_thumb_to_post( $content ) {                         global $post;                         global $current_user;                         if( !$current_user->ID )                                 return $content;                         if( !is_single() )                                 return $content;                         return $content . "

";                 }                 add_action( 'the_content', 'add_thumb_to_post' );                 ?>      Thanks


title: Geo Blocking in Wordpress - how can it be implemented?

text: I've tried to search for a geo-blocking plugin for wordpress - didn't find anything. So thought to ask here if anyone knows of a geo-blocking solution for wordpress sites? Thanks.


title: Mimicking admin panel menu from wordpress 3.0.1

text: I have chosen from a variety of menus for my application only one and it was a wordpress 3.0.1 admin panel menu, but I can't get pass the functionality of it. If to be more distinct I can't understand how the sliding in this menu work. Is there a jQuery function for every element of the menu or they made it with no link to the specific menu item and how does it remember the state (is menu item open or closed)? I hope I asked this question in the correct place. Thank you all for help.


title: Add posts from other Wordpress blog to the current one

text: This might seem like a duplicate, but other questions I've found seem to be about exporting/importing Wordpress, as a 1 shot deal. My situation here is quite different; I'm looking for a method/plugin that would write in the posts as they are posted on another site. Here is a more detailed way to explain it. My client has a blog, with his new site. He also has 3 kind of subblogs on other sites on other domains. The behavior we want is that if he posts something on the subblogs, it gets also posted on the main, new blog. We can't run on multisite, the subblogs are already been running for a year, and there's enough traffic on it to not being able to take them down to make an update. Anybody would know a plugin, or a method within functions.php (We do have access to the code) that could make that happen?


title: How do i pick the pages in 20-11 header?

text: With the 20-11 theme when i add a page it shows in the header. I like this. I found and changed the order of them in quick edit. Now i would like to hide a few pages from the header. How do i do this? -edit- i see i can do it in css by writing `.page-item-NUMBER { display: none; }` this is acceptable since i have root access (all my files are readonly) but how might i do this through the admin panels?


title: Having a variable based on $post_count increase when i move to the next page of results

text:
I couldn't figure out the best way to write the title, so first of all I hope you understood what i was trying to get across. I have a snippet of code on my template page that fires after the wp_query to display a heading as such: showing x of y results for ... and the code:               elseif ($size_option&&!$color_option&&!$genre_option) {     echo '
Showing ' . $wp_query->post_count . ' of ' . $wp_query->found_posts . '    results for ' . $size_name . ', all colors, all genres
';}      As such it will show something like - showing 12 of 17 results for ... However the issue is i have my posts_per_page set to 12. So when i go to page 2 (for a query that results in found_posts being 17), we get - showing 5 of 17 results for ... Which is just illogical. My question is how could i get it to show the following for once again, a total of 17 posts: On page 1 - showing 1-12 of 17 results for... On page 2 - showing 13-17 of 17 results for... I have an idea of what i should use, but no idea on how to go about it. Im guessing i need to implement some kind of count, based on the 'paged'=> $paged arg from my wp_query. Any help would be wondeful. Thank you, once again! Mike as requested by Johannes, my query :               $wp_query = new WP_Query ( array(                                     'post_type' => 'tshirt',                                     'posts_per_page' => 12,                                     'paged'=> $paged,                                     'colors' => $color_option,                                     'size' => $size_option,                                     'genres' => $genre_option));


title: Can i put 'page' at the bottom of each page?

text: I would like to use wp-admin to make a "page" which is used at the very botton of each pages. The bottom part would look like the below > Home | Tips | Services | Downloads | Workshops | Testimonials | Resources | > Contact us but on top of that it will be complex. A logo+links+images. Something you would find on a page rather then a menu How do i create a page with the editor and have it display at the bottom of each page?


title: Including wp-blog-header.php from functions.php remote call?

text: I have a script that's called from my functions.php file (via an ajax .get) that needs to have access to WP's get_option() method in order to retrieve some values it needs to process. However, although the file works great in the majority of sites where it resides, on just a few installations, I'm having problems with the script operating (chrome's javascript console reports a 404 (not found) on color.php.               //jQuery calls the file color.php          $('#my_theme_switcher').change     (         function()          {             $.get             ('<?php echo get_bloginfo('template_directory') ?>/color.php',              {theme: 'test', spot: '1'},              function(data)                 {                     doColor('#theme_header_color', data);                 }             );         }     );               Here is the file color.php          <?php     require_once('../../../wp-blog-header.php');     echo 'all good';     ?>      In this case, I never get the echo since it appears that the require statement has failed to load the wp-blog-header.php Is there an alternative way of including the header file in order to be able to call get_option()?


title: Background tiles not working in iPad2 but ok everywhere else

text: A new site I'm working on is looking good in the major browsers, mac and pc, but something's wrong when viewed on an iPad2 - specifically the background tiles. In this design I use one giant bg image for the homepage, and a slightly different version for all the rest of the pages. I have a header.php and and header-2.php, and header.php has:                <body id="homeback">       and the header-2.php has                <body id="insideback">      When I remove the background tiles the rest of the page content all render normally; when I add the tiles they appear distorted and create a weird sort of margin. The tile is "expendable" for the inside pages but critical for the homepage. See http://66.147.244.93/~weddioi2/ for the site under construction. We'll be adding a slideshow in place of the photo in the left column on the homepage and we're still fussing around with little details on inside pages but it's nearly done. Any help would be greatly appreciated!!


title: Multisite - how to remove the root '/' site?

text: I want to install WP in 3 languages: en, ro, ru               mysite.com/en     mysite.com/ro     mysite.com/ru      I was not sure, but installed WP in the root folder. Now I need to redirect visitors to default language. Say "en". AND I don't need having 4 sites actually: `/`, `/en/`, `/ro/`, `/ru/`, but 3. The situation is actually like this ![](http://lh3.ggpht.com/_1TPOP7DzY1E/TM2VCW- kGdI/AAAAAAAADX0/fltjT6EIJjA/s800/Capture1.jpg) I can't "remove" the "/" site, actually


title: Out of Memory - Line 791 of WP-DB.php (mysql_real_escape_string)

text: **Update** The end result is that I did not account for Apache memory limits. There were limits placed on the Apache process which caused PHP to be limited regardless of the settings placed on it. Changing these values in httpd.conf, helped. Hello, I am encountering an error with a recently launched site that although the pages display, I am severely limited by the number of plugin's that I can enable. We started to see an error occur:               Fatal error: Out of memory (allocated 24903680) (tried to allocate 1802297 bytes) in /home/normal/public_html/normalpl.org/wp-includes/wp-db.php on line 791      Now we have tried the usual fixes of increasing PHP and Wordpress memory allocations (have a VPS, with full root) all the way up to 256MB but with no affect on the error. The following are the plugins enabled: CMS Tree Page View WP-DBManager Login Lockdown Contact Form 7 Now enabling any other plugins will start to cause these memory errors to occur. Almost always on Post/Page save operations. Notably, All in One SEO or Yoast SEO or W3 Total Cache, but others will also cause this to occur. I noticed that in the database there were some strange Unicode Code Points that had been brought in by a cut/paste from Word and so I went through all of the Posts/Pages and escaped all of the entities so that they were not unicode but HTML Entities. Unfortunately, the error was still occurring upon enabling one of the above plugins and saving a post/page. I wiped out all files/configurations and started with a fresh install of Wordpress and re-imported the existing database to make sure there wasn't something strange in the files and I still encountered the issue. I feel that I am stuck on thinking that there is some strange escaping bug going on when it hits that mysql_real_escape_string function as removing that and just dumping the plain string into the database works (but is horrible for XSS and proper MySQL escaping). In addition, the error happens when using the older method of Add_Slashes, and I also noticed that Magic_Quotes_GPC is on if that helps. Thanks for all of the assistance, this is a baffling one for me. -Adam


title: GPL 2 Theme using a framework for commercial Theme?

text: I'm new to WordPress and I have a question about license. Can I use a GPL 2 Theme (downloaded from http://wordpress.org/extend/themes/) as a framework for Commercial Theme? I searched and I found that Yes as long I keep the same License, but what are the changes I can make? Can I modify the Author.... Name ... from style.css? What are the credits I have to add?


title: passing variables as parameters to stored procedures via wpdb from php-script

text: i am having a slight problem with passing php-variables to a stroed procedure call from a php-script. Here comes the details: This is how it works very perfect - passing the params as `string`:               $myHTML = $wpdb->query( 'CALL show_average_time_spent(2, "2011-10-24", "2011-10-24", @myHTML)' );      Brings back a perfect result. And this is how it not works and throws the error (passing params as variables):               $date_from = '2011-10-24';     $date_to = '2011-10-27';     $myHTML = $wpdb->query( 'CALL show_average_time_spent(2, $date_from, $date_to, @myHTML)' );      throws this error: > WordPress database error: [Unknown column '$date_from' in 'field list'] CALL > show_average_time_spent(2, $date_from, $date_to, @myHTML) The `$date_from` is only used in this php-script for holding the selected date. i realy appreciate any kind of help with this issue. Thanks to all of you trying to help solving this problem. Cheers, Joe


title: Custom Roll/Custom Post Type - Can't Select Categories

text: I am using Justin Tadlock's Members plugin 0.2.4. I have a custom user role "Author" that I am granting permission to post a Custom Post Type "blogpost". The Author can post and edit the CPT blogpost however cannot add categories as the check-boxes are grayed out. Others have reported similar problems in his plugin's support forum over a year ago but the the user's question seems unanswered and is now closed. I am aware that enabling the "edit_posts" capability fixes the problem however gives the custom user role access to all post types which they should not have and is very bad. Some have tried creating custom taxonomies to work around this, which reportedly worked for their custom user role. However, that does not work for my site as I have built it primarily using the default taxonomy provided in the core and I am quite far along in development. Any help explaining to me what I have done wrong, or how to better configure Justin Tadlock's Members plugin would be very greatly appreciated. Thank you.


title: WooCommerce add class name in the list

text:
Currently, I am trying to customise the override WooCommerce.php file. Now, in this file,

     <?php woocommerce_content(); ?>

      The output likes:

I-Phone Vector Template
         $2                  Add to cart
      What I am trying to do is to change the class name, currently the class name is `post-15 product ...`. I would like to change the class name to product category. Could someone help me?


title: How can filter terms by custom meta data

text: I have terms and i get data like :-                $cat = get_terms( "progamdvideo_c", $args ) ;                  foreach ($cat as $term) {                      echo $term->slug;                  }      Now i have `metadata` for this term that name is `prog_auther`, How can i get all term where `prog_auther = "teacher"`. thankx


title: Moving WordPress.com site to personal domain intact

text: The question is asked many times in different forms, but can't find my answer from any of 'em. Question is self explanatory, but need to mention some scenario:   * I'm not moving to `.org`, it's a personal domain, I've bought from somewhere else.   * I know how to export and import content from WP site.      * But if I do that, the images are not copied, they are sharing their path from the previous `.com` site. (To let it not happen, I'll need to manually download all the images and then to upload 'em to new site: That's not a solution.)   * How to export and import data from `.com` to personal website where all the attachment paths are also transferred. So that, they doesn't require to go to the old site. I hope I'm clear with my demand. I'm really struggling with this.


title: Taxonomy Checkbox Admin Panel

text: I have a basic Admin panel allowing Admin to save options using Checkbox. Checkboxes are used as multiple selection is necessary for the option So, Admin Option - Checkbox 1 - Checkbox 2 - Checkbox 3 etc My Checkboxes are generated on the fly, successfully with `<input type="checkbox" name="firm" id="firm-<?php echo esc_attr( $term->slug ); ?>" value="<?php echo esc_attr( $term->slug ); ?>" <?php checked( true, is_object_in_term( $user->ID, 'firm', $term ) ); ?> /><input type="checkbox" name="firm" id="firm-<?php echo esc_attr( $term->slug ); ?>" value="<?php echo esc_attr( $term->slug ); ?>" <?php checked( true, is_object_in_term( $user->ID, 'firm', $term ) ); ?> />` Then when saving my option, I am trying to do it with `wp_set_object_terms( $user_id, array( $term ), 'firm', false);` BUt only the last term is saved and not the array (if more than 1 checked) Any idea?


title: Child theme breaks after update of master theme

text: I have a theme, lets call it Master. I manually created a child theme, lets call in Master-Child and added some files into it. All worked well until a notification came that I should update the Master because of a new version. The child theme has failed to work since. I get an error message "Master theme does not exist" although "Master" is activated. I tried to rename, capitalize and lowercase all characters. Thanks a lot.


title: get_template_directory_uri cached?

text: I'm having a little problem with a wordpress installation. Basically, I have two servers: `test.dev` and `staging.dev`. Set up (using the hosts file) and I've just copied the `test.dev` WordPress installation over to the staging server. Works brilliant on my computer but on someone who doesn't have `test.dev` none of the CSS or images load. I looked into it and every path is still referencing `test.dev`. I have this function in `functions.php`:               function route_static_path($path)     {         echo get_template_directory_uri()."/".$path;         return true;     }      I thought the value for `get_template_directory_uri()` might be set in `wp- config.php` but it's not. I'm really confused as to where this is coming from.


title: Should I change the default file and folder permissions?

text: After reading the Hardening WordPress article I realise a good permission scheme is essential to the security of my WordPress installation. The article suggests a possible permissions scheme but my question is: considering WordPress arrives 'out-of-the-box' with a default permission scheme in place, do I need change it? If so, please explain why.


title: Prevent post from being published if no category selected

text: I do not want a user to be able to publish a post if no category is selected. I don't mind throwing a JS alert or handling this on the server side as well. Anyway, how can I ensure this? Note: "uncategorized" should not be chosen as well.


title: Get user's most published categories

text: I am working on listing all users similar to the Users page here on SE. When listing each user, I want to add their 2 categories they have published most into. All categories are within `Posts`. Performance is essential, therefore I've come up with a sufficient solution:   1. Make a function (with `$user_id` as argument) that returns category name of the user's two most published categories.   2. Create a daily `wp_schedule_event()` WP Cron that uses the above function and gets all users respective categories and finally adds it to each user's metadata via `add_user_meta()`.   3. Simply get the users' categories via `get_user_meta()` on the Users page. Currently, I have the cron and metadata codes ready, **all I am missing is the function that returns the users top 2 categories**. Can you help with this function?