title: Is using eval() ok in this scenario

text: I am trying to include user input includes using "get_template_part()" The includes are added in the theme options eg a user inputs.               get_template_part('content/block', 'branding');     get_template_part('content/block', 'footer');      I need to execute this code as php and have a custom hook for add_before_content() which runs just before content and sidebars. In my layouts class, I have a method that checks the user input and then uses this to add the includes using eval()               function add_before_content() {         global $options;         $string = "get_template_part('content/block', 'branding');";         return eval($string);     }          add_action('before_content', 'add_before_content');      This works perfectly, however I get nervous when using eval() especially when it involves user entered content. My thinking in this scenario is that it should be avoided because it allows users to enter any php code and it will be executed. However, the only access is from the admin login. I have actually since implemented a different solution, but wanted to put this question out there as it will be good to get some feedback. Would eval() be a bad idea in this scenario? ## Further clarification I am trying to achieve the same result as opening the index.php file of the theme and adding `get_template_part()` to include a template file. For example: `<?php get_template_part('content/block', 'header'); ?>` But allowing the user to do this from the theme options without having to open the themes files. The contents of the file are not really important, its just a normal php include that should be included and run when called. In my theme options I have an editor element (extended textarea) I use for a few features so code can be added into the theme from the theme options without the user needing to open the theme files. This works perfectly fine for html that I have added so far. The value is stored in the database and when its echoed in the theme, it echoes the html, no problem. However, when I wanted to allow the user to add the includes which is php from the theme editor its where I got stuck. There are 2 places the user would add these includes. Above and Below the content which there are also hooks for which is why I use them. Here is a screenshot of the editor with the includes defined. http://cl.ly/3n3r3H381g1U1a2t3T3g What I need is for the files branding and header to be included, just as if I had opened the index.php file and entered the get_template_part includes in the file manually, instead of the editor. Just echoing the value using the way you explained outputs it on the page as a string like this http://cl.ly/3I251I0B282i0c0E0U2j Instead of actually including those template files. Using eval() means that the saved value of the editor which is a string, would be evaluated as php and it adds the includes just as if I added it in the index.php, hence why it works and is the only way I could figure it out. I hope this makes things a lot clearer. Thanks for your patience :) ## The concept This particular feature I am talking about here is the only place I was doing something quite like this where I am trying to add php and have since gone a different route, but posted this question about eval() as I wanted to confirm my thinking. This is a parent theme and when first installed only has a content area and sidebars… nothing above or below. Like a "clean slate" to start from when building a site. The theme has something called a "block builder" which allows users to define and add/remove "building blocks" to their website and then define the content to show in these building blocks. eg: they can add a block called "branding" A building block is just like any "section" of content on a website. A logo area, a navigation area, footer shelf, toolbar etc. The building blocks concept is taken from the Joomla template framework we developed which has building blocks at its core. www.getmorph.org Once a block is defined, it can be set to output in one of 4 ways.   1. Widgets (if set to widgets a new widget pos with the block name is created)   2. Featured posts (can featured any posts on the post page to the block or pull from set categories and display as a grid, carousel, slider etc)   3. Custom html (they can enter any html and some [tags] for popular elements like [logo] [sitename] etc that come with the theme. Yes this can be done using widgets as well, so they can set widgets as the output and put html in the widget.. its the same result, this is just a little easier but open to user preference.   4. Disable block.. turns it off and unpublishes it. The block creation is fully automated, when a new block is added, a new include with all the relevant options is created and a theme options page is also created on the fly using ajax. Obviously this will not work without actually calling the block in the theme somewhere… this is the only manual step and where the whole point of my original question comes to light. It is easy for any user to open the index.php or better create a child theme and add an index.php and add the code to call the block `<?php get_template_part('content/block', 'header'); ?>` This is even how it is explained in the documentation and a code snippet is even generated with the block name, they just click to copy it. Instructions are given on how to add the block.. this is the only thing they need to do. Very simple indeed. However, while doing alpha testing with a closed team of users, a few asked if it would be possible to not have to open the theme files to add the block include… hence my question. Note: the building blocks are optional to use.. users don't have to use them, they can just use the theme like any other theme, but for many users this will make building and modding their website a lot!! easier. It means instead of defining 70 widget positions just in case a user needs it. Our approach is scalable, it starts off with only the sidebar widget position. As a theme is developed using slate as a base, unlimited widget positions can be added as needed by adding the required blocks.


title: Get all meta boxes values

text: I want to list all the values of a custom metabox in a custom post type. Here is the code to get the one meta box in a single post               <?php echo get_post_meta($post->ID, 'institution_location', true);?>      but say I want to list all the meta boxes in the home page or a dropdown menu in a search form not just in a single page the metabox code                add_meta_box(         'Location_metabox',         __( 'Location ', 'twentyeleven' ),         'institution_location_metabox_output',         'institution',         'side'     );      Thanks # Solution I tried to use WP_Query and it works fine.               <?php         $args = array('post_type' => 'institution');         $the_query = new WP_Query($args);              while ( $the_query->have_posts() ) : $the_query->next_post();         $id= $the_query->post->ID;         $location = get_post_meta($id, 'institution_location', true);         echo $location;         endwhile;     ?>


title: How to pass variable via $callback_args for add_meta_box

text:
I trying to pass some variable to the callback function through add_meta_box. Knowing that there is $callback_args that can be use to pass the variable. But somehow I just can't get it work within a class. This is my codes               class myclass{      //.....blah blah....adding action       function add_ex_field() {          add_meta_box( 'apextadmin', __( 'My Custom Field', 'myplugin_textdomain' ),array($this,'the_callback_function'),post,array('test'=> $param));}//the $param is some value that saved in my option table.     }           function the_callback_function($post, $metabox){//do I need to include these two parameters? because they gave me error!       echo '
testing field
';      echo $metabox['args']['test'];      }          }     global $myclas;      $myclas = new myclas();      Thanks.


title: How to load a template without it being assigned to a page/post?

text: Can I create a template and load it without associating a page/post to it in WordPress? The template will list custom posts in XML. [update] I have a jquery carousel that loads an XML file through ajax. I am storing each slide as a custom post type call 'carousel_slide'. I want to create an XML feed with these custom post types. At first I created the feed outside wordpress, including wp-load.php and using WP_Query. This worked fine but I now realize that I need a multi-lingual plugin (WPML) to be loaded as well. This is why I want to create a wp template instead. However if I create a template, I need to assign a page to it to be able to load it. I'd rather not create an empty page simply to be able to call a template. I am new to WordPress development and might have overlooked an obvious solution.


title: Customize the Wordpress Default Gallery Output

text:
I want to customize the Wordpress default gallery so that it would format as something like this for each item:

      Basically I want the link (`<a>`) to have:   * `rel` for activating lightbox script (defined as "lightbox-cats" by user manually in each gallery)    * `href` that links to direct URL of the image (e.g.: http: // mydomain.com/link/to/image.jpg)   * `title` that is for Wordpress image caption   * `name` which is the image file name (e.g.: image.jpg) I've been trying to create the formatting through modifying snippets I got from [here] and [here], but it gets very messy because I don't know how to remove unncessary stuff. For example, I don't need the `<a>` to link to the attachment page (something like http :// mydomain.com/?attachment=20). I only need it to link _directly_ to the image URL. Using filter and adding it to `functions.php`, here is what I have done so far (it's very messy): http: // pastebin.com/Q51W1BVr I put it into pastebin because it's a bit too long (I'm sorry I can't make it a link because I don't have enough reputation point here :/ ) Though I believe the parts which modifies the output is only from here:               $i = 0; // Modified output from here     foreach ( $attachments as $id => $attachment ) {              $link = wp_get_attachment_link($id, $size, true, false);         if( ! empty($rel) ) { !!! // Add rel injection             $link = str_replace('<a href=', "ID ). " alt=", $link);         } else {             $link = str_replace('<a href=', "post_excerpt) . "' name='", $link);              $output .= "<{$itemtag} class='gallery-item imgteaser'>         ";         $output .= $link;         $output .= "</{$itemtag}>         ";              if ( $columns > 0 && ++$i % $columns == 0 )             $output .= '
';     }          $output .= "

\n";          return $output;     }      * * * Here is how messy the output result is:
                  <img width="150" height="150" src="http://localhost/test/wp-content/uploads/2012/09/002-150x150.jpg" class="attachment-thumbnail" alt="002" title="002"
      It works, but it has the unnecessary `alt="http://localhost/test/?attachment_id=36"` because I don't know to remove it. And I feel my code is really unefficient/unclean. :/


title: Manage custom menu for an Editor?

text: I've a problem with permission. Is there a specific permission to let an user with Editor Role, manage the custom menu of a theme, and _only this options?_ The item that is under Appereance -> Menu, to be clear. I'm using the capability plugin. Must I write a custom hook to enable only the use of custom menu editor ? TIA Edit: I've code a simple solution. See below my answer!


title: Problem with W3 Total Cache Interfering with Cron Jobs

text: I'm having an issue on a site where I schedule posts and they all miss their schedule every time and end up having to be manually published later in the day. I have WP cron disabled (`define('DISABLE_WP_CRON', true);`) and have a manual cron job (`wget -q -O - http://example.com/wp-cron.php?doing_wp_cron >/dev/null 2>&1`) set up instead. W3 Total Cache is set to Disk for Object Cache a Disk: Enhanced for Page Cache. I tried setting `define('ALTERNATE_WP_CRON', true);` instead and no luck - posts still miss schedule.


title: Posts 2 Posts: Display custom types connected to the same other custom type but with another connection

text: I'm creating a Tennis website. I've got 2 custom types : players and tournaments. I would like to display the result of the finals on the tournaments page and players page. That is to say, on each page of tournament I want to display the name of the finalists (winner and loser) and on each page of player, I want to display the name of the tournaments for wich this certain player was finalist (and display his corresponding opponent). I hope I'm understandable! With the help of the plugin Posts 2 Posts, I created 2 connections between the players and the tournaments:                   p2p_register_connection_type( array(                 'name' => 'won_final',                 'from' => 'player',                 'to' => 'tournament'             ) );     and         p2p_register_connection_type( array(                 'name' => 'lost_final',                 'from' => 'player',                 'to' => 'tournament'             ) );      I have no idea of what code I can use to find and the display the corresponding opponent of a certain player when I display the tournaments for which the player was finalist. Any help to put me on a track ? Thanks!


title: How to prevent apostrophes and quotes from appearing in permalinks?

text: I'm using custom permalinks "/%category%/%postname%/". Whenever a post title contains quotes or apostrophes they appear in the URL. Can someone tell me how prevent them from appearing in the slug? I am running WordPress 3.0.4.


title: Errors when uploading images in WP 3.5

text: I'm trying to upload images in WP 3.5 to set featured images for posts. Unfortunately I get the following error message: > An error occurred in the upload. Please try again later. The installed theme is Minimatica. I've tried Googling the issue, but couldn't find any solution except downgrade to WP 3.4.2.


title: Hide plugin list

text: I want to hide my plugin list. Suppose anyone can see which plugin I use from this site. How can I hide my plugin list from here? I use WordPress new version, and I want to always update my plugin but don't want anyone can see my plugin name. How can I do that?               function cws_hidden_plugin_12345( $r, $url ) {         if ( 0 !== strpos( $url, 'http://api.wordpress.org/plugins/update-check' ) )     }


title: Add description text under input field for new profile fields

text:
How can I modify my following code to add some description text under the input fields? I tried modifying it as you can see with the facebook url field but the text shows up under the field label and not the actual input field --               function modify_contact_methods($profile_fields) {         // Add new fields         $profile_fields['address'] = 'Address';         $profile_fields['city'] = 'City';         $profile_fields['state'] = 'State';         $profile_fields['zipcode'] = 'Zip Code';         $profile_fields['phone'] = 'Phone Number';         $profile_fields['fax'] = 'Fax';         $profile_fields['gplus'] = 'Google+ URL';         $profile_fields['twitter'] = 'Twitter URL';         $profile_fields['facebook'] = 'Facebook URL
Ex: www.facebook.com/username';         // Remove old fields         unset($profile_fields['aim']);         unset($profile_fields['yim']);         unset($profile_fields['jabber']);              return $profile_fields;     }     add_filter('user_contactmethods', 'modify_contact_methods');


title: How to put custom admin setting field into a shortcode

text: I set up an admin settings menu and I'd like to output the fields as a short code. The way I learned to output the fields from a tutorial was with:               <?php $input_examples = get_option('sandbox_theme_input_examples'); ?>     <?php echo sanitize_text_field( $input_examples[ 'textarea_example' ] ); ?>       But putting that into the shortcode doesn't work:               function shortcode()     {          return '<?php $input_examples = get_option('sandbox_theme_input_examples'); ?>';     return '<?php echo sanitize_text_field( $input_examples[ 'textarea_example' ] ); ?>';          }     add_shortcode('shortcode', 'shortcode');      I'm guessing there is a specific way to put php code into the shortcodes that I'm not understanding? I've looked all over and can't find a solution to this.


title: How to get/display specific WP page with beloning page template in DIV (fullPage.js)

text:
I've recently been trying out the really neat JavaScript snippet for fullPage- design from Alvaro Trigo. http://www.alvarotrigo.com/fullPage/. I use it togheter with WordPress with the purpuse of creating a sleak and minimalistic publishing tool for portfolios and alike. The script makes you divide the website into different DIVs with every DIV representing a new page. In my startpage I've got my regular loop from WordPress wich gets all the regular posts. Now I need to make a "About" page where everything needs to be editable from the back end. I use custom meta- boxes to make the fields for all the different text-objects. For this "About" page i also made a specific page template to suit my needs and here comes my problem. I can't seem to get the specific page with this specific page template. Is it possible? The only thing I've been able to achieve is to get the content, pagetitle and specific metaboxes. But just the content of these and none of the page template. To get this content information I've used this php code:

          <?php     $page_id = 23;  //Page ID     $page_data = get_page( $page_id );           //Store page title and meta-boxes in variables     $title = $page_data->post_title;      $meta_box1 =  get_post_meta($post->ID, '_wpb_offer_module', true);     $meta_box2 =  get_post_meta($post->ID, '_wpb_for_module', true);     $meta_box3 =  get_post_meta($post->ID, '_wpb_love_module', true);           //Display the title and meta-boxes     echo $title;     echo $meta_box1;     echo $meta_box2;     echo $meta_box3;     ?>
      This code is as you can se inserted in the DIVs regulated by the fullPage.js så appear on a individuall page. The next div instead includes my loop like this:
          <?php get_template_part('loop'); ?>
       I know that i could make the `echo`command could just output my values into DIVs but i would like to have it more customizible for a person without knowledge of HTML and such later. Is it possible to get my specific page with ID 23 with the beloning "page- about.php" template somehow? In the same way as I `only use get_template_part` with the loop? In that way i could have the loop for the page inside of the page-about.php instead. This would also make it easier to create some of my other pages as they otherwise will encounter the same problem.


title: Pasting formatted text from MS-Word

text: I want to paste into Wordpress posts large amounts of text stored in MS-Word files. When I directly copy-paste from MS-Word, the page usually breaks because of various MS-Word control characters. So I prefer to save my text as .txt and then copy pure text and paste it in Wordpress. However, I then lose all formatting, like bold and italics. Any ideas?


title: Add a DropDown Taxonomy Filter on Archive Page

text:
I need to add a taxonomy dropdwon filter in archive page so that I can display the posts assigned to selected taxonomy. Here is the HTML Output for taxonomies:               <form method="post" action="<?php echo $_SERVER['PHP_SELF']; ?>">       <select name="services" id="selectservice" class="postform" onchange="submit();">         <option value="">Select Service</option>         <option value="intensive-support">Intensive Support</option>         <option value="recovery-work">Recovery Work</option>         <option value="tenant-support">Tenant Support</option>       </select>     </form>      Below is the Query Code :

           Name	           Location	           Website	           Service(s)
         <?php $service_query = new WP_Query('post_type=ptype_service&posts_per_page=-1'); ?>         <?php $j = 0 ?>         <?php while ($service_query->have_posts()) : $service_query->the_post(); ?>         <?php $additional_class = (++$j % 2 == 0) ? 'even' : 'odd'; ?>         <tr class="<?php echo $additional_class ?>">           <?php the_title()?>	           <?php echo (get_post_meta($post->ID, 'pir_groups_location', true))?>	           <a target="_blank" href="http://<?php echo (get_post_meta($post->ID, 'pir_groups_website', true))?>"><?php echo (get_post_meta($post->ID, 'pir_groups_website', true))?>	                        <?php             $terms = get_the_terms( $post->ID, 'services' );             if ( $terms && ! is_wp_error( $terms ) ) :                       $services_links = array();                   foreach ( $terms as $term ) {                     $services_links[] = $term->name;                 }                                                $on_draught = join( ", ", $services_links );             ?>             <?php echo $on_draught; ?>             <?php endif; ?>
         <?php endwhile; ?>
      Regards


title: Separate blog on one WordPress

text: I have created few static web pages for my small coaching institute using WordPress. We have three faculty and I want that each faculty should have their blog. So I want `http://myinstitute.com/faculty1` as a blog of Faculty 1, and Faculty2 and Faculty3 respectively for each faculty. And I want this to integrate on my WordPress site. Also I want that all post should NOT club under one head of coaching institute. Is it possible using simple customization, and if _yes_ , how?   If _not_ by simple customization, then what all changes need to be done?


title: display a dynamic calculated value on each of the post wordpress

text: i am working on wordpress based coupon site. I have to create a amount calculator which would work on all the individual category pages . I would be having a amount slider which would be having $ values. Once a value is selected and on clicking the submit button, i want the percentage deals (under that respective category) to calculate a amount with respect to the $ amount selected using the slider. and then displaying it on their respective deals. I hope the idea is clear. Till now, i have managed to, take all the posts title of the current category page into an array, and then using the preg_match feature, i have managed to extract out the '%' deal amount. Also i have created a simple slider which the user will need to input their $ amount.               <?php     $array = array();     global $post;     $category = get_the_category($post->ID);     $category = $category[0]->cat_ID;     $myposts = get_posts(array('numberposts' => 1, 'offset' => 0, 'category__in' => array($category), 'post_status'=>'publish'));     foreach($myposts as $post) :     setup_postdata($post);          $title = get_the_title();     array_push($array,$title);           endforeach; ?>      <?php wp_reset_query(); ?>            <?php             foreach($array as $str) {     if(preg_match('/(\d+)\%/i' ,$str,$m)) {                  echo $m[1],"\n"; ?>            <input type="text" name="a" value="<?php echo $m[1]; ?>" size=5>           <?php  }     } ?>      the above code is used to fetch all the post under the current category and extracting the % value from the respective post title. The extracted number is in '$m[1]' which i would like to pass against the respective post. I am not able to define the respective post and passing that '%' amount and in return sending the calculated amount and saving it back to that particular post. that is, on clicking the submit button, i would want that each post having percentage value would get calculated and get displayed against that particular post. Sorry for such a huge explanation. I didnt want any detail to get missed out. Any help would be appreciated.


title: is_home() not working in functions.php file

text: I'm using woo themes and trying to use some woo hooks to hook into the index.php file from my child theme. I'm using the following code:               function content_woo_main_before() {         if  (is_home() || is_front_page()) {             include('includes/home-news.php');         }     };     add_action('woo_main_before', 'content_woo_main_before', 15 );          function content_woo_main_after() {         if  (is_home() || is_front_page()) {             include('includes/home-news-after.php');         }     };     add_action('woo_main_after', 'content_woo_main_after', 15 );      The strange thing about this is that the first function loads as it should on the home page, but the second one does not. I tried a few things like changing the order that the functions are run, changing the names, I tried wrapping the functions in the conditional statement. Nothing worked. Am I doing something wrong here? I found a few other posts that had something similar to this, about how the `is_home()` won't work in functions.php, because it runs before we know if we're on the home page, but that wouldn't explain why the first function works properly, and the second one doesn't. Anyone have any ideas? **UPDATE:** So, based on the feedback I've gotten, I've updated the following using `get_template_part()` http://www.re-electsusanguidry.com/admin/ here's the code:               function content_woo_main_before() {         echo 'is_home1 =' . is_home();         echo 'is_front_page1 = ' .  is_front_page();              if  (is_home()) {             get_template_part('home', 'news');         }     };     add_action('woo_main_before', 'content_woo_main_before', 20 );                    function content_woo_main_after() {         echo 'is_home2 = ' . is_home() . '<br />';         echo 'is_front_page2 = ' .  is_front_page();         if  (is_front_page()) {             echo 'is_home3 =' . is_home();             echo 'is_front_page3 = ' .  is_front_page();             get_template_part('home', 'after');         }     };     add_action('woo_main_after', 'content_woo_main_after', 21 );      Here's what I don't get. If I have both of these functions with both using `is_home() || is_front_page()`, the first returns "1", but the second functions return nothing at all. So, "is_home1" returns 1, "is_front_page1" returns 1, therefore it's true and the content loads. However, "is_home2" and "is_front_page2" returns nothing, the conditional statement returns false, and the content doesn't load. I tried various numbers for the loading sequence, but that didn't do anything. I put some crazy long number and it still didn't return true. What's also weird is that if I take out the first function (woo_main_before), the second one works as expected. Only when both of them are there does the second one not work. I can't seem to find anyone else with this problem online. I have no idea what's wrong. Any ideas?


title: Loading jQuery library from WordPress admin

text: When we are developing Themes, we are taught to enqueue the **jQuery library** if necessary, because no jQuery library is available on the front-end of WordPress (if I'm not wrong). But when we are into the Admin Panel of WordPress, WP is using jQuery for various purposes -- WordPress back-end, by core, already loading jQuery into its admin area. So, when we are developing Back-end features for a Theme or Plugin, and we are in need of loading jQuery, is that possible to load jQuery library from WordPress bundle? I'm asking this because in one of my under-dev. plugin, I added jQuery library-   * from the jQuery CDN,   * and as a fallback, from the plugin bundle (using this SO thread) Now, on every page-refresh my admin panel hits the jQuery CDN, and takes the jQuery lib file from the CDN. If there's no internet connection the php-file- read throws a debug error, but the jQuery loads from my plugin bundle. But if we can load jQuery from the WP bundle, it'll save time and load of a page, I think.


title: Change the layout of user-edit.php profile

text: I've got a website with over 200 users, and they all use their profiles to display up to date information on themselves and services that they offer. Is there anyway to change the layout / style of user-edit.php? In a non-destructive way, I don't want to avoid updating. I've been adding extra fields to the user profile page, fields, wysiwyg's and images, but they're laid out in one huge list and it looks ugly and confusing to say the least. I'd love to be able to put it in a nice format, perhaps with tabs so they've got better content management for their profile.


title: addaction hook cause redirection problem

text: I have added the hook in my wp functions:               add_action('pa_taxname_edit_form_fields',  'woocom_edit_attribute_chk_field', 10, 2);               function woocom_edit_attribute_chk_field($term, $taxonomy) {          //////////////// My code here          }          add_action('edited_term', 'woocom_attribute_chk_field_save', 10, 3);          function woocom_attribute_chk_field_save($term_id, $tt_id, $taxonomy) {                     metas = $_pOST['aa'];                      update_woocommerce_term_meta($term_id,'_designparent', $metas);          }      Here the field saved successfully. But it is not redirect to the edit- tags.php. Here the query strings are missed. Actual url = `edit- tags.php?action=edit&taxonomy=pa_taxname&tag_ID=1036&post_type=product` But after save the page redirected to `edit-tags.php` (Query strings missed)


title: Print string to footer using wp_footer option

text: add_action('wp_footer','slider_option');           function slider_option() {         $option ="<script>script function data                         </script>";          echo $option;       }      I want to print or you can say insert data in `$option` variable to footer menu Any suggestions?


title: Settings API - save multiple tabs at once

text:
In the attached screenshot you can see the structure of the theme options we are working with. There are 8 tabs and for each tab, we have created custom fields using code similar to what can be seen below.This is how we are setting the default values for each field. ( ie. default = 'http://facebook.com/samplefacebooktitle')               function facebook_callback() {              $item ='facebook';         $default ='http://facebook.com/samplefacebooktitle';         $group = 'general_display_options';         $input = create_input($item,$default,$group);         echo $input;     }      and then the create_input function:               function create_input($item,$default,$group) {              $obj = $group.'['.$item.']';         $options = get_option($group);          if ($options[$item] != '') {              $value= $options[$item];          } else {              $value = $default;          }         return '<input type="text" id="'.$item.'" name="'.$obj.'" value="'. $value .'" />';          }      In order to initialize the defaults though, we need to save each tab individually the first time the theme loads and this theme is to be customized for internationalization by many companies in other countries. So, the question is, Is there a simple way to pre-load these default values and have them saved automatically before the theme options are saved the first time. And if not, does anyone know a way to save all theme options at once when you click save on any given tab? ![](http://i.stack.imgur.com/1VLxH.jpg) ------- EDIT --------------------- Thanks to Chip Bennett for helping me get this working! The below code is a bit gnarly, but it works, and sets up the defaults on theme activation. Also added is a check to see if values are '' and if so, we re-set them to the defaults created in the create_general_defaults() function. Please feel free to let me know ways to optimize this code.               <?php          function theme_menu() {         add_theme_page(             'My Theme',             'My Theme',             'administrator',             'theme_options',             'theme_display'         );          }      add_action('admin_menu', 'theme_menu');          function theme_display( $active_tab = '') {     ?>

Theme Options
             <?php settings_errors(); ?>             <?php                 if(isset($_GET['tab'])) {                     $active_tab = $_GET['tab'];                 } else if ($active_tab == 'nav_options') {                      $active_tab = 'nav_options';                 } else {                     $active_tab = 'display_options';                 }             ?>
                 <a href="?page=theme_options&tab=display_options" class="nav-tab <?php echo $active_tab == 'display_options' ? 'nav-tab-active' : ''; ?>">General                 <a href="?page=theme_options&tab=nav_options" class="nav-tab <?php echo $active_tab == 'nav_options' ? 'nav-tab-active' : ''; ?>">Nav
             <form method="post" action="options.php">                     <?php                         if( $active_tab == 'display_options' ) {                             settings_fields( 'theme_display_options' );                             do_settings_sections( 'theme_display_options' );                         } else if( $active_tab == 'nav_options' ) {                             settings_fields( 'theme_nav_options' );                             do_settings_sections( 'theme_nav_options' );                         }                         submit_button();                     ?>             </form>
     <?php     }          /* -------------------- *       *  register settings      *  -------------------- */     //global $theme_display_get_options;     // $theme_display_get_options = theme_display_get_options();          function initialize_theme_options() {              // verify if the options exist         if(false == get_option('theme_display_options')) {             add_option('theme_display_options');         }              add_settings_section(             'display_settings_section','General Options','display_options_callback','theme_display_options'         );              add_settings_field('facebook_alt','Facebook Alt Tag','facebook_alt_callback','theme_display_options','display_settings_section');              register_setting('theme_display_options','theme_display_options');          }     add_action('admin_init','initialize_theme_options');               function display_options_callback() {         echo '
Enter the necessary values for the following fields.
';     }          function create_general_defaults() {         global $general_defaults;         $general_defaults = array(             'theme_title' => 'My Title Yo',             'facebook' => 'http://facebook.com',             'facebook_alt' => 'My default'         );              //save these in case something is blank and it will return to its default value         $general_orig_defaults = apply_filters('my_options_defaults', $general_defaults);         return $general_orig_defaults;     }      create_general_defaults();          function get_general_defaults() {         $option_defaults = create_general_defaults();         global $the_theme_options;         $the_theme_options = wp_parse_args( get_option('theme_display_options', array() ), $option_defaults );         return $the_theme_options;     }     get_general_defaults();          function facebook_alt_callback() {              global $general_defaults;         global $orig_defaults;              $orig_defaults = $general_defaults;         $item ='facebook_alt';         $group = 'theme_display_options';         $form_object = 'text';         callback_standard($item, $group, $form_object, $orig_defaults);          }          function callback_standard($item, $group, $form_object) {         global $the_theme_options;         global $orig_defaults; // defaults set in the               $default = $the_theme_options[$item];         if($default == '') {             $default = $orig_defaults[$item];         }              $obj = $group.'['.$item.']';         if ($form_object == 'text') {             echo '<input type="text" id="'.$item.'" name="'.$obj.'" value="'. $default .'" style="width:300px;" />';         } else if ($form_object == 'textarea') {             '<textarea id="'.$item.'" name="'.$obj.'" rows="5" style="width:500px" />'. $value .'</textarea>';         }     }               /*  --------------------------------------------------------     *   Navigation Options     *   --------------------------------------------------------*     */          // left off for abbreviated example               /*  ----------------------------------------------------     *   Templated settings field output     *   ----------------------------------------------------     */     function create_input($item,$default,$group) {              $obj = $group.'['.$item.']';         $options = get_option($group);         if ($options[$item] != '') {             $value= $options[$item];         } else {                  $value = $default;         }         return '<input type="text" id="'.$item.'" name="'.$obj.'" value="'. $value .'" style="width:300px;" />';          }     function create_textarea($item,$default,$group) {              $obj = $group.'['.$item.']';         $options = get_option($group);         if ($options[$item] != '') {             $value = $options[$item];         } else {             $value = $default;          }         $value = stripslashes($value);         return '<textarea id="'.$item.'" name="'.$obj.'" rows="5" style="width:500px" />'. $value .'</textarea>';          }               ?>


title: Setup login/register buttons for bbPress?

text: I installed bbPress and for the most part it was a fairly simple setup. I just had to activate the plugin and the forums showed up automatically on /forums. One thing I wasn't sure about (and I did look through the documentation) was how to set up login/register buttons for unregistered users. Currently, if you go to this forum as an unregistered user, it says "You must be logged in to create new topics." Am I supposed to use shortcodes for the login/register buttons? If so, where do I insert them?


title: Weird Code Being Added to Wordpress Site [Thesis]

text:
Ok, so I'm totally confused on this and am looking for help. I have a site that is loading really slowly. I tracked the source of the slow load time is this call right here:                     Funny thing is that it's getting added right after the html code. I've looked all through my code in the Thesis theme, and I can't find where that code is being added. While looking at my thesis code, in the /lib/html/header.php file, I found this:               function thesis_header() {         echo "\t
\n";         thesis_hook_header();         echo "\t
\n";     }      so I thought maybe that a piece of code was using the add_action('thesis_hook_header') call, however I did one more tweak. I changed the output from id="header" to id="header1". As soon as I did this, the script code went away. So I'm thinking that there is some code that is looking for div id="header" and then putting the script right after it. But for the life of my, I cannot find the piece of code that is doing it. Has anyone had this problem before?


title: Save users last visited blogs within whole network

text: I have a big network with subdomains (many of which use domains). I thought about solving this problem with cookies but after some research I don't think that crossdomain cookies is a best Idea. So I imagine this happing by saving in users meta some array of blogs and then displaying them on main page. I came across **update_user_meta()** which is very handy in my case.               global $blog_id;     $current_blog_details = get_blog_details( array( 'blog_id' => $blog_id ) );          if (is_user_logged_in()) {         $user = wp_get_current_user();         update_user_meta($user->ID, 'last_visited_blogs',  $current_blog_details->blogname);     }      I save this function inside admin-bar.php so every blog shares this code. Now I want to remake this code to use save 5 last visited blogs as an array and then get those values and display on some place. First question would be how to save 5 sites. I guess update is not my case no?


title: What's causing this error? "Warning: Invalid argument"

text: I noticed today that my error logs are littered with this information. I'm not quite sure what's causing it. Has anyone seen this before? `[Mon Mar 25 17:24:23 2013] [error] [client] PHP Warning: Invalid argument supplied for foreach() in /var/www/html/mysite/wp-admin/includes/plugin.php on line 1290, referer: http://mysite/contact/` Line `1290` is the `foreach` in the following code. I am not sure what's referencing this or where to begin looking.               /**      * Remove a top level admin menu      *      * @since 3.1.0      *      * @param string $menu_slug The slug of the menu      * @return array|bool The removed menu on success, False if not found      */          function remove_menu_page( $menu_slug ) {     global $menu;          foreach ( $menu as $i => $item ) {         if ( $menu_slug == $item[2] ) {             unset( $menu[$i] );             return $item;         }     }          return false;     }      I'm not hooking into `admin_menu` as far as I can tell. Any ideas?


title: Trying to check and see if a post has a featured image outside of the main loop

text:
I've got a situation where I need to find out if the currently loaded post has a featured image, if it does, I want it to display a different logo than if it doesn't have a featured image associated with the post. This works right now, but doesn't have the check feature I'm looking for:               <?php echo is_front_page() ? '
' : ''; ?>         <a href="<?php echo home_url(); ?>" rel="nofollow"><img src="<?php header_image() ?>" alt="<?php bloginfo('name'); ?> logo" height="<?php echo get_custom_header()->height; ?>" width="<?php echo get_custom_header()->width; ?>" />     <?php echo is_front_page() ? '
' : ''; ?>      My issue is that I've looked at the WP documentation for get_posts or starting a new WP_query, but haven't had any luck understanding how I can:   * run a new loop that gets the page ID and sees if it has a featured image   * do a standard if/else statement afterwards My thinking with the if/else would be like this:               <?php echo is_front_page() ? '
' : ''; ?>         <a href="<?php echo home_url(); ?>" rel="nofollow">              <? // IF/ELSE CODE TO EXECUTE IF post_has_thumbnail ?>         <?php if ( has_post_thumbnail() ) : ?>               <img src="<?php header_image() ?>" alt="<?php bloginfo('name'); ?> logo" height="<?php echo get_custom_header()->height; ?>" width="<?php echo get_custom_header()->width; ?>" />         <?php else : ?>         <img src="/i/logo-no-feat-img.png" alt="<?php bloginfo('name'); ?> logo" height="120" width="222" />         <?php endif; ?>         <? // end ATTEMPTED IF/ELSE CODE ?>                   <?php echo is_front_page() ? '
' : ''; ?>      **WORKING CODE**                   <?php echo is_front_page() ? '
' : ''; ?>         <a href="<?php echo home_url(); ?>" rel="nofollow">         <? // IF/ELSE CODE TO EXECUTE IF post_has_thumbnail ?>         <?php if (is_home() || has_post_thumbnail(get_the_ID()) ) : ?>               <img src="<?php header_image() ?>" alt="<?php bloginfo('name'); ?> logo" height="<?php echo get_custom_header()->height; ?>" width="<?php echo get_custom_header()->width; ?>" />         <?php else : ?>         <img src="<?php echo get_template_directory_uri(); ?>/library/images/logo-without-feat_img.png" alt="<?php bloginfo('name'); ?> logo" height="302" width="203" />         <?php endif; ?>         <? // end IF/ELSE CODE ?>                  <?php echo is_front_page() ? '
' : ''; ?>


title: insert a warning message into post-new.php

text: wondered if anyone knew the most elegant way to insert some sort of warning message each time someone tries to create a new post, i.e. 'please remember what you publish is your own responsibility', that sort of thing. I'm thinking I'd like to use the error or warning css wordpress uses if it can't find something or there's an error some place. I'd have thought calling it from the functions file would be best so it doesn't get overwritten each time I update but not really sure what to search to find the reference for it, any ideas?


title: When to use add_action('init') vs add_action('wp_enqueue_scripts')

text: In my theme's functions.php, I'm calling an add_action in order to gain a measure of control on where jquery is loaded (in the footer along with my theme's other scripts). The problem I'm having is that when I use add_action('wp_enqueue_scripts'), it only appears to fire if no plugins are loaded. However, the add_action('init') method works in all cases. I can't recall why, but I believe that add_action('wp_enqueue_scripts') is preferred in this case. If that's true, how can I get it to work in all cases? > In functions.php               //if(!is_admin()){add_action('init', 'my_theme_init');} //THIS WORKS ALL THE TIME     //add_action('wp_enqueue_scripts', 'my_theme_init'); //THIS ONLY WORKS WHEN NO PLUGINS PRESENT          if(!is_admin())     {         require_once(TEMPLATEPATH . '/functions_public.php');        }      > In functions_public.php               function my_theme_init()     {          /* PREVENT DUPLICATE COPIES OF JQUERY FROM PLUGINS     **************************************************/     wp_deregister_script('jquery');          /* LOAD THE LOCAL WORDPRESS COPY OF JQUERY AND THEME CUSTOM SCRIPTS IN THE FOOTER     ***********************************************/     wp_register_script('jquery', get_bloginfo('template_directory').'/scripts.mythemescripts.js',false,false,true);          wp_enqueue_script('jquery');          }      The 2nd method, using add_action('wp_enqueue_scripts') apparently does not get executed in conditions where a plugin is present that writes out script dependencies to the theme.


title: How to completely export and import WordPress?

text: I exported all posts of a WordPress blog. Then I imported the xml file to another WordPress blog. When I tried to search few posts in the new blog, which are in the old blog, I did not find anything. When I opened the xml file, I found that it's incomplete. The file contains `14,226` lines of code. The size of the file is 1.2 MB. I used default tool of WordPress to export and import. How to export complete list of posts and then import the same? I have another lame idea to do this, if I don't get any good solution. I can delete the posts which are exported and then export again. But this is a stupid time taking process.


title: WordPress widgets manager option for emulating theme layout

text: My theme has 6 widget containers. I'd like to be able to offer users a screen, similar to the existing widget manager, that presents these sidebars in a layout that mimics my theme's default layout. For example, I have the following widget containers:   1. Above Header = a widget container that is displayed above the header area   2. Below Header = a widget container that is displayed below the header area   3. Above Content = a widget container that is displayed above the main content area   4. Below Content = a widget container that is displayed below the main content area   5. Sidebar = a widget container that is displayed to the right of the main content area   6. Footer Area = a widget container that is displayed below the main content area and above the footer area So, what I'd like to do is reformat the sidebar manager (or create a custom version of it that can be accessed with a custom admin toolbar link), so that instead of just displaying my widget containers one on top of another in the right sidebar, it actually lays them out according to where they appear in my theme's actual layout. So, the "Above Header" widget container would appear at the top and span the entire width of the screen. I would then have a read-only div that represents my theme's header area below that. Then, below the header area, would be my "Below Header" sidebar container, etc... I would then repurpose the "Available Widget" palette and covert the widgets there to icons. This would allow them to be more easily converted to an "objects" pallete that could be anchored to the screen with expand/collapse toggle via jQuery so that items could be drag/dropped into my container widgets. I'm not looking to reinvent the wheel, so my question is: 1) Does something like this already exist? 1b) Is something similar to this on the drawing board for a future version of WP? Note: since I'm registering my widgets with custom classnames, I already have access to each of them via CSS dom selectors. This gets me part of the way to the proposed layout I'm considering. I could then do the rest of the layout via Custom CSS and jQuery. Just looking to see if the work on this has already been attempted or is on the drawing board for core enhancements.


title: set_post_thumbnail when user is not logged in

text: I'm currently using the `set_post_thumbnail()` function to insert a programmatically uploaded image to a post. The problem is that the function works perfectly when the user is logged in only. If the user is not logged in, in the back-end, wordpress says that the file is attached to the post but does not display it as a featured image. I don't have any conditional statement in that function. Does anybody have had the same issue? Is that a normal behavior? Edit: Noticed that the issue showed up since I've upgraded Wordpress from 3.5.1 to 3.5.2 but I really don't know if it's related Edit: Here is a sample of my code               // This part is for testing purpose, the file is well placed with the right permission     $dir = '/home/web/tmpdir';     $data = $_POST['imageCanvas'];     $preview = base64_decode( str_replace( 'data:image/png;base64,', '', $data ) );     $file = '000011.png';      $filename = $dir . '/' . $file;     file_put_contents( $filename, $preview );          // Here I copy the test file directly into the wordpress uploads dir     // After this line I find the file in the uploads dir, so, let's say that for now it works as intended     $wp_filetype = wp_check_filetype( basename( $file ), null );     copy( $filename, '/home/web/wordpress/wp-content/uploads/' . basename( $file ) );     $attachment = array(         "post_mime_type" => $wp_filetype['type'],         "post_title" => preg_replace( '/\.[^.]+$/', '', basename( $file ) ),         "post_content" => '',         "post_status" => 'inherit'     );          // This part worked well until I recently upgraded WP to 3.5.2...     $attach_id = wp_insert_attachment( $attachment, $file, $lastpostID );     require_once( ABSPATH . 'wp-admin/includes/image.php' );     $attach_data = wp_generate_attachment_metadata( $attach_id, $file );     wp_update_attachment_metadata( $attach_id, $attach_data );     set_post_thumbnail( $lastpostID, $attach_id );          // This part returns the right ids in Apache logs...     error_log( 'attachid: ' . $attach_id . ' - postid: ' . $lastpostID );      I can find the file attached to his post into the wordpress media library: ![Wordpress media library](http://i.stack.imgur.com/1kRMy.jpg) But if I open the post, I don't see any featured image. ![Post featured image](http://i.stack.imgur.com/xhrzn.jpg)


title: Need to execute a cron job

text: I need a cron job to execute the following url > http://www.mywebsite.com/wp- > admin/admin.php?page=myvideoblog/mvb_main.php&action=processfeed&updatefeed=67 The problem is that it requires to be logged in as admin, what are my options? I've tried a few plugins but they use hooks instead of just executing a url and the cron jobs provided by the control panel does not log in to the website.


title: Display all existing members

text: How would I (using a loop) pull in all of the existing users? I'm trying to loop through these users and then pull in meta data for each one.


title: Custom post type URL with post ID that allows archiving and paging

text: I'm having a difficult time trying to get my custom post types URLs to work correctly. Every solution I find has crippled another part that needs to work. What I am trying to accomplish is `domain.com/post_type/post_id/post_name`. What I have that works for everything except archives is:               register_post_type('post-type',         array(         'rewrite' => array(         'slug' => 'post-type/%post_id%',         'with_front' => false,         'pages' => true,         'ep_mask' => 1          )     ))      Then I have:               add_filter('post_type_link', 'custom_post_type_link', 1, 3);     function custom_post_type_link($post_link, $post = 0, $leavename = false) {              if ($post->post_type == 'post-type')) {             return str_replace('%post_id%', $post->ID, $post_link);         } else {             return $post_link;         }     }      So I'm trying to find a way to get `domain.com/post_type` to work. It currently throws a 404. I know that if I remove the filter and `/%post_id%` from my rewrite that the archive will work. From there I've tried adding a rewrite rule:               add_action( 'init', 'custom_rewrites_init' );     function custom_rewrites_init(){         add_rewrite_rule(             'post-type/([0-9]+)?$',             'index.php?post_type=post-type&p=$matches[1]',             'top' );     }      Doing it this way the URL wont redirect if someone types in `domain.com/post_type/post_id` and `domain.com/post_type/post_id/post_name/2` doesn't work. Anyone know of the best way to do this?


title: Set admin body to ltr on a rtl installation

text: I am using a _rtl_ WordPress installation (Hebrew language) and have the following problem: On the admin interface, most of the plugins I install do not have a _rtl_ stylesheet and therefore the plugin interface is displayed in a distorted way. It can be easily fixed using css - just set the `#wpbody` div to _ltr_ like this:               #wpbody {         direction:ltr !important;     }      But I can't find the right place / css file to make it work. I have tried the following - unsuccesfully:               wp-admin-rtl.css     wp-admin.css     dashboard-rtl.css     dashboard.css      Any idea how to make it work?


title: Wordpress Theme: replace logo image with title site if file doesn´t exist on server

text:
First at all thanks for helping. I´m trying to make a theme that pick an image from a folder based on the domain name, and if the file do not exist, then place the H3 title site. My code is:               <?php $server_name = preg_replace('/([wW]{3,3}\.|)\.(es|com|net)/', '',$_SERVER['HTTP_HOST']); $imagen = bloginfo('stylesheet_directory').'/images/logos/'.$server_name.'.png'; if (file_exists(get_template_directory(). '/images/logos/' .$server_name.'.png')) { ?>        <a href="<?php echo home_url( '/' ); ?>"><img src="<?php echo $imagen ?>" border="0" width="230px" height="60px" alt="<?php bloginfo( 'name' ); ?>"/>       <?php  }else{ ?>
<?php bloginfo( 'name' ); ?>
       <?php } ?>      When I tested it on RESPONSIVE THEME like:                <?php if (file_exists(get_template_directory(). '/core/images/logos/'.$nombre_servidor = preg_replace('/([wW]{3,3}\.|)\.(es|com|net)/', '',$_SERVER['HTTP_HOST']).'.png')){ ?>        <a href="<?php echo home_url( '/' ); ?>"><img src="<?php header_image(); ?>" width="<?php echo get_custom_header()->width; ?>" height="<?php echo get_custom_header()->height; ?>" alt="<?php bloginfo( 'name' ); ?>"/>       <?php  }else{ ?>
<?php bloginfo( 'name' ); ?>
       <?php } ?>      It works like a charm, but I cannot see what I´m doing bad. May anyone give me a hand? Thanks!


title: Custom Taxonomy Archive not displaying entries

text:
I have CPT 'movie', with the following taxonomies: genre, director, and actor. The code used to register these is this: http://pastebin.com/yJ9XHCDk I have an archive movie page working using the following code in archie- movie.php:               <?php get_header(); ?>

                              <div id="content" class="<?php echo $bw; ?>">                  <?php get_template_part( 'part-genrenav'); ?>
                 <?php global $post; if(is_archive() && have_posts()) :                         if ( is_post_type_archive() ) { ?>
<?php post_type_archive_title(); ?>
                             <?php } ?>                 <?php endif; ?>

                 <?php get_template_part( 'part-pagination'); ?>             <?php while (have_posts()) : the_post(); ?>                              <?php get_template_part( 'part-movie'); ?>                           <?php endwhile; ?>                       <?php get_template_part( 'part-pagination'); ?>

          <?php get_footer(); ?>      **Taxonomy.php** I've created a taxonomy.php (and a taxonomy-genre.php and so on). Taxonomy.php is being called correctly here, but the loop in that template returns nothing. I've been back and forth through dozens of articles, but can't seem to figure it out. Currently, my taxonomy.php file is made up of this, as you can see it isn't much different than they archive-movie.php file above. I just can't figure out why it doesn't work:               <?php get_header(); ?>

Taxonomy Archive

                 <?php get_template_part( 'part-pagination'); ?>             <?php while (have_posts()) : the_post(); ?>                              <?php get_template_part( 'part-movie'); ?>                           <?php endwhile; ?>                       <?php get_template_part( 'part-pagination'); ?>

          <?php get_footer(); ?>


title: Nginx with Wordpress not showing template 404 for certain file types

text: I am using Nginx on Ubuntu to host a Wordpress site and everything is working great except certain file types return the Nginx 404 rather than the Wordpress template 404. For example: http://www.sbbic.org/something.zip shows the Nginx 404 page. While http://www.sbbic.org/2014/06/17/free-english-khmer-dictionary-mac-osx- download2 shows the template 404 page. What am I missing in my configuration of Nginx?


title: Fluid full window width carousel Image Problem in WordPress

text:
Slider link:- http://coolcarousels.frebsite.nl/c/2/ Here is my HTML script for the slider-

                  <img src="<?php echo get_template_directory_uri(); ?>/images/slider1.png" alt="building1" class="slider_img" />                  <img src="<?php echo get_template_directory_uri(); ?>/images/building2.jpg" alt="building2" class="slider_img" />                  <img src="<?php echo get_template_directory_uri(); ?>/images/building3.jpg" alt="building3" class="slider_img" />                  <img src="<?php echo get_template_directory_uri(); ?>/images/building4.jpg" alt="building4" class="slider_img" />                  <img src="<?php echo get_template_directory_uri(); ?>/images/building5.jpg" alt="building5" class="slider_img" />                  <img src="<?php echo get_template_directory_uri(); ?>/images/building6.jpg" alt="building6" class="slider_img" />

  Book

      But I want to call the images dynamically. I am giving the link dynamically from meta box or option panel something like that-

                  <img src="<?php echo get_post_meta( get_the_ID(), 'slider_img1', true ); ?>" alt="building1" class="slider_img" />                  <img src="<?php echo get_post_meta( get_the_ID(), 'slider_img2', true ); ?>" alt="building1" class="slider_img" />                  <img src="<?php echo get_post_meta( get_the_ID(), 'slider_img3', true ); ?>" alt="building1" class="slider_img" />                  <img src="<?php echo get_post_meta( get_the_ID(), 'slider_img4', true ); ?>" alt="building1" class="slider_img" />                  <img src="<?php echo get_post_meta( get_the_ID(), 'slider_img5', true ); ?>" alt="building1" class="slider_img" />

  Book

      Whather I use loop or not, It never shows the images. It only show the alt tag there sliding. I detect with firebug & see the src tag has no value. But when I print code any other place, I see it throw the image link. Any idea what to do with this?


title: I want to Add My Product Image to Admin Order Email in Woocommerece

text: I want to Add my product image (product which is ordered) in a thumbnail form to recognize the product easily by admin, in Admin Order Email.


title: Display A list of Admins

text:
I have a function that allows me to display ALL users on my site, but I was wondering if there was a way to display Admins and Contributors in a separate loop? My current function:               function contributors() {       global $wpdb;            $authors = $wpdb->get_results("SELECT ID, user_nicename from $wpdb->users ORDER BY display_name");            foreach($authors as $author) {         echo "
";         echo "ID;         echo "\">";         echo get_avatar($author->ID);         echo "";         echo '
';         echo "ID;         echo "\">";         the_author_meta('display_name', $author->ID);         echo "";         echo "
";         echo "
";       }     }


title: Cannot get <p> tags working from a WPAlchemy metabox with wp_editor()

text:
I'm using WPAlchemy on a project. For a template, I need to use a custom metabox which is working fine with a tinyMCE editor. Code to insert the meta box on the template (this is a piece of code from https://github.com/helgatheviking/WP-Alchemy-Holy-Grail-Theme/ because I end up trying it after a looooog search, but _macache_ ).

     <?php $mb->the_field('richfield');          $settings = array(     'textarea_rows' => '10',     'media_buttons' => 'false',     'tabindex' =>2     );          $val = html_entity_decode($mb->get_the_value());        $id = $mb->get_the_name();          wp_editor($val, $id , $settings );          ?>

<button type="submit" class="button-primary" name="save"><?php _e('Update');?></button>

      I have added the following in `functions.php`               /*     * Recreate the default filters on the_content     * this will make it much easier to output the meta content with proper/expected       formatting     */     add_filter( 'meta_content', 'wptexturize' );     add_filter( 'meta_content', 'convert_smilies' );     add_filter( 'meta_content', 'convert_chars' );          //use my override wpautop     if(function_exists('override_wpautop')){     add_filter( 'meta_content', 'override_wpautop' );     } else {     add_filter( 'meta_content', 'wpautop' );     }     add_filter( 'meta_content', 'shortcode_unautop' );     add_filter( 'meta_content', 'prepend_attachment' );      and for the output :
         <?php         global $page_type_richtext;         $page_type_richtext->the_meta(); // don't think I need this line         $richtextcontent = $page_type_richtext->the_value( 'richfield' );         echo apply_filters('meta_content', $richtextcontent );         ?>
      But I never manage to have the `<p>` tags working. I don't understand where i'm wrong. I have tried a lot of different ways, using `the_content` filter, or `wpautop`but it's not working at all. The display is perfect in the custom field itself inside the admin page. That's why I'm getting mad. The content is correctly `wpautop()` when in admin, so I guess the content is properly saved in DB. There must be a way to make it work, but I really don't know. I have find a couple of stack exchange questions about that, like this one but I don't understand how to adapt it. Looks like I should use `wpautop` at the saving of the post, but this is handled by WPAlchemy, and `wp_editor()` doesn't need it, in theory as I understood it. Does anyone give me a hind or a lead ?


title: Faking the "onSave" event

text: While a specific use-case, I believe this may benefit others. I am using TurboCSV to mass-import a number of posts into WordPress (which it is doing wonderfully so far). Within that import, I am specifying custom fields to be used in conjunction with Advanced Custom Fields to store/output the data. The post_meta table is being created correctly, but the part that is not working as expected is generating ACF's hidden fields (which work with field relationships). When the import is first done, those database tables are not created until you manually go into each post and re-save them. I was wondering if there is a way to "fake" the onSave event for WordPress for a number of posts. ACF also passes along post information (stored on the post edit screen) to this save function - which makes it a bit trickier - but I'd be interested if anyone has any thoughts. Thanks!


title: Accept or deny cookies - how to?

text: As far as cookies privacy policy has been change, i need to make a script which allow to accept (or not) cookies by user for this domain (website) only. Is there a way to do this for one website only. Second thing is this popup window should be displayed only if user came from different domain (so each page have to check it - template/header). How can i do this?


title: Disable comment rss feeds for pages in wordpress

text: I am currently working on the completion of a custom template and my last hurdle is to be able to remove the comments feed link being added to the head of the page. For example: in firefox when you open any of the pages on my site there is an rss icon, when clicked I am shown 3 options to add to my reader but the last two are related to comments. The culprits are located in the               <link rel="alternate" type="application/rss+xml" title="Example Title » Comments Feed" href="http://example.com/comments/feed" />     <link rel="alternate" type="application/rss+xml" title="Example Title » Home Page Comments Feed" href="http://example.com/home-page/feed" />      I wish to have the main feed, which contains blog posts from the blog area of the site but do not want any comments, therefore comment feeds are useless to me! I am wondering if there is a way I can remove these via the functions.php or some way through wordpress rather than coming up with another (messier) solution? Thanks, Tristan


title: How to create directory using username within theme

text: I have the following code to save the uploaded file to a static directory.               <?php     //set the image size in mb     $max_upload_size='10';     $MAXIMUM_FILESIZE = $max_upload_size * 1024 * 1024;      $uploaddir = './uploads/file/';      $file = $uploaddir . basename($_FILES['uploadfile']['name']);      if ($_FILES['uploadfile']['size']<$MAXIMUM_FILESIZE) {     if (move_uploaded_file($_FILES['uploadfile']['tmp_name'], $file)) {        echo "success";      } else {     echo "error";     }     }else{     echo"size_error";     }     ?>      But what I want is to create a username directory under "/uploads/file/". For example if the username is "john", then it should create a folder like "/uploads/file/john/" and saved the file under that folder.


title: Photos automatically uploaded to Media Library

text: Here's a bizarre one for you guys. I was using Search RegEx to remove Blogger html formatting that was screwing up my imported posts. Images hadn't been imported, so they were loading from Blogger (and within anchors pointing to that same Blogger image). Then all of a sudden I noticed three of the six post images stopped loading. I looked in the html, and lo and behold, the images had automagically been uploaded to my media library! I checked my FTP and there they were, thumbnail sizes and all! Somehow they had been added a few minutes prior. Any idea how this happened? I do have the "Add Linked Images To Gallery" plugin enabled, but I hadn't touched it yet.


title: Make wordpress comments work with include templatepath

text: How can I make the wordpress comments work with:               include(TEMPLATEPATH."/comments.php");      instead of:               comments_template( '', true );      Ay ideas? Ty


title: How to register images uploaded via FTP in media library?

text: I'm using my own upload.php file to upload images to:               $upload_dir = wp_upload_dir();     $targetDir = $upload_dir['path'].'/';      It works like it should with this exception that images uploaded to `uploads/2012/08/` don't appear in `Media Library`. Is there any function to "register" them there and in WP's database?


title: How to update feed only 2-3 times a week (for Feedburner email)?

text: So many of you know that Feedburner is a great (free) tool for sending out newsletters. The problem is that if you add content everyday, everyday emails will be sent out. I'd like to control on functions.php how I could "update" the feed only 2-3 times a week, so emails from Feedburner would be sent only on these days. I thought about using something with: ` $d=date("D"); if($d=="Fri")... ` But I don't how this could be done with actions. Could someone help? =)


title: How to display only the parent category in the permalink

text: How it is possible to display only the parent category of the post. It contains two sub categories and I want to eliminate it. Example: myblog.com/parent_category/post_name This is only what I want.


title: menu item to point to custom posts list

text: I have created custom post type. It appears in wordpress admin panel and I can add new custom posts (Post type name = "Videos"). I need to have menu item that will link to all posts from given custom post type ('Videos'). 1) How to add this menu item? What link to use? 2) Should I create some custom php file to show all posts of custom type or this can be handled by wordpress somehow? P.S. I have set permalinks to be localhost/myproj/sample-post (currently I am working on localhost).


title: Get parent and first child taxonomy terms?

text: I'm trying to get the parent level and the first child level under that. I tried using get_terms for this but I was unable I'm guessing I need something more extensive. I know I can use get terms running in a foreach but that's a lot of queries to run on page load so I'm hoping for a simpler solution. Any thoughts?


title: I want to display author gravatar on posts. How to do this?

text: I just want to add author gravatar near the name of the author. I know that I have to add something in the single.php file, but what to add? Thanks!


title: Don't post or draft if post already exists

text: I've got a problem. I don't want duplicate posts. Any way to check if a post already exists and if it does just set the new one to draft? I am using IFTTT to update my blog and sometimes it posts multiple times.


title: Plugin hook not working on specific Wordpress installation - how to troubleshoot?

text:
I'm trying to write a simple text replacement plugin, but I'm having an issue that I can't figure out how to troubleshoot. This is the test plugin I'm using as a starting point. It works fine on one Wordpress installation running locally (installation A), but on another local installation (installation B), it has no effect on the post content. It's strange because installation b is working fine and I don't see any other bugs/issues.               <?php     /*      * Plugin Name: Thanks for Reading      */     add_filter( 'the_content', 'tfr_the_content' );          function tfr_the_content( $content ) {       return $content . '
Thanks for Reading!
';     }      Any thoughts on how to troubleshoot this?


title: how to get tax percentage in wp-ecommerce

text: I need to be able to get the tax percentage for the cart in wp-ecommerce. I have tried using: $wpsc_cart->tax_percentage but it does not return a value. Has something changed in the newer versions of wp-ecommerce?


title: How to show list of posts by author and category?

text: Let three categories and their IDs: cat1 = 1 (parent)   cat2 = 2 (child of cat1, parent of cat3)   cat3 = 3 (child of cat2) Let each category has 3 posts, they are: post1, post2, post3. And each posts are written by a specific author whose name is "author" and id is "99". How can I list posts as sub-items of each category? It should look like: # Author Name   * cat1     * Post1     * Post2     * Post3   * cat2     * Post1     * Post2     * Post3   * cat3     * Post1     * Post2     * Post3


title: Show Subcategory Description

text:
I'm using the following code to show the subcategories of a category within my archive.php page:               <?php if (is_category()) {       $this_category = get_category($cat);       if (get_category_children($this_category->cat_ID) != "") {         echo "

";         wp_list_categories('orderby=name&hide_empty=0&title_li=&use_desc_for_title=1&child_of='.$this_category->cat_ID);         echo "

";       }     }?>      The code above returns the name of the category as a link, with the category description as the link title. Can anyone show my how to show the category description within paragraph tags after the category link? Thanks.


title: Modify youtube video size on one page and show another size on different page

text:
I have to display three videos (custom post type) on my first page. When clicking on the link, the post is displayed and video should be in default width. Can you help to find out how to change width of videos (like youtube)? This is how I display info now, and this displays all content (including video). I need somehow to show just `the_excerpt` + small video.               <?php while ( $loop->have_posts() ) : $loop->the_post(); ?>
             <?php the_title(                 '
                     ',                 '
' );             ?>
                 <?php the_content(); ?>

     <?php endwhile; ?>


title: Specific featured image for each category

text:
I´d like to set specific featured image for all posts in one category. So, if I have category Good Jokes, all posts in category Good Jokes will have the same featured image displayed in front page. My current code in content.php is:               <?php if(trim(get_the_post_thumbnail($post->ID)) != '' and $themolio_options['show_featured']): ?>
         <a href="<?php the_permalink(); ?>">         <?php the_post_thumbnail('themolio-featured-image');?>
     <?php endif; ?>      Can anybody help?


title: HTTPS for every page except for feeds

text: Our site has a persistent login form on every page of the site, so of course we need to keep every page served over SSL. However, we've since discovered that Feedburner doesn't like secure feeds. Is there a way to deliver the entire site via https, except for "http://nplusonemag.com/feed"? .htaccess? Action hook? Edit: I should have shared my .htaccess rules. These are obviously not working.               RewriteCond %{HTTPS} off     RewriteCond %{REQUEST_URI} !/(feed|robots\.txt|favicon.ico) [NC]     RewriteRule ^(.*)$ https://nplusonemag.com/$1 [R=301,L]          # Force non-SSL for certain URLs     RewriteCond %{HTTPS} on     RewriteRule ^(feed|robots\.txt|favicon.ico)$ http://nplusonemag.com/$1 [R=301,L]


title: How can I call specific function if requested URL is not found?

text: My website is fully API based and builds pages/posts from API data. I was thinking to create something like PHP magic function __call to call specific function when requested URL would return 404, but do it before it happens, so I could send API request and create the page on the fly and return the previously missing page to user. What are the options to do it? I know wp_insert_post is the way to add new post via PHP, but I can't find how to hook into initial request before 404 is thrown to initiate wp_remote_request. Basically I think I miss the filter/action name for it. Thanks for any help.


title: Is it possible to have users register without having a password?

text: I'm developing a plugin and I wanted to allow users to just subscribe to a custom user level without having a password sent to them via email. this level will not be able to contribute to the site, so just reading capability. I will use this subscription to add the email to a mailing list and to allow the user to buy on this website, nothing else. Do you have any suggestions on how to build this up?


title: Adding an existing subfolder site to a fresh multisite in the root, would it cause a problem?

text: I have a 5 years old subfolder site `example.com/us` and I have nothing in the root site `example.com`. Now I want to setup a multisite in the root site to create a network, then I want to add the existing subfolder site `example.com/us` to the network, would it be a problem? Do I have to do some extra work for that to work? I've tried that in the localhost and it worked fine, but I want to be sure before moving to the Live setup. I don't want to harm my site on Google, neither do I want to lose my link building. This website has thousands of visitors daily from Google, and I don't want to lose all that. Thanks!


title: Theme Translation?

text: I've download a theme called Contango from Wordpress Themes Repository. The theme have a folder called "languagues" and have a file called "contango.po". I could open that file and do translation, but nothing changed.   * How could I translate this theme into my own language? Thanks so much and apologize for my newbie question?


title: Generate sidebar depending on height of post

text: I'm building a site which features sidebars next to each post/article displaying random thumbnails linking to other posts. Each sidebar should never be longer/bigger than the post it's sitting next to. Now of course the height of the posts vary and I want to find out/calculate the height of each post and then generate a sidebar with more or less thumbnails. What would be the best way to make this happen?   Javascript? Here's a screenshot of the design/sketch (click to enlarge):   ![design sketch](http://i.stack.imgur.com/uZ768m.png) Here is a current live version, but a lot is still to be done, work in progress!


how can i add css class on current page in wordpress wp_nav_menu **For Example I Want To Use It In Wordpress wp_nav_menu**
Home
      **Wordpress Code**               <?php $menu_args = array('menu' => 'Header' ); wp_nav_menu( $menu_args ); ?>      **Using This Function**               function add_nav_class($output) {     $output= preg_replace('/<a/', '<a class="selected"', $output, 1);     return $output;     }     add_filter('wp_nav_menu', 'add_nav_class');      **but this function select only home and not highlight current page item thanks in advance**


title: Stop users from logging in from multiple locations

text: We are running a membership site. However, we have a problem with users that subscribe to our content that are sharing there login information with other people, circumventing the need for those users to also need a subscription. Any ideas for plugins that already do this? Or suggestions of how to go about logging people out that login from 2 locations? I assume some use of IP addresses per login or something...?


title: How to get most recent commented post above new submitted post in Wordpress?

text:
I have this function:               $ids = $wpdb->get_col("SELECT DISTINCT comment_post_ID     FROM $wpdb->comments     ORDER BY comment_date DESC     LIMIT 0 , 30");          foreach ($ids as $id) {       $post = &get_post( $id );       setup_postdata($post); ?>
<a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>"><?php the_title(); ?>
       <?php     }     ?>      Which shows the `latest commented posts` in a list, which is fine. What I want to do is give a priority to this one and combine it with a "`get newest post list`". So let's say I commented today on a post called Hello World and someone else submitted a post yesterday... Than I want to get the recent commented post above this new post. The problem is that in my code snippet, there is nothing that says to get the newest posts. How can I **combine** them? **So how to combine most recent commented posts and newest posts with each other?** Is this even possible?


title: Adding Shortcode to Text Widget

text: At the moment, I'm running WordPress v3.2.2 (soon to upgrade to v3.4.2), and am trying to insert shortcode to insert Issuu into a text widget on our sidebar. The WordPress plugin I installed and am trying to use is WP Issuu, where it says I simply need to take the embed shortcode off of the article and insert it into any post or page on the site. _The shortcode works on the pages and posts, which means the widget on the website is working._ I've looked at a couple of links, including this link, which told me I had to simply insert this code into the function.php file and the shortcode would be read:               add_filter( 'widget_text', 'shortcode_unautop');     add_filter( 'widget_text', 'do_shortcode');      Instead of showing the viewer in the sidebar, the shortcode is showing on the screen as text like the picture below: ![shortcode showing instead of actual Issuu viewer](http://i.stack.imgur.com/mFtJL.png) On this post: Inserting shortcode [stream /] into a Text widget, I saw he had a similar problem but instead tried to insert the `<?php ?>` tag around the shortcode, looking like below, which didn't work either:               <?php echo do_shortcode('[issuu width=100 height=100 backgroundColor=%23222222 documentId=121205060625-55b37366f5bb447998a5683f7b7ec9af name=di12052012 username=thedailyillini tag=news unit=%]'); ?>      I don't want to resort to another plugin, such as this one to read in the PHP and want to add a simple PHP function to enable the shortcode to be read into the text widget with the code above. Is there another resort beside the add_filter code that could work? Or does this have to do with the version of WordPress being used?


title: how to refresh index page without reloading browser using ajax

text: the desire i want is similar on how facebook works; when a new content is being published, it pushes down the old post with the new posts on top.   * New Content (pushes down previous topics without reloading the page)   * Old Content 1   * Old Content 2   * Old Content 3 is that possible in wordpress?


title: Using a custom 410 page

text: I've been trying to figure this out without success. In created a 410.php in my theme, and in my nginx config, I added:- `error_page 410 /index.php?error=410` as I'd seen suggested in a few places, but as I saw mentioned in _other_ places, that doesn't work out. I just get the 404 page instead (returned with a 410 response). I saw the mentions of http://wordpress.org/plugins/wp-410/ but this is not what I want - I want to create 410 errors at the nginx level, and have nginx redirect them to a 410 page generated by Wordpress. Can anyone tell me the right way to do this, please? Frankly, if there's a correct way to send 410's to the 404 page, I can customise the 404 page to look at the query parameters and tweak the text accordingly - not ideal, but it would do the job.


title: How to display the posts belonging to a paticular category

text: I have to display the posts belonging to a particular category in the home page.As I am new to word press I don't know how to do it.PLease help me


title: Allowing the SoundCloud player to appear in a post excerpt

text: I am setting up a website for my music, in conjunction with my SoundCloud account. I plan to post the links to my soundcloud player as blog posts, but I can't figure out how to make the blog excerpts show the player. Check out the top post on the site for my example: http://jonathanperos.com/ I want the post excerpt for "Honeycomb Rainbow" show the player for it.


title: display all posts in current category

text:
I am trying to display all the content/posts assigned to a certain category. I have a custom post type set up called 'Videos' and within this I have created categories called music, commercial, promo & short film. Now everytime I post under the videos post type and assign it to a category I want to display all the content assigned to that category. My attempt so far:               if ( have_posts() ) while ( have_posts() ) : the_post();         //$args = array( 'post_type' => 'videos', 'posts_per_page' => 20, 'orderby' => 'date', 'order' => 'ASC' );         $ytubeID = get_post_meta($post->ID, '_youtubeID', true);         $vimID = get_post_meta($post->ID, '_vimeoID', true);              if ($ytubeID || $vimID){             if ($ytubeID && in_array($videos_cat_to_check,$videos_categories)){ // CHECK IF CURRENT POST HAS CATEGORY MUSIC                       echo '
';                      echo '';                      echo '';                      } elseif ($vimID){                 echo '
';                 echo '
';                 echo '';                 }//end if yutbeID or vimIDthe_excerpt(); //excerpt added for information                 echo '
';         }                   echo the_content();              $taxonomy = 'category';              // get the term IDs assigned to post.         $post_terms = wp_get_object_terms( $post->ID, $taxonomy, array( 'fields' => 'ids' ) );         // separator between links         $separator = ', ';              if ( !empty( $post_terms ) && !is_wp_error( $post_terms ) ) {                  $term_ids = implode( ',' , $post_terms );             $terms = wp_list_categories( 'title_li=&style=none&echo=0&taxonomy=' . $taxonomy . '&include=' . $term_ids );             $terms = rtrim( trim( str_replace( '
',  $separator, $terms ) ), $separator );                  // display post categories             echo  $terms;         }          endwhile;               ?>      I am displaying a vimeo/youtube video with a title and description. The user enters the video ID into a custom meta box which then displays the video. I want to display all the videos/posts for the current category. Each category has different videos assigned to them.


title: How to implement checkbox with Front-end Editor

text: I can't implement editable post meta checkbox with Front-end Editor plugin (http://wordpress.org/plugins/front-end-editor/) Here is the code:               <?php editable_post_meta( get_the_ID(), 'update_channels', array(                             'type' => 'checkbox',                             'values' => array(                                 'true' => 'Postal',                                 'false' => 'Email',                                  'false' => 'Phone',                                 'false' => 'GSM',                                 'false' => 'Fax'                             )                         ) ); ?>      What am I doing wrong? Is it possible to implement checkbox with this plugin? Thank you.


title: How can I update a wordpress plugin from a Git repository (github)

text: is there any way to easily update a plugin installed on multiple sites from a github repo. I know I can do it from the command line of each server using git pull. but is there a way to do it from the wordpress admin similar to how plugins are updated?


title: Custom Post Type Loop breaking php

text:
My While loop is breaking the rest of my PHP on the site. Below I put my code that is working but again breaking the rest of the site. Any Suggestions `               $query = array( 'post_type' => 'slides', 'orderby' => 'ASC' );     $loop = new WP_Query($query);          while ( $loop->have_posts() ) : $loop->the_post();                  $title = get_the_title();             $image_object = get_field('slides');             $alt = $image_object['title'];             $sizes = $image_object['sizes'];             $image = $sizes['slider'];                  echo '
';             echo '
';             echo '';             echo '
';             echo '
';               endwhile;      `


title: Set featured link not showing

text: I created my own custom wordpress theme now i am able to add media to my site but the "set featured" link does not show, please i need some help on this.


title: Return all wordpress custom posts in specific multidimensional array

text: How can I get all custom posts (post_type=family_guy) with their ID and all of their tags in multidimensional array? Here is exactly how I would like my array to look like:               $array = array("1" =>   Array(                            "Peter1",                            "Lois1",                            "Megan1"                      ),             "2" =>   Array(                            "Peter2",                            "Lois2",                            "Megan2"                      ),           "3" =>   Array(                             "Peter3",                             "Lois3",                             "Megan3"                      ),          "4" =>   Array(                             "Peter4",                             "Lois4",                             "Megan4"                      )           );      In this array, keys will be custom posts IDs, and values will be all tags of that custom post. Thanks in advance.


title: How can I add Google ads to my home page?

text: Guys I know this is the stupid question but need a little help, I need to put ads on my homepage as I have on my post page: ![alt text](http://i.stack.imgur.com/mNARR.jpg) These are the ads I get on my post page (i.e `single.php`). I also want the same thing on my home page over here: ![alt text](http://i.stack.imgur.com/mfAh2.jpg) I tried using a `<div>` tag like I did on `single.php`, but it is not working.


title: add dynamic ID for wp_nav_menu after and before

text:
I have menu like this:

                     [something]

                     [something]

      and I've try this:               $args = array(         'theme_location' => 'my-theme-location',         'menu' => '',         'container' => '',         'container_id' => '',         'menu_class' => '',         'menu_id' => '',         'echo' => true,         'before' => '
',         'after' => '
',         'link_before' => '',         'link_after' => ''     );          wp_nav_menu( $args );      I need every element inside menu item can have class [or ID is also okay] dynamicly like class="buttons-5" and other class="button-6" an so on just like my example. How can I get dynamicly my buttons class? Sorry for my bad english.


title: Making the category & tag Description textarea bigger

text: Which files do i edit to make the textarea for tag & cat description bigger? Or maybe there's an easier way through functions.php to save having to do it every-time i update wp? Thanks


title: need jquery help

text: i have a form which is displayed after every post, so i coded it in single.php, but the form is too long so i thought of putting it in jquery section, where if the user wants then he/she can click on open and the form will slide down for this purpose i used slide up/down jquery http : //api . jquery . com/slideDown/ i integrated the jquery in proper order in header.php, here is my header.php jquery code               <?php wp_enqueue_script("jquery"); ?>     <?php wp_head(); ?>     <script type="text/javascript" src="<?php bloginfo("template_url"); ?>/functions/js/jquery-1.4.4.js"></script>           <script>           $(document.body).click(function () {           if ($("h6:first").is(":hidden")) {           $("h6").slideDown("slow");           } else {           $("h6").hide();           }           });           </script>     <?php woo_head(); ?>      and this is my single.php code, `               <div class="post">          <p><h6>          <?php echo do_shortcode("[contact-form 2]"); ?></h6>          </p>          </div>      ` but after doing all this thing my sidebar i.e woo_tabs is not proper you can check the image http://i52.tinypic.com/2gxe90p.jpg here my woo tabs instead of coming side by side, it is coming down, is my code right?


title: Host wordpress on a subdirectory of a Rails application

text: I would like to know if it is possible to host a wordpress blog on the subdirectory of a rails application: For instance: I would like to have domain.com/blog instead of having my blog on a subdomain: blog.domain.com . I'm currently using lighttpd, but I can switch to something else if there is a solution. Thanks


title: Rogue current menu item class in wp_nav_menu()

text: I am working on a 'from scratch' theme which has a simple wp_nav_menu call;                wp_nav_menu(Array('menu_class' => 'nav', 'container' => FALSE));       On standard posts, archives and pages this produces the HTML I am expecting. I have an issue when the active page/current menu item is a custom post type archive/single, wp_nav_menu generates the expected _current-menu-item_ class for the active menu item, however it also generates a *current_page_parent* for the Blog link. The blog simply cannot be a page parent for a custom post type archive/single. Some related images to help: http://bloke.org/uncategorized/untitled-post/ So how or why is this happening?


title: Get current post's child page?

text: Is it possible to find out what page a post is contained in? Im in my single.php template and im listing child pages in a sidebar using wp_list_pages, I want the page (not category) that the post is visible in to be highlighted, or add current_page_item to it, is this possible? It works everywhere else at the moment except for the single.php template.


title: Importing Concrete5 content to WordPress

text: Are there any tools out there to convert content from a Concrete5 database to something WordPress can use? I have a client that may switch over, and would like to avoid manually copying content over if possible.


title: How do I minify '@import' css files with wp-minify?

text: I am trying to use wp-minify to minify my js/css on the fly. I can get the 'direct' css files to be minified, but I can't seem to get wp-minify to minify the 'linked' css files. My theme is a child theme off of twenty-ten, so my child theme's styles.css gets minified, but not twenty-ten's styles file.


title: pagination for blog landing page

text:
I have a blog page at: mysite.com/blog. On this page I have this loop:               <?php          $args = array (       'pagination'             => true,       'paged'                  => 'pages',       'posts_per_page'         => '5',       'ignore_sticky_posts'    => true      );     ?>          <?php $query = new WP_Query( $args ); ?>          <?php if($query->have_posts()) : while($query->have_posts()) : $query->the_post(); ?>          <div id="post-<?php the_ID(); ?>" <?php post_class(); ?>>          <?php the_title('
', '
'); ?>
       <?php the_author_posts_link(); ?> |        <abbr class="published" title="<?php the_time(__('l, F jS, Y, g:i a', 'example')); ?>"><?php the_time(__('F j, Y', 'example')); ?>       <?php edit_post_link(__('Edit', 'example'), ' | ', ' '); ?>

       <?php the_content(); ?>       <?php wp_link_pages('before=
' . __('Pages:','example') . '&after=
'); ?>

       <?php _e('Posted in', 'example'); ?> <?php the_category(', '); ?>       <?php the_tags(' | ' . __('Tagged', 'example') . ' ', ', ', ''); ?>        | <?php comments_popup_link(__('Leave a response', 'example'), __('1 Response', 'example'), __('% Responses', 'example'), 'comments-link', __('Comments closed', 'example')); ?>
      Which works as expected, however I cannot get pagination to work. I have tried a variety of options. Any help is appreciated.


title: One step picture upload

text: Each time I upload an image by drag & drop in the Media uploader of Wordpress, I get the options window (text-align, alt, picture name etc...). The fact is I always use the default settings and click ok as it is always good as it is. Is there a way, via the functions.php, to avoid showing the option window and automatically close the media uploader after the drag & drop (with Wordpress validating the default settings) ? Thank you.


title: Index page redirecting to custom post type page

text: Every time I go to the index page of the website, it redirects me to a single custom post type page.   This url: `http://example.com/`   Redirects you to this url: `http://example.com/custom-post-type/custom- tax/post-name/`   which is a URL that I've been working on changing from this structure:   `http://example.com/custom-post-type/post-name/` The index page is redirected to the same `post-name` page every time. **Possible reasons for this happening:**   1. I use `add_rewrite_rule()` to create these redirects:               add_rewrite_rule('^custom-post-type/([^/]+)/([^/]+)/?', 'index.php?custom_tax=$matches[1]&custom_post_type=$matches[2]', 'top')      Although I don't see at all how this has to do with the index page's redirection. I've removed the line of code and the problem persists.   2. This website also has the "Redirect" plugin (apparently this is a common problem with this plugin). These are the steps I've taken against plugin:      * Deactivated/Reactivated     * Disabled Tracking/Modified Posts through the database     * Deleted all rows in the `redirection_items` table where the `url` column was `/`.     * Viewed the logs in the `redirection_logs` table and found this:   `[url] => /`   `[sent_to] => /custom-post-type/custom-tax/post-name/` For whatever reason the "Redirection" plugin isn't showing its settings page in the admin (Tools > Redirection). When I try to access it from the plugin page, it says I do not have sufficient privileges though my account's level is Super Admin. So I edited the Tracking/Modified Posts options programmatically.   3. The only other thing I've edited in the code today was adding a custom taxonomy:               $singular = 'Custom Taxonomy';     $plural = 'Custom Taxonomies';     $taxonomy_args = array(         'rewrite' => array(             'slug' => self::CUSTOM_TAXONOMY_SLUG,             'with_front' => FALSE,             'hierarchical' => FALSE         )     );     // Register taxonomy ...      It seems to clearly be that the plugin is the issue, as it has logged a redirect from the index to that custom post type. I'm hesitant to delete all of its data though, because the site depends on many of its redirects. So before I make this decision, is there anything else that may be causing this? Thanks for all help :)


title: Saving Revision of post meta key/value on each update_post_meta event

text: I have some code that updates a meta-key's value by incrementing...                   $post_id = $wpdb->get_var( $query );         $meta = get_post_meta( $post_id, 'stuff', TRUE );         $meta++;         update_post_meta( $post_id, 'stuff', $meta );      I want to create and save a revision of the meta key/ value each time it is updated, so I can determine how many updates took place last week, last month, last year, etc. I am looking at this code here, but I don't want to do it from the edit post screen, it needs to happen when I update the post meta.


title: Echo all meta keys of a custom-post TYPE

text: Is there a way to dump a list of all meta keys being used by all posts belonging to a custom post type? I.e., a post-type named foods, each food (ham, spaghetti, chicken), can have a different meta key, which is generated dynamically. I can't know which meta keys have been added, but I'd like to be able to use a list of all of them.


title: How to set order for attachment form field?

text: I'm adding some fields to attachment edit form by add filter to "attachment_fields_to_edit". The added fields work fine but they are not rendered as the order I added them. Is there a way to order the fields?