title: wordpress file upload with ajax when site is ajaxyfi

text: I am getting problem in upload any file. My word press site is using Ajax Page Loader Plugin.So page is not refreshing when the form is submitting.. I am not getting any value in `PHP` code in functions.php in **print_r($_FILES);** But i am printing any string with `echo();` it is printing but why **print_r($_FILES);** is not getting any value. **HTML form**               <form id="career_form" name="career_form" enctype="multipart/form-data">                  Upload : <input id="career_resume" class="field" style="height: 25px;" type="file" name="career_resume" multiple />	         <input type="hidden" name="action" value="career" />         <input id="submit_button" onclick="submit_career();" type="button" value="Send" />     </form>      **j Query**               function submit_career()     {         jQuery.post(the_ajax_career.ajaxurl_career,             jQuery("#career_form").serialize(),                 function(response_from_the_action_function){                     jQuery("#errfrmMsg").html(response_from_the_action_function).css({"display":"block"});                 }             );     }      **Php code in functions.php**               wp_register_script("ajax-career", get_bloginfo('template_directory')."/js/custom_js.js", array( "jquery"));         wp_enqueue_script('ajax-career');         wp_localize_script("ajax-career","the_ajax_career", array("ajaxurl_career" => admin_url("admin-ajax.php")));         // add actions         add_action( "wp_ajax_career", "ajax_action_career" );         add_action( "wp_ajax_nopriv_career", "ajax_action_career" );              function ajax_action_career(){                   //Nothing getting in this print_r($_FILES) function;                  foreach ($_FILES["career_resume"]["error"] as $key => $error) {                 if ($error == UPLOAD_ERR_OK) {                     $name = $_FILES["career_resume"]["name"][$key];                     move_uploaded_file( $_FILES["career_resume"]["tmp_name"][$key], "uploads/" . $_FILES['career_resume']['name'][$key]);                 }             }         }


title: Best way to strip character entities (%20 etc)

text: I have a heap of images inside MovableType, on an old server. There are plenty which have character entities like %20 to represent spaces. I've used some plugins to import the images and change the URLs inside posts, but while MT can deal with /my%20dog.jpg, WP just shows a 404. Assuming there's no way to get WP to display these images, and I have to rename them, what's the best way to:   * Rename all the files (strip out character entities)   * Rename all the URLs referenced in posts I'm a little bit stuck here and not sure what the best way of solving this would be, whether via SSH and SQL queries, or otherwise.


title: Consuming an external API to publish/post to wordpress

text: Is there a solution or a way to consume an external web service API (could be JSON or SOAP) to be able populate/update a wordpress blog ? For example using wikipedia api to pull content that wikipedia.com has on the topic the post is about. I tried searching this topic alot online and all i found was how to create a API out of already exisitng posts in wordpress. Any suggestions or ideas ?


title: Joining tables not working in the post editor page

text: I am developing a plug-in which stores data in a custom table and is joined onto the `wp_posts` by the post's the id. I then use the `posts_join` and `post_fields` filters to join my table and be able retrieve data from it. For example:                   add_filter('posts_join', 'my_join' );         function my_join( $join ){             global $wpdb;              $join .= "LEFT JOIN wp_my_table ON $wpdb->posts.ID = wp_my_table.postID ";                   return $join;         }      This works well on the front end (and even most of the admin), but when a post is being edited, the join doesn't seem to happen. For instance, in my plugin's custom metabox on the edit page, `var_dump($post)` reveals all the standard fields, but none of my plugin's. When a post is being edited, does it skip the `posts_join`, `posts_fields` filters? Is there another hook that can be used? * * * **Update** I have done some further tests. Let's suppose I am on; _../post.php?post=703 &action=edit_. As in my comment to Chris' response, the `the_post` hook reveals that the table has been successfully joined at that point (and the post is 703). On the other hand there are two calls to `posts_selection` and both are for revision posts that are the children of 703. (I have attempted joining to their parent, but this does not work - even after ensuring filters are not suppressed). I can, of course, just retrieve my data inside the metabox - but I would like to know if it would be possible to avoid having to do this. (And quite what goes on when click to edit a post :D!)


title: Page thumbnail doesn't display on navigation

text:
I want to display thumbnail on navigation (using walker) but it doesn't display in the right place. Thumbnails displays only in index.php, before the navigation links and all these thumbnails are same.               class Footer_Navwalker extends Walker_Nav_Menu {           function start_el(&$output, $item, $depth, $args) {       $classes = empty ( $item->classes ) ? array () : (array) $item->classes;            $class_names = join(       ' ',       apply_filters(           'nav_menu_css_class',           array_filter( $classes ),           $item         )       );            ! empty ( $class_names )         and $class_names = ' class="'. esc_attr( $class_names ) .'"';            $output .= "
ID' $class_names>
";            $attributes  = '';       ! empty( $item->attr_title )         and $attributes .= ' title="'  . esc_attr( $item->attr_title ) .'"';       ! empty( $item->target )         and $attributes .= ' target="' . esc_attr( $item->target     ) .'"';       ! empty( $item->xfn )         and $attributes .= ' rel="'    . esc_attr( $item->xfn        ) .'"';       ! empty( $item->url )         and $attributes .= ' href="'   . esc_attr( $item->url        ) .'"';            $thumbnail = '';       if( $id = has_post_thumbnail( (int)$item->object_id ) ) {         $thumbnail = the_post_thumbnail( $id );       }            $title = apply_filters( 'the_title', $item->title, $item->ID );            $item_output = $args->before;         $output .= "";         $output .= $args->link_before;         $output .= $title;         $output .= ' ';         $output .= $args->link_after;         $output .= $thumbnail->link_after;         $output .= $args->after;         $output .= '
';      }     }


title: Is it possible to control the width of the Wordpress audio player?

text: Is it possible to control the width of the Wordpress 3.9 Audio player? I like the simplicity of the player control and would like to include a narrow-width version of it in a table that lists all of the songs in an album. So something like:               [audio mp3="myfile.mp3" width="120px"][/audio]      Also, is there a reference somewhere that explains how the audio player can be styled (colors, etc.)? Thanks in advance for any help!


title: Advanced Custom Fields - Get custom fields from parent page

text: I'm using Advanced Custom Fields making it easier for my client to manage his content. On all of my child- and parent pages i would like to have the same header image and sidebar information. Allthough i wish to make "Parent Page #1" and "Parent Page #2" have different information and this is controlled with Advanced Custom Fields by the Client. Right now the cleint goes to every parent and child page to fill out the information manually - i would like it to only be filled out on the Parent page. Making the Child pages get the information from their parent page. **Parent Page #1**   * Child page #1 - Should get Custom Field values from "Parent Page 1"   * Child page #2 - Should get Gets Custom Field values from "Parent Page 1"   * Child page #3 - Should get Gets Custom Field values from "Parent Page 1" **Parent Page #2**   * Child page #1 - Should get Gets Custom Field values from "Parent Page 2"   * Child page #2 - Should get Gets Custom Field values from "Parent Page 2"   * Child page #3 - Should get Gets Custom Field values from "Parent Page 2" So here's my question. On my "parent page template" I use the following to generate the image:               <img src="<?php the_field('header_image'); ?>">      So how do I, on my "Child page template" get the field "header-image" from the parent page of the child page?


title: Can admin-ajax.php be used for spam purposes? And if yes, how to prevent that?

text: Today I've got a letter from my hosting provider that admin-ajax.php script had been sending spam until it was blocked. About two thousand spam messages were sent to different emails. I know if you have proper mail function in your functions.php you can simply run the next code from Google Chrome console:               $.ajax({         type: "POST",         url: '/wp-admin/admin-ajax.php',         data: { action: 'mail_function', message: 'test'},         dataType: "html",         success: function(data) {              }     });      Is there another way to do it and any suggestions where I may find vulnerability? * * * I am using ContactForm7 plugin for userforms


title: Difference between page and paged

text: I have created a CPT that has an archive. When it comes to navigate between the pages, I have to use the page querystring like the snippet below.               $current = get_query_var('page') ? get_query_var('page') : 1; // Get query var        If I do use the paged one, for some reason my archive pages end up to generate a 404 error and I can't figure this out. Can you please explain? Thanks Andrea


title: Wordpress test environment on windows

text: I'm new to TDD and want to set up a test environment for my wordpress plugin. I was able to find a sample plugin from wp-cli with the very useful script. It was very easy to write the first test cases and let them execute from travis ci. The problem: I don't want to execute the test only after a commit but continuously while development on my machine. But I'm working on a windows machine.. (mingw installed) I'm wondering how all the plugin developer setup their test environment automated with such a script. I found open source plugins but they all use this script. It would mean all of them use linux for development or I'm doing something wrong (which seems to be more likely). But I can't figure out how they do their test on none-unix-systems. Any suggestions to this? **UPDATE** I have installed VVV and all is up and running. I created a sample plugin `wp scaffold plugin myplugin` But if I want to execute my tests I get the error that > PHP Fatal error: require_once(): Failed opening required '/tmp/wordpress- > tests-lib/includes/functions.php' > (include_path='/usr/local/src/composer/vendor/phpunit/php-text- > template:/usr/local/src/composer/vendor/phpunit/phpunit-mock- > objects:/usr/local/src/composer/vendor/phpunit/php- > timer:/usr/local/src/composer/vendor/phpunit/php-token- > stream:/usr/local/src/composer/vendor/phpunit/php-file- > iterator:/usr/local/src/composer/vendor/phpunit/php-code- > coverage:/usr/local/src/composer/vendor/phpunit/phpunit:/usr/local/src/composer/vendor/symfony/yaml:/usr/local/src/composer/vendor/phpunit/php- > invoker:.:/usr/share/php:/usr/share/pear') in /srv/www/wordpress- > develop/src/wp-content/plugins/awesome-plugin/tests/bootstrap.php on line 6` So the test environment is not installed yet. So I executed `./install-wp- tests.sh wordpress_unit_tests wp 'wp' localhost`. Is this the correct way or is the use of wordpress_unit_tests dangerous? I can't find information how to install the wordpress test environment the right way anywhere?!


title: How to prevent wordpress from loading old versions of jquery in wp_head();?

text: I noticed my twenty twelve theme is including outdated versions of jquery and js so I want to replace the scripts with the newer versions, however the scripts are in the file included by wp_head() (which I think is in wp- includes) so adding the scripts to my header means jquery will be loaded twice, I see now way to remove the scripts from wp_head() without messing with wp-include and any changes I do will probably be lost if I update wordpress. So how can I remove the scripts from wp_head() permanently?


title: Add captcha validation to my custom form for Frontend posting

text: i have implemented the frontend form, which enables UNREGISTERED users to post on my site. Everything in working perfectly, the only problem I have is with the implementation of the captcha. All of the captcha solutions I found needs to put some outer file in the form action. But my form has this syntax:               <form action="">       I do not know what to do? If I put the file in the action field, I cannot add the post anymore. How would I put the verification code for the captcha in the same file as the form is? Or any better solution? EDIT: How can I modify the form, that it would do the same thing (add post) as it does it now, but that I could include some file in the form action:               <form action="some.php">


title: How to work on a live WPMS blog when domain is unresolved?

text: How does everyone work on a live blog in WPMS when the domain name still points to a different server/IP? I need to configure the site before the domain Name Server settings are changed to the new host.


title: How to load library scripts in admin from plugins in noConflict wrapper?

text: For my plugin I need to make a meta box for some custom fields in my CPT (`xyz`), and to organize the fields, I need to implement tabs. And I's taught to load jQuery/JavaScripts using `wp_enqueue_script()`, so from my plugin, I entered the following (with Chip Bennett's suggestion in mind, I excluded `wp_register_script()` and used only the `wp_enqueue_script()` and _avoided_ deregistering built-in scripts):               function my_scripts() {                  wp_enqueue_script( 'jquery-lib-scripts', plugins_url( '/js/jquery-1.10.2.min.js', __FILE__ ) );         wp_enqueue_script( 'jquery-ui-for-tabs', plugins_url( '/js/jquery-ui.js', __FILE__ ) );         //wp_enqueue_script( 'plugin-scripts', plugins_url( '/js/plugin-scripts.js', __FILE__ ) );              wp_enqueue_style( 'plugin-style', plugins_url( 'plugin-style.css', __FILE__ ) );          }          add_action('admin_enqueue_scripts', 'my_scripts');      So the files are loading globally in admin panel. Everything's fine, though I's full aware about the built-in WP admin scripts `jquery`, `jquery-ui-core`, and `jquery-ui-tabs`. But somehow my scripts are not conflicting, and is working with my tabs in my CPT's `post-new.php` (Add new) page; but is breaking the tabs in `post.php` (Edit screen of CPT `xyz`). I am working on my dev. environment localhost using WAMP, and using WP 3.9.1, while I tried deactivating all other plugins and tried switching to default T14 theme. Just found that, with my code the tabs are working in all pages, but if I activate any other plugin, even Akismet, it's **CONFLICTING**. I've learned about the noConflict wrappers, but assumed they are only for custom scripts, but **how can I enqueue library scripts for my plugin in a noConflict wrapper?**


title: force_ssl_admin() causing issues with preview links

text: I have recently enabled my WordPress website to use an SSL Cert for administration/login pages. I am using the plugin W3 Total Cache with my Content Delivery network. I have noticed that when I am viewing all posts and click on the preview link, it sends me to a still secured web-page that is NON-relevant to the admin pages. This causes issues with mixed content being received from my CDN (insecure) and my web-server (secure). Is there a RewriteRule I could use that would fix this or have I missed a setting that should not be causing this to happen? I do not want to use HTTPS on ANY front-end pages, except for the login page. Even when I am previewing posts, as this is unnecessary and causes issues. Any help?


title: WordPress pages are not published due to External database connection with WPDB class

text: I am developing a **wordpress plugin** that connects to external database, fetch data, and displays it on metabox below page/post editor. I used following code:               <?php     /** MySQL hostname */     define('EXT_DB_HOST', 'localhost');          /** MySQL database name */     define('EXT_DB_NAME', 'trader');          /** MySQL database username */     define('EXT_DB_USER', 'root');          /** MySQL database password */     define('EXT_DB_PASSWORD', '');          /** MySql table prefix */     define('TABLE_PREFIX','sc_');          $new_wpdb=new WPDB(EXT_DB_USER, EXT_DB_PASSWORD, EXT_DB_NAME, EXT_DB_HOST);          ?>       Saved this file as _wp-db-config.php_ Included this file in constructor of main plugin class and I used AJAX for fetching data. The data is shown in metabax below editor in both posts and page. I got success in adding, getting, deleting, updating data. The main problem arise is that I cant update or create new post and page. I googled this problem but I didnt get solution. Please help me out of this problem. its very urgent for me.


title: Custom post type (with parent-child relationship) singular page with pagination

text: I'm building a site that has two custom post types: **Auction** and **Lot**. Lots are connected to an Auction via the **post_parent** field. The **single-auction.php** template show 9 lots of an auction using the following query:               $args = array(         'post_type' => 'lot',         'posts_per_page' => 9,         'order' => 'ASC',         'post_parent' => $auction_id     );     $paged = (get_query_var('paged')) ? get_query_var('paged') : 1;     $wp_query = new WP_Query( array_merge( $args, array('paged' => $paged) ) );      The pagination, though, doesn't work. When I go to:               http://domain.com/auction/{auction-title}/page/{page-num}/      WP redirects me to:               http://domain.com/auction/{auction-title}/      Therefore I can only see the first 9 lots of an auction. Any ideas about what could be happening? I think that this issue is related to permalinks. I suppose WP expects an URL like this to paginate lots:               http://domain.com/lot/page/{page-num}/      But this lists ALL lots. Any help would be appreciated. Thanks!


title: VServer/Rootserver/Shared Hosting: Multiple WordPress installations each having their unique domain?

text: Hello I think this is a beginner question, but I just do not know how to achieve this: Imagine the following:               /public_html/  [Domain = foo.com]     /public_html/wp_subproject1/ [Domain = bar.com]     /public_html/wp_subproject2/ [Domain = anything.com]      Each folder, the main folder as well as two subfolders contain a WordPress project which should have their own domains (so it should not be obvious to the user that these different projects lay on the same server). How do I configure the server to achieve that? Do I have to set the the A or CNAME record for each domain to the same server and afterwards route to the correct project using .htaccess? How should this .htaccess look like?


title: Get custom post type list for every category shortcode

text:
I am trying to make a shortcode to list all custom posts under the category they are under. Here is my code and I am no expert of coding but i thought that this would work. If someone can tell me what I am doing wrong would be helpful. Any help is appreciated! Thanks in advance! :)               <?php          add_shortcode( 'categorylist', 'msc_category_post_list_shortcode' );          function msc_category_post_list_shortcode($atts) {              $categories_args = array(         'orderby'                  => 'name',         'order'                    => 'ASC',         'hide_empty'               => 1,         'taxonomy'                 => 'cars_category'          );               $categories = get_categories( $categories_args );              foreach( $categories as $category ) :                  $postlist_args = array(                 'posts_per_page'   => -1,                 'offset'           => 0,                 'category'         => $category->cat_ID,                 'orderby'          => 'post_date',                 'order'            => 'DESC',                 'post_type'        => 'msccar',                 'post_status'      => 'publish' );                      $custom_posts = get_posts( $postlist_args );                 foreach ( $custom_posts as $post ) : setup_postdata( $post ); ?>                     <?php $posts .= '
'; ?>                         <?php $posts .= '' . the_title() . '' ?>                     <?php $posts .= '
'; ?>                      <?php endforeach;                  wp_reset_postdata();                 return $posts;         endforeach;               }


title: Adding Custom Metaboxes to Custom Pages

text: I want to be able to add a metabox to a new submenu page that I have created. I have the following basic code which I was hoping would work but it seems not to:               add_action("init", "my_register_post_types");     function my_register_post_types()     {         register_post_type("my-cpt", array(             "label" => "My CPT",             "public" => true         ));     }          add_action("admin_menu", "my_add_menu_items");     function my_add_menu_items()     {         add_submenu_page("edit.php?post_type=my-cpt", "Test Page", "Test Page", "edit_posts", "my-cpt-slug", "display_my_test_page");         //return value from this is my-cpt_page_my-cpt-slug     }          function display_my_test_page()     {         do_meta_boxes("my-cpt", "normal", null);     }          add_action("add_meta_boxes", "my_add_metaboxes");     function my_add_metaboxes()     {         add_meta_box("my-cpt-metabox", "My CPT Metabox", "display_my_metabox", "my-cpt_page_my-cpt-slug", "normal", "core");     }          function display_my_metabox()     {         echo "Hello";     }      According to http://shibashake.com/wordpress-theme/standard-wordpress-metabox, I should be using the return value of add_submenu_page to be used in the add_meta_box function in place of a CPT slug. I was hoping that the the metabox would appear on the new "Test Page" but no joy. Any ideas? Am I missing something?


title: Can't view post, goes to 404 page. Please help

text: I'm on a fresh install of WP and I just made a couple test posts. However, when I click on the post to view the 'single' page, it shows a 404. Furthermore, from the dashboard, when I go to the edit screen for that post and click on 'view post', I get the 404 page again. Any ideas on what can be wrong?


title: Wordpress Access allowed to fewer pages till user logs in

text: Is it possible in wordpress,by editing theme functions.php, to stop user access for all pages except Home, about-us, contact-us until a user is logged in to the system? All buddypress and wordpress page and posts redirects user to a login page?


title: "Uncaught SyntaxError: Unexpected token <" in load-scripts.php

text: Out of curiosity, I'm implementing AJAX in saving post. I didn't know where to start until I found this Q&A. It looks something I can grab and build on. It works but something on the Wordpress part that's stopping it from publishing the post; it just stays as a Draft. Here's a screenshot of the outputted error in the browser console ![enter image description here](http://i.stack.imgur.com/s4L6U.jpg) Here's my code               function my_post_type_xhr(){         global $post;         if(POST_TYPE === $post->post_type){             $post_url = admin_url('post.php'); #In case we're on post-new.php             echo "             <script>                 jQuery(document).ready(function($){                     //Click handler - you might have to bind this click event another way                     $('#post').bind('submit', function(e){                         //Post to post.php                         var postURL = '$post_url';                              //Collate all post form data                         var data = $('form#post').serializeArray();                              //Set a trigger for our save_post action                         data.push({foo_doing_ajax: true});                              //The XHR Goodness                         $.post(postURL, data, function(response){                             var obj = $.parseJSON(response);                             if(obj.success)                                 alert('Successfully saved post!');                             else                                 alert('Something went wrong. ' + response);                         });                              e.preventDefault();                         return false;                     });                 });             </script>";         }     }          function save_my_post_type($post_id){         if (defined('DOING_AUTOSAVE') && DOING_AUTOSAVE) return;              #If this is your post type         if(POST_TYPE === $_POST['post_type']){             //Save any post meta here                  #We conditionally exit so we don't return the full wp-admin load if foo_doing_ajax is true             if(isset($_POST['foo_doing_ajax']) && $_POST['foo_doing_ajax'] === true){                 header('Content-type: application/json');                 #Send a response                 echo json_encode(array('success' => true));                 exit;                 #You should keep this conditional to degrade gracefully for no JS             }         }     }      Could anyone please tell me what's going on?


title: Sorting a query Field by date

text:
I have my site, which at the moment is display university open-days, at the moment they are sorting by order of page title, when actually I would prefer they sorted in order of date, soonest first, latest last. Below is the code that i have so far and I cannot seem to work out how to sort them in order of date, any help?               <?php query_posts('post_type=page&post_parent=2&posts_per_page=-1&orderby=title&order=ASC'); ?>     <?php if ( have_posts() ) while ( have_posts() ) : the_post(); ?>                    <?php $key = 'next_open_day'; $themeta = get_post_meta($post->ID, $key, TRUE); if($themeta != '') {           echo '
';     echo '
';     echo '';     the_title();     echo '';     echo '
';     echo '
';     the_field('next_open_day');     echo '
';     echo '
';     the_field('open_day_description');     echo '
';     echo '';     echo 'Visit Website';     echo '';     echo '
';          } ?>                           <?php endwhile; ?>     <?php wp_reset_query(); ?>


title: Failed to load resource: the server responded with a status of 404 (Not Found)

text: Using Google Chrome Console and also Firebug I get Failed to load resource error on each page. It's an undefined image and the undefined resource is always `http://mysite.com/pagename/undefined` I've tried deactivating plugins but cannot find the issue. As first I thought it might be to do with W3TC plugin and I requested support from them and got the following response: > "There is something wrong with your JavaScript. Disabling W3TC Minify module > still cause the error to appear. According to chrome is initiated in > `jquery.ui.core.min.js` so probably some function call that is getting wrong > parameters." Does anyone have any suggestions or ideas? Its a new web build and I'm hoping to go live in a couple of weeks sans bugs! thanks in advance.


title: Does WP have a global of $id?

text: I'm trying to attach an object to every post of any type. This will require post ID to populate or create my object. So, I either call `global $post, or get_the_ID(), or do get_post()`. I hope there is a simple way to do the job, and I found a plugin "wp-post-ratings" uses global $id, it gets the id within the loop. I wonder if this is a WP global, or it's the plugin's custom code?


title: Formatting a date/time returned from a custom $wpdb query

text:
I'm definitely a rookie WordPress/PHP developer, so please forgive ignorance :-) **Q: How do I format a date/time returned from a custom query against $wpdb?** Here's the scenario: I'm trying to write a page which displays some simple statistics about my blog. One of the statistics I'm showing is the most popular posts, as determined by comment count. I've essentially got the query working, except I can't for the life of me work out how to format the post date/time the way I want to! Here the code (apologies for the long snippit):               <?php         $queryStr = "             SELECT                  posts.ID,                 posts.post_title,                 posts.post_date,                 posts.guid,                 author.user_nicename as author,                 count(comments.comment_ID) as comment_count                  FROM                 $wpdb->posts posts                 INNER JOIN                     $wpdb->comments comments                     ON posts.ID = comments.comment_post_ID                 INNER JOIN                     $wpdb->users author                     ON posts.post_author = author.ID                  WHERE                 posts.post_status = 'publish'                 AND posts.post_type = 'post'                 AND comments.comment_approved = 1                 AND comments.comment_type = ''                  GROUP BY                 posts.ID                  ORDER BY                 count(comments.comment_ID) DESC,                 posts.ID DESC                  LIMIT                 30         ";              $popularPosts = $wpdb->get_results($queryStr);              if ($popularPosts) {     ?>

                     Post	                     Author	                     Posted At	                     # comments

          <?php             foreach ($popularPosts as $popPost) {     ?>
                     <a href="<?= $popPost->guid ?>"><?= $popPost->post_title ?>	                     <?= $popPost->author ?>	                     <?= $popPost->post_date ?>	                     <?= $popPost->comment_count ?>
     <?php                        }     ?>

     <?php         } else {             echo("No stories!\n");         }     ?>      This is obviously the line in question:               <?= $popPost->post_date ?>	      I've tried a number of different things but none of them quite get me there. This gets me the format that I'm after, but uses the wrong date (obviously $wpdb is not returning a timestamp in the query):               <?= date('j M Y h:i A', $popPost->post_date) ?>	      I also tried a solution along these lines:               <?php             global $popPost;             foreach ($popularPosts as $popPost) {                 setup_postdata($popPost);     ?>
                     <a href="<?= $popPost->guid ?>"><?= $popPost->post_title ?>	                     <?= $popPost->author ?>	                     <?= the_time('j M Y h:i A') ?>	                     <?= $popPost->comment_count ?>
     <?php                        }     ?>      But that simply repeats the timestamp for **the page** over and over, rather than the timestamp for each post. What am I doing wrong?


title: How to change Post ID during import

text: I'm importing posts from a Joomla v1.5 site using http://wordpress.org/extend/plugins/joomla-15-importer/ (The goal is to clone the site in WordPress then switch off Joomla) On both sites the permalink structure is /%category%/%post_id%-%postname%/ Of course, when I import I am getting a different post ID in WordPress than existed in Joomla. Can I change post ID manually in the DB after import? Aside from .htaccess file with a huge number of rules (one per article!) is there another workaround for this issue? Any comments/suggestions? Thanks, Alastair.


title: Author page like wordpress answers

text: I'm newbie in wordpress. I want to implement a page like http://wordpress.stackexchange.com/users But no idea how to implement. The user listing, info, avatar,user search everything will same. any idea about the issue???


title: Custom fields for custom post types

text: I have a custom post type for portfolio. To create one, you need to create a page with a particular template that i'm making, named page-portfolio. Now, a portfolio post has custom fields as well. But, how can i make a custom field that is displayed in the post only if i select the 'portfolio' template ? That is, a custom field tied to the usage of the portfolio template ?


title: Selecting multiple options onclick

text: I have a bunch of options that I'd like the user to be able to change in bulk. Here's my code example. When this option selection changes,               <label>Default author</label>       <select name='default_author' id='default_author' class=''>         <option value='1'>user 1</option>             <option value='5'>user 5</option>         <option value='4'>user 4</option>         <option value='6'>user 6</option>         <option value='2'>user 2</option>     </select>      These options below change too. The option selected is to match the one selected above.               <select name='post_author[0]' id='post_author[0]' class=''>         <option value='1'>user 1</option>             <option value='5'>user 5</option>         <option value='4'>user 4</option>         <option value='6'>user 6</option>         <option value='2'>user 2</option>     </select>          <select name='post_author[1]' id='post_author[1]' class=''>         <option value='1'>user 1</option>             <option value='5'>user 5</option>         <option value='4'>user 4</option>         <option value='6'>user 6</option>         <option value='2'>user 2</option>     </select>      I'm trying to do this using jQuery. Before putting this into WordPress, I tested my code on a static HTML page and it works. But the moment I port it into WordPress it doesn't and I'm really at a loss. Here's what have in my .js file.               jQuery(document).ready(function() {      jQuery("#default_author").change(function() {        selected = jQuery('#default_author').val();      alert(selected);      });      jQuery("#default_author").change(function() {        selected = jQuery('#default_author').val();        jQuery("select[name^='post_author']").attr('selectedIndex',selected);      });     });      Yes, there are 2 change functions in there because I wanted to see if I'm actually getting the value or not and I am. The alert gives me the right value. I've been up and down this for hours not familiar with jQuery, I'm surprised I got this far. Does `attr('selectedIndex', value)` not work in WordPress? Using WP 3.2.1 by the way. Thank you so much for any help anyone can give me.


title: Prompt users to Upload Avatar on Registration

text: I saw a WP site that had users fill in their basic info and then it directed them to upload and Avatar. The site looked nice because most users had a picture even if they were'nt registered with Gravatar. Is there a plugin for this local Avatar upload?


title: How to display posts by current user/author in a custom page template?

text: I am a trying to create a dashboard like custom page template that list post of of the current logged in user. I've tried to find a solution on the net. but none were appropriate


title: How does object caching work?

text: I'm looking for a definitive answer here. When object caching is enabled, where do options and transients end up living? By default, both are stored in the database. But I've heard some references that memcache will store them elsewhere and APC will do something else entirely. Where, _exactly_ , will this data be persisted in both cases?


title: where do I send my ajax calls

text: Fighting to create an ajax request. I've been reading couple of articles but still I can't get my plugin to send and recive ajax datas. first init the js                   function ajax_load_scripts() {             // load our jquery file that sends the $.post request             wp_enqueue_script( "ajax-calls", plugin_dir_url( __FILE__ ) . '/assets/js/ajax_calls.js', array( 'jquery' ) );                  // make the ajaxurl var available to the above script             wp_localize_script( 'ajax-calls', 'the_ajax_script',                      array( 'ajaxurl' =>   plugin_dir_url('my_plugin.php') ,                            '_ajax_nonce' => wp_create_nonce( 'my_ajax_nonce' )                       ) );         }     add_action('wp_print_scripts', 'ajax_load_scripts');      than trying to catch posted data in my plugins entry file               function tipps_processing_function(){         check_ajax_referer('my_ajax_nonce');              if ($_POST['results']){             $token = '393a9276ae329e00b3739d2e76e52f3b';             $tips = json_encode($_POST['results']);             $save = new Tipspiel();             $save->save_tips($token, $tips);                 var_dump($_POST['results']);             return 'OK';         }         //do stuff here     }          add_action('wp_ajax_nopriv_add_tipps', 'text_ajax_process_request');      my js               $j("form#tiepspiel").submit(function(e) {             e.preventDefault(); // this disables the submit button so the user stays on the page                         var str = $j(this).serialize();            //alert(decodeURIComponent(str));             if ($j('ul#sortables li').size() > 10){                      $j( "#dialog-modal" ).dialog({                         height: 140,                         modal: true                     });                 return;             }             var data = {                     action: 'add_tipps',                     tips: str,                     _ajax_nonce: the_ajax_script._ajax_nonce                      };                  $j.post(the_ajax_script.ajaxurl, data, function(response) {                 alert('Got this from the server: ' + response);                 //$j.cookie("tipspiel", "competitor", { expires: 1 });                $j('form#tiepspiel').fadeOut('slow', function() {                     // Animation complete.                   });             });                       });      but I don't see my varibales dumped


title: get_term_by not working when in functions.php

text: I have an odd issue with get_term_by(). It's working fine when I use it inside a template, but when I use it in functions.php it just returns false.               $term = get_term_by('slug', 'some-term', 'some-taxonomy');     var_dump($term);      Any explanation as to why this is happening would be greatly appreciated.


title: Costum post type with costum (sub)taxonomy

text: This question is probably asked before but my language not being natively english i cant really find the answer: I got a custom post type: products and custom (hierarchy) taxonomy: collection in the taxonomy i got for axample: \- paintings (parent tax) \-- classic (sub tax) \-- modern (sub tax) now i want to reach my products via: collection/paintings/classic/classic- painting-1 but i have two problems: Problem 1: sub tax doesn't have the parent tax in the url: collection/paintings/ and then collection/classic/.. it should collection/paintings/classic/ Problem 2: if i choose a product (eg. classic-painting-1) in collection/paintings/ it goes to products/classic-painting-1 in stead of collection/paintings/classic/classic-painting-1 i hope this big question has a simple answer, thank in advance my codes for custom post type and taxonomy:               // Custom post type         add_action('init', 'cptui_register_my_cpt_producten');     function cptui_register_my_cpt_producten() {     register_post_type('producten', array(     'label' => 'Producten',     'description' => '',     'public' => true,     'show_ui' => true,     'show_in_menu' => true,     'capability_type' => 'post',     'map_meta_cap' => true,     'hierarchical' => true,     'rewrite' => array('slug' => 'producten', 'with_front' => true),     'query_var' => true,     'menu_position' => '1',     'supports' => array('title','editor'),     'taxonomies' => array('category','post_tag','collectie'),     'labels' => array (       'name' => 'Producten','singular_name' => 'Product','menu_name' => 'Producten','add_new' => 'Add Product','add_new_item' => 'Add New Product','edit' => 'Edit','edit_item' => 'Edit Product','new_item' => 'New Product','view' => 'View Product','view_item' => 'View Product','search_items' => 'Search Producten','not_found' => 'No Producten Found','not_found_in_trash' => 'No Producten Found in Trash','parent' => 'Parent Product',     )     ) ); }          // Custom taxonomy     add_action('init', 'cptui_register_my_taxes_collectie');     function cptui_register_my_taxes_collectie() {     register_taxonomy( 'collectie',array (       0 => 'producten',     ),     array( 'hierarchical' => true,         'label' => 'Collecties',         'show_ui' => true,         'query_var' => true,         'show_admin_column' => false,         'labels' => array (       'search_items' => 'Collectie',       'popular_items' => '',       'all_items' => '',       'parent_item' => '',       'parent_item_colon' => '',       'edit_item' => '',       'update_item' => '',       'add_new_item' => '',       'new_item_name' => '',       'separate_items_with_commas' => '',       'add_or_remove_items' => '',       'choose_from_most_used' => '',     )     ) );      }


title: Set Featured Image for Archive templates

text: I'm want to set a featured image for the archive templates of my theme. To my knowledge, there is not a way to do so in the WordPress Admin (like Pages and Posts). I was thinking about writing a function that filters through the currently uploaded featured images and matches the template to the file name. Might be a bit complex. I also know there are theme options. But this seems like a lot to manage. How would you recommend doing this that facilitates Featured Image administration (Theme -> Header) and ease of maintenance...


title: Make Selected Mutiselect Items "selected"

text: I'm developing a theme settings panel for a new wordpress theme that have an option to exclude categories from being shown in the loop. I managed to get the main functionality to work, using a mutilselect box and saving the values as array ...               <?php $cats = get_categories('hide_empty=0&orderby=name'); ?>     <select name="<?php echo $option['id']; ?>[]" id="<?php echo $option['id']; ?>" multiple="multiple">           <option value="0">None (don't exclude anything)</option>         <?php foreach ($cats as $cat_list ) { ?>             <option value="<?php echo $cat_list->cat_ID; ?>" <?php selected( $selected, $cat_list->cat_ID ); ?>><?php echo $cat_list->cat_name; ?></option>          <?php } ?>     </select>      however I can't understand how check every item in `foreach()` loop if its value matches one value in the stored values array, then apply `selected="selected"` if it returns true to it. I understand `selected()` wp function but don't understand how to make use of it in this case ( multiple values inside `foreach()` loop ). Any help will be appreciated, I'm a n00b so forgive me if it's a stupid question :)


title: Counting the posts of a custom Wordpress loop (WP_Query)?

text:
I tried tplacing this:                   <?php $count = count($custom_posts); ?>
<?php echo $count; ?>
      at the end of the loop:                     <?php if ( bbp_get_forum_title() == 'Test Forum 1' ) : ?>                 <?php $custom_posts = new WP_Query(); ?>                 <?php $custom_posts->query('post_type=blocks&location=Business and Finance&order=DESC'); ?>                 <?php while ($custom_posts->have_posts()) : $custom_posts->the_post(); ?>
                         <?php the_content(); ?>
                     <?php $count = count($custom_posts); ?>
<?php echo $count; ?>
                 <?php endwhile; ?>           <?php endif; ?>      But instead of the total of posts, I getting this output: > Translation 1 > > Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy > nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat. Ut > wisi enim 1 Any suggestions to fix this?


title: How do I create pages within a Wordpress post?

text: I run a music blog and I want to do a countdown of our top 50 tracks of 2011 so far. There's no way that I want to add 50+ images and Audio Players into just one post, and I don't want to break the post down into separate posts either. Is there some kind of plugin or function that will allow me to add pages to the post so I could have say 10 tracks per page?


title: How can I remove image taxonomy pages from my theme and from Google?

text: A lot of my theme's image pages are ranking on Google. I'd like to remove these pages entirely from my theme so they no longer rank. When a user hits these image pages the content is taken out of context and looks very confusing. Here is an example of a ranking image page: http://www.barbadospropertylist.com/2011/08/stephanie-barnes-interior-design- studio/cei_5346/ That image is part of blog post at: http://www.barbadospropertylist.com/2011/08/stephanie-barnes-interior-design- studio/


title: Adding tag name to code

text: I want to add an event tracking code to the_tags on a single page. What I have done so far is is this               //ADD EVENT TRACKING TO TAG LINKS     function add_class_the_tags($html){     $postid = get_the_ID();     $html = str_replace('rel="tag">','rel="tag" onClick="_gaq.push([\'_trackEvent\', \'Tags link\', \'Tag\', \'Clicked\',, true]);">',$html);     return $html;     }     add_filter('the_tags','add_class_the_tags',10,1);      This filter adds the onClick part to the individual tag links and works well. What I want to do next, and haven't managed, is to add the tag name to the tracking code where now is written \'Tag\' so I can see in Analytics what tag link was clicked. I don't know if there is a plugin doing this, but I don't want to use a plugin for this. Has anyone an idea how? Added: Second attempt failed. I tried adding this to functions.php, but nothing the onClick part doesn't show up                   //deactivate WordPress function     remove_shortcode('get_the_term_list');          //activate own function     add_shortcode('jt_get_the_term_list');          //the own renamed function     function jt_get_the_term_list( $id, $taxonomy, $before = '', $sep = '', $after = '' ) {     $terms = get_the_terms( $id, $taxonomy );          if ( is_wp_error( $terms ) )     return $terms;          if ( empty( $terms ) )     return false;          foreach ( $terms as $term ) {     $link = get_term_link( $term, $taxonomy );     if ( is_wp_error( $link ) )     return $link;     $term_links[] = 'name .', \'Clicked\',, true]);">' . $term->name . '';     }          $term_links = apply_filters( "term_links-$taxonomy", $term_links );          return $before . join( $sep, $term_links ) . $after;


title: Different use for WordPress Multisite

text: Is there a way to use WordPress Multisite to collaborate all subsites into the main site? My thought is to have all the subsites to be departments of an organization and the main site be the front page for the organization. Navigation would be created automagically: one for the main site, then a separate navigation that would list the departments (subsites) with drop downs for the pages of those sites. I'm sure this could all be scripted to work, but I'm curious if there's a solution already out there to roll with right out of the box.


title: WordPress as a CMS Membership website

text: I am involved with several WordPress support websites including this one (recently). I seem to get the question "Can WordPress be used as a CMS/Membership Website?". I haven't needed to set one up, so I always refer them to suggestion from other forums. I've decided that it's only a matter of time until I will be required to implement this type of a WP website so I've decided to be Pro-Active and set up a development version. I've been looking at Magic Members specifically, but I don't know anyone that has used it. My question has two parts: 1) Does anyone have first hand experience using Magic Members. If so is it worth the $197. 2) Do you have any recommendations an an alternative? NOTE: I've tried out many of the plug-ins from the repository, but for a business I haven't found one that fits all the requirements. Here is a list of the features that are most likely needed:   1. Membership access control on various levels   2. Public and Private content   3. Simplified User Interface (this isn't as important since I know a few tricks including ones I've discovered here.   4. Document sharing   5. Content Available to Author created content that can only be changed/updated by them and the Administrator. I know this is a pretty in depth questions, but any pointers or personal experience will be greatly appreciated. Thanks, Jeremy Jared


title: How do I stop HTML entities in a custom meta box from being un-htmlentitied?

text:
I have a custom meta box that is supposed to accept HTML, but the text I'm trying to input contains both double and single quotes (and ampersands), and it's messing up the saved data - each time I reload the post, the data is duplicated with an extra single quote (and angle bracket) inserted at the end. I'm guessing its trying to "close" what it thinks is an unclosed phrase in single quotes, when really its an apostrophe. I can temporarily fix this right now by using the html character code for my apostrophe, but (a) that is not ultimately a solution as I can't control what other users might enter once the theme is rolled out, and (b) once the page reloads, the html character has been replaced by an apostrophe again, which means if I save any further changes, I'm back at square one. So, how do I "escape" html content in a metabox without stripping the html tags? Is there a special wordpress function/hook/action/etc or a special metabox format I should be using, or should I just be looking this up in the PHP manual instead? PS: It also "strips out" any html characters like `&`, so the post won't validate properly because there are now plain `&` in the text. **UPDATE:**   So who knew single vs double quotes made any difference in simple php? I managed to fix the weird duplication and "correction" of apostrophe by swapping out my quotes in my code. My original code was this:               echo "<textarea class='meta-textarea' style='width: 100%;' cols='20' rows='2' name='" . $meta_box['name'] . "_value' value='" . $meta_box_value . "'>" . $meta_box_value . "</textarea>
";      If I save the following phrase: `<p>Blah & blah 'blah'</p>` into the resulting text box, it would return `'><p>Blah & blah 'blah'</p>`. If I just swap out the single and double quotes in my code, like so:               echo '<textarea class="meta-textarea" style="width: 100%;" cols="20" rows="2" name="' . $meta_box['name'] . '_value" value="' . $meta_box_value . '">' . $meta_box_value . '</textarea>
';      then it works just fine (apart from the html-entity thing, which is still a problem). Those two lines of code together, so you can see I haven't left out any quotes (top one works, bottom doesn't):               echo '<textarea class="meta-textarea" style="width: 100%;" cols="20" rows="2" name="' . $meta_box['name'] . '_value" value="' . $meta_box_value . '">' . $meta_box_value . '</textarea>
';     echo "<textarea class='meta-textarea' style='width: 100%;' cols='20' rows='2' name='" . $meta_box['name'] . "_value' value='" . $meta_box_value . "'>" . $meta_box_value . "</textarea>
";      So, now, the question of weird duplication has been fixed (although I don't understand why - I thought single and double quotes were interchangeable if you weren't doing any odd substitution, etc. The remaining question is - how do I stop the text from getting `htmlspecialchars_decode` applied, or whatever is happening here...


title: Combining / Merging two queries?

text:
So I am working on an isotope filtered portfolio page that pulls any attachment tagged with the term "digital-interactive". Each attachment is also linked to a custom post_type called "work". On one of my portfolio pages I use a WP_Query and target the "work" custom post type, but for this page I need to query the post_type => "attachment" instead. Each image has a container that wraps around it and has a class that is generated with the tags for that particular post in my custom post type of work. I am having some difficulties trying to get 2 queries together on my new portfolio page to query the "attachment" post type but still be able to call those tags from my "work" custom post type. Any help would be great. Code for work custom post type:                           $all_work = new WP_Query(array(                     'post_type' => 'work',                     'tax_query' => array(                         array(                             'taxonomy' => 'type',                             'field' => 'slug',                             'terms' => array('case-study', 'portfolio')                         ),                     ),                     'posts_per_page' => '20',                     'orderby' => 'title',                     'order' => 'ASC',                     'paged' => $page                     )                 );      Code for attachment query portfolio page:               <?php         $args = array(             'post_type' => 'attachment',             'post_parent' => null,             'tax_query' => array(                 array(                     'taxonomy' => 'post_tag',                     'field' => 'slug',                     'terms' => 'digital-interactive'                 ),             ),             'posts_per_page' => -1,             'orderby' => 'title',             'order' => 'ASC'         );              $images = get_posts( $args );         if ( $images ) {             foreach ( $images as $image ) {                 // Get the parent post ID                 $parent_id = $image->post_parent;                 // Get the parent post Title                 $parent_title = get_the_title( $parent_id );                 // Get the parent post permalink                 $parent_permalink = get_permalink( $parent_id );                 // Get image caption                 $logoimg = wp_get_attachment_image( $image->ID, 'Work Gallery' );             }         }              $attachment_id = $image->ID;         $attachment = get_post( $attachment_id );         $image_title = $attachment->post_title;         $image_alt = get_post_meta($attachment->ID, '_wp_attachment_image_alt', true);         $src = wp_get_attachment_image_src( $image->ID, 'full' );         $src = $src[0]; // Grabs only the URL ($src[1] = width of image, $src[2] = height of image)          ?>      Code for container that wraps around the image (and other information being pulled from the image):               <aside class="work_item <?php $posttags = get_the_tags(); if ($posttags) { foreach ($posttags as $tag) { echo str_replace('-','_',$tag->slug . ' '); } } ?>" data-id="id-<?php echo $parent_id; ?>">

                         <?php echo $logoimg; ?>

<a href="<?php echo $parent_permalink; ?>"><?php echo $parent_title; ?>

<?php echo gds_get_excerpt($image->ID); ?>

<a href="<?php echo get_field('attachment_website', $image->ID); ?>" target="_blank">View Website

                Now on my portfolio page that is querying the Work custom post type (first code sample) the class is generating all of the tags as expected. For my second code sample where I query the attachment post_type it does not. And I believe this is due to the fact the query is for the attachment post_type and the tags are associated with the work post_type. Can anyone help me with combining the work & attachment query together so I can retrieve the tags from the work post_type on my portfolio page that is querying the attachments? Thank you!


title: building a site with mostly custom styled, static pages.. advice needed

text: I'm putting together a site that will be compromised mostly of static pages with some dynamic content as well as a blog page. In terms of naming files, what would be the best way to achieve this? My first thought was to simply use about.php, services.php, etc. but I'm sure that doesn't jive well with WP's system.


title: Allow Access To Subfolder Of HTML For Logged In Visitors

text: I have a WordPress site installed in the root folder. Beneath the root is a /docs folder with a bunch of older html files. I'd like to allow only logged in WordPress users to be able to have access to those /docs html pages (not to be confused with WordPress 'pages'). I created a WordPress 'portal' page which displays links to the /docs pages if the visitor is logged in. I would also like to put in a textual search function (which I know how to do) so logged in visitors can get a list of relevant /docs html pages What I _don't_ know how to do is prevent _not_ logged in visitors from direct access to the /docs pages for both links and searches? I know I could do these if I converted the html pages to php and checked a referer. But I don't want to have to redo all the old html if possible (if I have to do _that_ I'll just import them into a WordPress taxonomy -- but I hope to avoid that!) I looked at .htaccess and I was hoping to perhaps set an ENV variable or use REFERER, but I keep reading that such things are not reliable. Ideas?


title: <!--More--> not functioning

text:
I have the following blog template with the the_content outputted. I have placed `<!--more-->` However it does not appear to be functioning, http://www.milknhny.co.uk/DVine/?page_id=19 Is there anything that needs to be included within functions for this to function? **Code Of my Blog Template**               <?php     /*     Template Name: Blog Template     */      ?>          <?php get_header();?>     <?php echo get_the_post_thumbnail($post->ID, 'single-post-thumbnail'); ?>
     <?php query_posts('showposts=5'); ?>     <?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>
<?php echo get_the_date('j'); ?>    <?php echo get_the_date('M'); ?>

<?php echo get_the_title(); ?>

     Written by <?php the_author_posts_link() ?> in <?php the_category(); ?>     <?php the_content('read more...'); ?>

       <?php endwhile; else: ?>
<?php _e('Sorry, no posts matched your criteria.'); ?>
     <?php endif; ?>
     <?php get_footer(); ?>      **EDIT** I have found this within the Twenty Twelve theme and ive tried to adapt this to my own however the - errors the actual code...               function DTheme_excerpt_length( $length ) {     return 40;     }     add_filter( 'excerpt_length', 'DTheme_excerpt_length' );          if ( ! function_exists( 'DTheme_continue_reading_link' ) ) :     /**      * Returns a "Continue Reading" link for excerpts      *      * @since Twenty Ten 1.0      * @return string "Continue Reading" link      */     function DTheme_continue_reading_link() {     return ' ' . __( 'Continue reading →', 'DTheme' ) . '';     }     endif;          /**      * Replaces "[...]" (appended to automatically generated excerpts) with an ellipsis and twentyten_continue_reading_link().      *      * To override this in a child theme, remove the filter and add your own      * function tied to the excerpt_more filter hook.      *      * @since Twenty Ten 1.0      * @return string An ellipsis      */     function DTheme_auto_excerpt_more( $more ) {     return ' …' . DTheme_continue_reading_link();     }     add_filter( 'excerpt_more', 'DTheme_auto_excerpt_more' );     ?>      Is it a case i would need to adapt the above for this to work? **EDIT** Hi all, this appears to be part working after amazing help below, however it is still not displaying within the content wrap and also images for example are resizing... please see my code now and also screenshot               <?php get_header(); ?>
     <?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>
<?php echo get_the_date('j'); ?>    <?php echo get_the_date('M'); ?>

<?php echo get_the_title(); ?>

     Written by <?php the_author_posts_link() ?> in <?php the_category(); ?>     <?php the_content(); ?>

       <?php endwhile; else: ?>
<?php _e('Sorry, no posts matched your criteria.'); ?>
     <?php endif; ?>
     <?php get_footer(); ?>      ![Screenshot of further info on click](http://i.stack.imgur.com/e7cat.png)


title: How can I set full width page layout in a default post page?

text:
I want to set up my site so that when I go to any post then it should show full width page. This theme already has a full width page but I wanted it to show in the default width page. How can I accomplish this? My website link is - http://techjagot.com The code in single.php is :-               <?php get_header(); ?>     <?php               setPostViews(get_the_ID());     ?>              <?php         global $wp_query;         $postid = $wp_query->post->ID;         if ( get_post_meta( $postid, 'post_featpages', true ) == "Yes" ) { ?>             <?php include (TEMPLATEPATH . '/featured-pages.php'); ?>         <?php } ?>              <?php if ( get_post_meta( $postid, 'post_featcontent', true ) == "Full Width Featured Content Slider"  ) { ?>             <?php include (TEMPLATEPATH . '/featured-wide.php'); ?>         <?php } ?>

                      <?php if ( get_post_meta( $postid, 'post_featcontent', true ) == "Narrow Width Featured Content Slider" ) { ?>                     <?php include (TEMPLATEPATH . '/featured-narrow.php'); ?>                 <?php } ?>                      <?php if ( get_post_meta( $postid, 'post_featgalleries', true ) == "Yes" ) { ?>                     <?php include (TEMPLATEPATH . '/featured-galleries.php'); ?>                 <?php } ?>                      <?php if ( get_post_meta( $postid, 'post_featvideo', true ) == "Yes" ) { ?>                     <?php include (TEMPLATEPATH . '/featured-vids.php'); ?>                 <?php } ?>
                          <?php if ( function_exists('yoast_breadcrumb') ) { yoast_breadcrumb('
','
'); } ?>                          <?php include (TEMPLATEPATH . '/banner468.php'); ?>          <?php if (have_posts()) : while (have_posts()) : the_post(); ?>
                          <div class="post" id="post-main-<?php the_ID(); ?>">

<a href="<?php the_permalink() ?>" rel="<?php _e("বুকমার্ক", "solostream"); ?>" title="<?php _e("Permanent Link to", "solostream"); ?> <?php the_title(); ?>"><?php the_title(); ?>
                                  <?php include (TEMPLATEPATH . '/postinfo.php'); ?>                                  <?php if ( get_post_meta( $post->ID, 'video_embed', true ) ) { ?>
                                     <?php echo get_post_meta( $post->ID, 'video_embed', true ); ?>
                             <?php } ?>                                  <?php the_content(); ?>

                                  <?php wp_link_pages(); ?>                                  <?php if(function_exists('the_tags')) { the_tags('
'. __('ট্যাগসমূহ', "solostream"). ':  ', ', ', '
'); } ?>
<?php _e('বিভাগ', "solostream"); ?>: <?php the_category(', '); ?>

                              <?php include (TEMPLATEPATH . '/auth-bio.php'); ?>                              <?php include (TEMPLATEPATH . '/related.php'); ?>                              <?php comments_template('', true); ?>
                          <?php include (TEMPLATEPATH . "/bot-nav.php"); ?>
      stylesheet.php code /* ---------[ Full-Width Layout Styles ]--------- */               .fwidth #page {}          .fwidth #contentleft {         width: 100%;         float:none;         }          .fwidth #content {         width: 908px;         }      If anybody demands any other code for more info then please tell me. I will provide you guys with it.


title: My blog has a design issue.

text: My blog has been getting a good visitors these days. I have used linkwithin add ons to show related posts. But the problem is it is showing related posts in even homepage. Is there any way to not to show it in homepage?


title: call coupon press advanced search widget anywhere in theme?

text: I am working on a parent child Coupon Press Wordpress Website. I am able to call it's New Advanced Search Widget in sidebar but I want to call it anywhere in the website like I have created a page (Advanced Search) and I want to call that widget on this page rather than in sidebar. I searched on internet and found `the_widget` but it's not working and also I don't know the actual name of "New Advanced Search" Widget.


title: Enqueueing Script to footer puts it at the very bottom

text: So I've got a bit of an issue, and not sure what the problem is. I'm trying to enqueue javascript in the footer of my Wordpress site. The footer looks like this:                   </footer>     </div>          <?php wp_footer(); ?>          <script>         jQuery(document).foundation();     </script>     </body>     </html>      So the enqueued script SHOULD be put in the wp_footer call, putting the script just above where I actually call it. But looking at the source code of the file, I get this:               </footer>     </div>                                        <script>     jQuery(document).foundation();     </script>     <script type='text/javascript' src='http://www.thetestsite.com/wp-content/themes/cornerstone-4.3.1/js/foundation.min.js?ver=4.3.3'></script>     </body>     </html>      For some reason, the script in question is being placed RIGHT BEFORE the closing body tag. I verified the wp_footer is in the correct place, so I'm not sure what would cause this to happen. If I enqueue the script to the head, it works just fine, but I'm just curious as to why this behavior is happening. UPDATE (NEW CODE): Sorry for the confusion. Here's the functions.php portion of the script enqueue method:               function load_cornerstone_scripts() {         wp_enqueue_script(             'foundation_js',             get_template_directory_uri() . '/js/foundation.min.js',             array('jquery'),             '4.3.1',             true         );          }          add_action('wp_enqueue_scripts', 'load_cornerstone_scripts',0);      So to be clear..the original two blocks of code are showing 1) What the php file footer.php looks like, and 2) what the source code is rendered as.


title: Wordpress blog not loading articles

text: I have set up a static website with basic information pages such that all of the static pages fall into one level and in that directory there is directory "blog" which contains a Wordpress 3.5.1 install. This gives me the following directory structure:   * index.php   * blog.php   * /blog      * all of my Wordpress crap I have recently been suffering from an issue that constantly re-directs me to my homepage when you try to navigate to a blog post but you are able to navigate to blog.php and it seems to be working correctly. I think something might be wrong with my .htaccess but I do not know enough about them to say. I have included both of my .htacess files below in the hopes that someone can see what is going on and help me to correct this problem. **root directory**               # BEGIN WordPress     <IfModule mod_rewrite.c>     RewriteEngine On     RewriteBase /     RewriteRule ^index\.php$ - [L]     RewriteCond %{REQUEST_FILENAME} !-f     RewriteCond %{REQUEST_FILENAME} !-d     RewriteRule . /index.php [L]     </IfModule>          # END WordPress      **/blog/ directory**               # BEGIN WordPress     <IfModule mod_rewrite.c>     RewriteEngine On     RewriteBase /blog/     RewriteRule ^index\.php$ - [L]     RewriteCond %{REQUEST_FILENAME} !-f     RewriteCond %{REQUEST_FILENAME} !-d     RewriteRule . /blog/index.php [L]     </IfModule>          # END WordPress      The website in question can be found at R2 Consultants Ltd.. Any help that you could provide would be very appreciated and if I have not provided enough information for you to be able to help me please just request what you need and I will get it for you ASAP. Thank you in advance for your assistance. Mat


title: Query multiple tables at once?

text: I want to query all of the posts in my WordPress multi-site set-up looking for a certain string. This is only being done in Sequel Pro (on the command line) for my own inquisitive purposes but there has got to be a better way than copying and pasting the same query over and over again and just changing the table prefix... Let's say I have 3 sites, I want to find all of the posts that contain the word foo in them:               SELECT * FROM wp_1_posts WHERE `post_content` LIKE '%foo%';     SELECT * FROM wp_2_posts WHERE `post_content` LIKE '%foo%';     SELECT * FROM wp_3_posts WHERE `post_content` LIKE '%foo%';      I don't want to have to run 3 queries and concat the results somehow. What I really want to do is               SELECT * FROM wp_1_posts, wp_2_posts, wp_3_posts WHERE `post_content` LIKE '%foo%';      but that seems to only be meant for joining. Is there any way to do what I'm trying to do?


title: change the Theme dynamically

text: Is there some way to change the page template dynamically using just a url I wanna use it in a demo theme, so for example when the user enters a particular URL ending with for example ?custom_page_template it changes the template on the fly? Could this technique be used to change the theme (or maybe a child theme) on the fly just for demo purpose?


title: WooCommerce - how to display product category above product with full details

text: i'm new in wordpress so please suggest me. i'm selling ring, earings, chains, ect. ring, earings "catogry" and ring-1, ring=2 product. so i want to show on shop page my catogry and on click catogry my products will show


title: Nav Menu Display

text:
Hi I'm wanting to create a custom navigation menu that will require creating 2 `div` containers to hold the SUB-MENU set. In other words I want to do this:

       I'm doing this because I'm using about 3 different background images. How would I go about adding this into the wp_nav_menu function? Do I add a filter in functions.php, or do I create a separate PHP file to do this? Any helpful suggestions would be greatly appreciated.


title: Wordpress SQL - How to Check for Category?

text: I'm using the following SQL (wrapped in php) to find posts in a wordpress database:               $sql = "         SELECT             p.*         FROM             {$wpdb->prefix}most_popular mp             INNER JOIN {$wpdb->prefix}posts p ON mp.post_id = p.ID         WHERE             p.post_type IN ( $holder ) AND             p.post_status = 'publish'         {$order}         LIMIT %d     ";      And I want to add an additional condition that the post be in a specific category. Any thoughts?


title: Exclude One Category and its Subcategories using WP_LIST_FILTER

text:
I need to exclude a category and its subcategories in posts. This is the code I'm working on and it works:                       <?php             $categories = wp_get_post_terms($post->ID, 'category');             $categories = wp_list_filter($categories, array('slug'=>'regione'), 'NOT');             $categories = wp_list_filter($categories, array('slug'=>'lazio'), 'NOT');             $categories = wp_list_filter($categories, array('slug'=>'rm'), 'NOT');             if (!empty($categories)) {                 ?>
                     <?php                     foreach ($categories as $category) {                         $cat = get_category($category);                         echo '
' . $cat->name . '
';                     }                     ?>
      Although, the category 'regione' has more than 20 subcats and each subcat has 5 to 10 other subcats: any suggestion on how to exclude in a better way the main category and its children?


title: What defines a post as portfolio page content?

text: I have three types of content, Posts which I have defined as Blog and categorise accordingly, Slider Images defined by a specfic category, and Pages. I want to have content as portfolio on a profolio page similar to a blog. My theme allows it, under the new page editor I have options to have a portfollio template. ![enter image description here](http://i.stack.imgur.com/daU5E.jpg) I have chosen that template but I cannot point a post or other piece of content to appear here. How do I choose a post to sit under this page? For information I am using this theme


title: Pagenavi pagination via wp-query in functions.php showing same content for each page

text: I've recently had a lot of help creating an upcoming events list (see here Showing upcoming events including todays event - StackOverflow), as a result my pagination using `wp_pagenavi()` is broken. At the moment, when you click on page 2 it just shows the same posts as page one. Although the URL does actually change to page/2 page/3 etc. I have this in my `functions.php` file:               function filter_where( $where = '' ) {     $where .= " AND post_date >= '" . date("Y-m-d") . "'";     return $where;     }          add_filter( 'posts_where', 'filter_where' );          $query = new WP_Query(         array(             'post__not_in' => array(4269),             'paged' => get_query_var('paged'),             'post_type' => 'whatson',             'exclude' => '4269',             'post_status' => 'future,publish',             'posts_per_page' => 20,             'order' => 'ASC'         )     );          remove_filter( 'posts_where', 'filter_where' );      My loop is then as follows:               <?php while ( $query->have_posts() ) : $query->the_post(); ?>     // content     <?php endwhile; // end of the loop.  ?>     <?php if (function_exists('wp_pagenavi')) { wp_pagenavi( array( 'query' => $query ) ); } ?>      Doing `print_r ($query);` before removing the filter produced this: ![enter image description here](http://i.stack.imgur.com/2G6aam.png)


title: images within style sheet

text: I hope someone will be able to help me with this, because it's starting to freak me out. Have been searching hours to find a way to put image paths in my stylesheet, but have not been able to. The path must not be absolute or "theme dependant". The only way I have been able to fix my issue, is to do add the following within my html file:               <style type="text/css">         #menu .menu-drop .menu-label {             background: url(<?php echo get_template_directory_uri()."/admin/images/drop1.png"; ?>) no-repeat right;         }         #menu li:hover .menu-drop .menu-label {             background: url(<?php echo get_template_directory_uri()."/admin/images/drop2.png"; ?>) no-repeat right;         }         #menu .menu-sub li:hover {             background: #2a2a2a url(<?php echo get_template_directory_uri()."/admin/images/select.png"; ?>) no-repeat 10px;         }     </style>      As you can see, I simply add the background image "manually" in the html file after including the stylesheet in the header. Any idea how to transfer the above to a stylesheet, or is that not possible?


title: Show recent posts in a table format

text: In the index.php template I want to display posts in 3columns in a table format. How can I do this? I don't want a list format cause I have variable hight image sizes


title: Accept code input into Options Framework

text: I'm using Options Framework for a theme. I'd like to add a theme option to add Google Analytics code to the front end's `<head>` section. What is the options.php code to create an input box which won't strip `<script>` from the input?


title: Enclosing Shortcode not working in a Template

text: I've use the following code for an enclosing shortcode and it works perfectly in the posts.               function date_code($attr, $content)     {        return '<h3>' . $content . '</h3>';     }          add_shortcode('datecode', 'date_code');      But when I try to use it in a page template using http://codex.wordpress.org/Function_Reference/do_shortcode it's not working. I've use the following code in my template:               echo do_shortcode( '[datecode]' . $content . '[/datecode]' );      **Please help me since the non-enclosing shortcode works fine with do_shortcode.** And, I'm ignorant with regards to using enclosing shortcode in a page template. I want to display the shortcode in the page template like in the posts. Thanks in advance.


title: woocommerce: change default setting > is_sold_individualy function

text: In woocommerce/classes/abstracts/abstract-wc-product.php on line 338. The is_sold_individualy function is default "false". Is there a way to set this default option to "true"? So in de Wordpress back-end the checkbox is checked by default?                function is_sold_individually() {         $return = false;                if ( 'yes' == $this->sold_individually || ( ! $this->backorders_allowed() && $this->get_stock_quantity() == 1 ) ) {              $return = true;          }                return apply_filters( 'woocommerce_is_sold_individually', $return, $this );       }      Thanks in advance, Mirjam


title: Woocommerce: Remove Woocommerce default address fields

text: I am trying to remove / hide some default address Fields like as the Postcode (Zip-code) field in Cart Shipping Calculator / Whole Woocommerce ? Is there a function for this? I found in shipping-calculator.php               <?php if ( **apply_filters( 'woocommerce_shipping_calculator_enable_postcode', true )** ) : ?>                      <p class="form-row form-row-wide">                     <input type="text" class="input-text" value="<?php echo esc_attr( $woocommerce->customer->get_shipping_postcode() ); ?>" placeholder="<?php _e( 'Postcode / Zip', 'woocommerce' ); ?>" name="calc_shipping_postcode" id="calc_shipping_postcode" />                 </p>                  <?php endif; ?>      I tried to put in fuction.php some code               apply_filters( 'woocommerce_shipping_calculator_enable_postcode', false )      or               // Hook in     add_filter( 'woocommerce_default_address_fields' , 'custom_override_default_address_fields' );          function custom_override_default_address_fields( $address_fields ) {          unset($address_fields['shipping']['shipping_postcode']);               return $address_fields;     }      but impossible Please Help. Thank you very much!


title: Can I create permalinks like this: /%post_type%/%postname%/

text: I've been learning about custom post types from Morten Rand-Hendriksen's great tutorial on making a WordPress portfolio theme on lynda.com. He demos how to set up a custom taxonomy for "recipes" and create links like domain.com/?recipes=post-title. I think this is really cool because you get a post-title with the contextual clue of "recipes" without being stuck with a bunch of nested hierarchical subdirectory archives that may be boring to look at and contain repetitious content. For a large, multifaceted domain, I think it would be neat if there is a way to make a site behave as it has a permalink structure like this: domain.com/%post_type%/%postname%/ for posts and custom post types, while staying with domain.com/page-name for pages. I'm thinking of domain.com/blog/post-name for anything in the blog, though domain.com/?blog=post-title would still work. What do you think, and what is the most practical way to go about this?


title: Previous and Next posts

text: I use the following code for displaying the previous post thumbnail with links:               <?php            $prevPost = get_previous_post(true);            $prevThumbnail = get_the_post_thumbnail($prevPost->ID, array(150,150) );           previous_post_link( '%link', $prevThumbnail );      ?>      The problem is that I get the correct link for the previous post but the thumbnail that is displayed is of the current post and not of the previous post. I am using this for a single template of a custom post type.


title: Merge page with custom post type

text: This may be a weird scenario, but...I have a custom post type called Resources. When visiting /resources/ I get the archive as expected. What I want is a text describing this post type. Therefore I've made a page with the exact name and path. If I now go to /resources/ I still get the archive page, which is good. So, I created a custom template (archive-resources.php) and from there I searched pages with the same path and then I find my page and is able to write out the text before listing the archive. What I want to know is that, is this a good way to solve my problem? if not, how can I make it better?


title: Loop doesn't work in single-product.php page but works at normal page

text:
I'm outputting a list of categories with the posts inside the ul. This works fine on a normal pages but not on the single-product.php page. It breaks on the single-product.php page with the line have_posts. What is the problem?                 <?php         $post_type = $wp->query_vars["product"];       $tax = 'product_category';       $tax_terms = get_terms($tax,'hide_empty=0');            if (is_array($tax_terms)) {         foreach ($tax_terms  as $tax_term) {           $args=array(             'post_type' => $post_type,             "$tax" => $tax_term->slug,             'post_status' => 'publish',             'posts_per_page' => -1,             'caller_get_posts'=> 1           );           $my_query = new WP_Query($args);           if ( $my_query->have_posts() ) {             echo "

$tax_term->name
";             echo "
";             while ($my_query->have_posts()) : $my_query->the_post(); ?>
<a href="<?php the_permalink() ?>" title="<?php the_title_attribute(); ?>"><?php  $delta_article_number = get_post_meta( get_the_ID( ), 'delta_article_number', true );  echo $delta_article_number;  ?> <?php the_title(); ?>
               <?php             endwhile;             echo "

";           }              }       }       wp_reset_postdata();  wp_reset_query();       ?>


title: Moved my Wordpress site and now it can't read the theme

text: I moved my Wordpress website on Friday (so DNS propagation should be long finished) and now the site has no theme. I spent time yesterday re-installing the theme and Wordpress but to no avail. It won't recognize any theme, even Wordpress default http://inspiringtravellers.com Any ideas? I have deactivated all plug-ins and this didn't fix it. I believe it to be a permissions issue somewhere and others have also pointed to a .css file appearing missing though when I look at the ftp it is there. I spent ten hours on this yesterday trying everything and am starting fresh today. Many thanks in advance for your help


title: Hide extra menus from Wordpress Dashboard

text: How can hide extra menus from Wordpress dashboard. That is some plugins gives plugin settings menu may under Settings or anywhere else, how we can hide all this type of extra menus while plugin active


title: Only show content slideshow if "slideshow" custom field exists

text:
I am developing a theme for general release and there is a large content slideshow on the homepage. I have included a checkbox meta box in the post edit screen that allows users to determine which posts are featured in the slideshow but I can't figure out exactly how to create a query for this. The checkbox relates to a custom field called "slideshow" Here is my slideshow code so far;

             <a href="<?php the_permalink('');?>"><?php the_post_thumbnail('slideshow-thumb');?>

<?php $category = get_the_category(); echo 'cat_ID).'">'.$category[0]->cat_name.'';?>

<a href="<?php the_permalink('');?>"><?php the_title('');?>
                 <?php $excerpt = get_the_excerpt(); echo string_limit_words($excerpt,70);?>

      Any help would be greatly appreciated.


title: Create a list of recent Custom Post Types posts

text:
I've been using this snippet to generate a list of recent posts from particular categories in a widget. I'm currently restructuring the site using custom post types and taxonomies and want to generate a list of recent posts from 3 custom post types, taxonomies and categories don't have to be part of the query at this stage but would be nice to know how to include them. Bit of a PHP novice, can't seem to find a solution to this.
     <?php     $recentPosts = new WP_Query();     $recentPosts->query('showposts=10&cat=-4,-30,-19,112,137,125,128');     ?>     <?php while ($recentPosts->have_posts()) : $recentPosts->the_post(); ?>
<a href="<?php the_permalink() ?>" rel="bookmark"><?php the_title(); ?>
     <?php endwhile; ?>
      Ok, seem to have solved it with this               $recentPosts = new WP_Query();     $recentPosts->query(array('showposts' => 9, 'post_type' =>     array('mycustomposttype1',      'mycustomposttype2','mycustomposttype3')));      but still not sure if this is the best method so any feedback appreciated.


title: How to require users to login when not logged in

text: I am trying to develop my first WordPress site, its going to be a school site, I develop sites normally, but this is my first time of using a CMS to do that. The school site is supposed to display the homepage of the school when users view the site, but then, it is supposed to also show a `login link` to users when they are not logged in, and if they are logged in, it is supposed to show extra items on the menu bar. I do not see how to achieve this without some conditional statements in place, but I really hope there is a way to get there without coding, I am new to wordpress and I have not really gone deep into knowing much of its classes and functions, so most preferable I would like to achieve this without coding using plugins or maybe specific themes (if possible), and if not, I would still like to know how to go about it. I hope my question is not too ambiguous. I would really appreciate all answers. Thanks...


title: Search XML file from within Wordpress?

text: We use Jira internally for an defect mgmt system.   We want to provide defect tracking to our clients. We cannot expose Jira to the web, but we do have our main site hosted on WP 3.2.1 I can export a XML file from Jira of the defects and plonk this under our Wordpress site. I was thinking that I could come up with a basic page within Wordpress to allow our users to filter this XML list down. i.e. Search on a reference number of keywords from the title or description nodes. I was hoping to spot a good Jira/WP plugin but no luck. The answer I am looking for, is: \- Is this achievable through WP \- What would be the best approach to go about this? \- Any links to similar attempts would be also beneficial. Let me know if u need more info via the comments.


title: Can't update WordPress, need to reboot the VPS

text: After I moved to a new VPS (Ubuntu), I can't update the WordPress. When I click on the "Update Now" button, it shows upgrading progress messages and it shows "Welcome to WordPress 3.9" (Now I'm on 3.8.3), but after refresh the page, nothing happens. Again, I'm on the WordPress 3.8.3. Then I deactivated all the plugins and again, I re-update the Wordpress. But nothing happened. I can only fix this issue after reboot the VPS. After the reboot VPS, when I log-in/visit the WP dashboard, it only shows upgrade message. However I can successful update plugins without rebooting. My VPS running nginx, APC, pagespeed mod, Ubuntu 12.04. What could be the reason for this matter? Thanks!


title: subcategories inside div tag

text:
I'm trying to style subcategories separately. I tried to put them into divs, but it doesn't work. Any ideas?               <?php     // get the term id     $category = get_queried_object();          // Get categories     $hird_categories = hird_get_subcategories( $category->term_id );          if (!$hird_categories ) {      $herd_products = hird_get_products( $category->term_id );     }     get_header();     ?>
     <?php       if ( function_exists('yoast_breadcrumb') ) {         yoast_breadcrumb('
','
');       }     ?>
<?php echo $category->name ?>

 Select Category

<?php echo category_description( $category->term_id ); ?>
            <?php if ( $hird_categories ): ?>              <?php foreach ( $hird_categories as $key => $category ): ?>
           <a href="<?php echo get_bloginfo('url') .'/products/'. $category->slug?>">

<?php echo $category->name; ?>

       <?php endforeach ?>       <?php elseif( $herd_products  ): ?>                       <?php foreach ($herd_products  as $key => $product): ?>
             <a href="<?php echo get_permalink( $product->ID );  ?>">              <?php if ( get_the_post_thumbnail( $product->ID ) ) : ?>                <?php echo get_the_post_thumbnail( $product->ID, 'hird-category-image' ); ?>              <?php else: ?>                <img src="<?php echo get_template_directory_uri(); ?>/images/hird_placeholder.png">              <?php endif ?>

<?php echo $product->post_title; ?>

         <?php endforeach ?>       <?php else: ?>          There are no items to show!       <?php endif ?>


title: Where can I find admin-header.php file online?

text: I am using Wordpress for my website. I was working on CPANEL yesterday and was browsing `public-html/wp-admin folder` under the `File manager`. There were many files and I accidentally deleted the `admin-header.php` file. Where can I get an another copy of that file so that I can upload it to the same folder from where it got deleted?


title: Edit tags page for hierarchical taxonomy doesn't show taxonomies at all depths

text: I created a taxonomy called "portfolio categories" for my portfolio custom post type. They're hierarchical and supposed to be behave like categories. when i'm editing a single portfolio post... i have a metabox where i can assign the proper portfolio category. It shows all categories at all the depths. ![unlimited hierarchy](http://i.stack.imgur.com/bSVmK.png) but when i am on the Taxonomy page (edit-tags.php?taxonomy=portfolio- cats&post_type=portfolio) then it only shows top level categories and their immediate children... and no further. so grandchild-level categories are missing even though there are portfolio pieces assigned to them. ![limited hierarchy](http://i.stack.imgur.com/m3n3z.png) is this default behavior? b/c i can see unlimited depths on the regular Categories page. should a hierarchical taxonomy behave the same?               /*      * Builds the a tag taxonomies      */          function create_portfolio_taxonomies() {     // Add new taxonomy, make it hierarchical (like categories)       $labels = array(         'name' => _x( 'Portfolio Categories', 'taxonomy general name' ),         'singular_name' => _x( 'Portfolio Category', 'taxonomy singular name' ),         'search_items' =>  __( 'Search Portfolio Categories' ),         'all_items' => __( 'All Portfolio Categories' ),         'parent_item' => __( 'Parent Portfolio Category' ),         'parent_item_colon' => __( 'Parent Portfolio Category:' ),         'edit_item' => __( 'Edit Portfolio Category' ),          'update_item' => __( 'Update Portfolio Category' ),         'add_new_item' => __( 'Add New Portfolio Category' ),         'new_item_name' => __( 'New Portfolio Category Name' ),         'menu_name' => __( 'Portfolio Categories' ),       );                  register_taxonomy( 'portfolio-cats', array('portfolio'),              array(                  'hierarchical' => true,                  'labels' => $labels,                  'rewrite' => array( 'slug' => 'portfolio','with_front' => true, 'hierarchical' => true  ),             ) );              //preset some categories         my_add_term($postID,'portfolio-cats','Print');           my_add_term($postID,'portfolio-cats','Digital');          }     add_action( 'init', 'create_portfolio_taxonomies', 0 );                    function my_add_term($id, $tax, $term) {              $term_id = intval(term_exists($term));         if (!$term_id) {             $term_id = wp_insert_term($term, $tax);             $term_id = $term_id['term_id'];         }         $result =  wp_set_object_terms($id, array($term_id), $tax, FALSE);              return $result;     }


title: Script not working correctly produce error: An unidentified error has occurred

text: I am developing a wordpress theme while adding a category from admin panel it doesn't show the category until I refresh the page and when I delete the same, it produces an error: _An unidentified error has occurred._ And when I refresh the page it's been deleted.


title: Second foreach loop breaking (Posts2Posts)

text:
I've read about a couple of similar issues that Google gave me (1 & 2), but I can't quite get to the bottom of this problem. Using Posts 2 Posts, I'm building a table of posts and their related posts on a Discography Template on a music site. I need to use `each_connected` twice to show the relationship between Albums > Artists and Albums > Producers. My main loop calls the album CPT. The issue I'm having is the second `foreach` loop which always returns an `invalid argument supplied foreach...`. I've tried changing the order in which everything is called, I've used `global $post;` just before my main loop, nothing has worked. At this point, I hope it's not something stupid I've done! Here's the code:                               <?php                     $args = array (                         'post_type'              => 'hhie_albums',                         'post_status'            => 'publish',                     );                               $query_albums = new WP_Query( $args );                     p2p_type( 'albums_to_artists' )->each_connected( $query_albums, array(), 'artists' );                     p2p_type( 'albums_to_producers' )->each_connected( $query_albums, array(), 'producers' );                               if ($query_albums->have_posts() ) { ?>                             <?php while ($query_albums->have_posts() ) { $query_albums->the_post();  ?>
                                         <a href="<?php the_permalink() ?>" rel="bookmark" title="Album: <?php the_title_attribute(); ?>"><?php the_title(); ?>	                                                                           <?php foreach ( $post->artists as $post ) : setup_postdata( $post ); ?>                                     <a href="<?php the_permalink() ?>" rel="bookmark" title="Artist: <?php the_title_attribute(); ?>"><?php the_title(); ?>                                     <?php endforeach; wp_reset_postdata(); ?>                                 	                                              <?php foreach ($post->producers as $post) : setup_postdata( $post ); ?>                                     <a href="<?php the_permalink() ?>" rel="bookmark" title="Producer: <?php the_title_attribute(); ?>"><?php the_title(); ?>                                     <?php endforeach;                                     wp_reset_postdata(); ?>                                 	                         <?php } ?>
                          <?php } else {                          }                               wp_reset_postdata();                     ?>


title: Exclude posts with specific meta_value while sorting by a separate meta_value

text: I am trying to exclude posts with a specific meta_value with a specific meta_key while also sorting the posts by a meta_value with a different meta_key. This is my current code for the WP_Query class:               $paged = (get_query_var('paged')) ? get_query_var('paged') : 1;          $args = array(          'posts_per_page' => '50',         'meta_key' => 'release_date',         'orderby' => 'meta_value_num',         'order' => 'ASC',         'paged' => $paged     );     $the_query = new WP_Query($args);      the sorting by a specific meta_value part is working fine but I am not sure what to add to get it to exclude posts with a specific meta_value with a different meta_key than the one used for sorting. Any advice / help is very much appreciated. **I got this working with the code below:**               $paged = (get_query_var('paged')) ? get_query_var('paged') : 1;          $args = array(          'posts_per_page' => '50',         'meta_key' => 'release_date',         'orderby' => 'meta_value_num',         'order' => 'ASC',         'meta_query' => array(             array(                 'key' => 'undetermined_date',                 'value' => 'TBA',                 'compare' => '!=',                 'type' => 'CHAR'             )         ),         'paged' => $paged     );     $the_query = new WP_Query( $args );      I have changed the custom field type to check-boxes which returns true or false instead of a text box. How would I change this code for use with a check-boxes? Here is the code I have tried:               $paged = (get_query_var('paged')) ? get_query_var('paged') : 1;          $args = array(          'posts_per_page' => '50',         'meta_key' => 'release_date',         'orderby' => 'meta_value_num',         'order' => 'ASC',         'meta_query' => array(             array(                 'key' => 'undetermined_date_toggle',                 'value' => 'true',                 'compare' => '==',                 'type' => 'CHAR'             )         ),         'paged' => $paged     );     $the_query = new WP_Query( $args );


title: Wordpress website homepage (only) stuck in maintenance mode

text: My website only shows the "Briefly unavailable for scheduled maintenance. Check back in a minute." message only on the homepage. Been stuck for two days, don't really know how to fix it. What did I already do. 1\. Search for the .maintenance file (there is no, even hidden files) 2\. Remove the update plugin folder 3\. Create a fake maintenance mode and remove it 4\. Update other plugins to see if the website would have been back to normal What's also strange is that other people can perfectly see the website homepage and I can't from my ipad, iphone, mac. I Don't really understand what's happening. What should I try to be able to fix it now ? Any ideas ? Thx you guys.


title: Password protect some uploaded files, so only logged-in users can view them

text: I would like to protect some uploaded files, so that they are not publicly accessible (they are not accessible without a login). I'm uploading some PDF files, and I'd like to mark some of them as protected, so they can't be accessed without a login on the Wordpress web site. I'm currently using the Member Access, which lets me mark some posts and pages as protected (so only logged-in users can view them). This is great. However, it does not provide any way to protect media uploads (i.e., attachments). Note that I do not want to protect all uploads, only some of them. Some uploads need to be accessible to the public, while others should only be accessible to logged-in users. I'd prefer to do this through the Wordpress administration interface (not a hairy .htaccess file that has to be manually administered). I want something that is actually secure, not just security- through-obscurity. How do I do this? (I've read How to Protect Uploads, if User is not Logged In?, but it concerns methods to protect all uploads, not just some of them. I've read How to restrict access to uploaded files?, but it focuses on security-through- obscurity. This is close to simple solution for restricting access to (some) uploads/downloads, but I'd prefer a solution that can be administered through the web interface if possible.)