title: How to create extendable wordpress plugins

text: I have a generic question that I would like to ask. How do we go about creating an extendable wordpress plugin. I would like to create a plugin that I can easily allow new extensions to be hooked up to it. Does anyone have any tips or guides or tutorials to doing this?


title: add_action not working in header?

text: i need to enable the session variables to my theme , so i have the following code in my theme functions.php               function session_manager() {       if (!session_id()) {             session_start();            // Get variables in query string     $loc= $_SERVER['REQUEST_URI_PATH'] = preg_replace('/\\?.*/', '', $_SERVER['REQUEST_URI']);      $loc = explode("/", $loc);     $loc=$loc[1];     global $storelocation;     global $right_side_bar;     global $header_right;            $_SESSION['location'] = ucfirst(strtolower($loc));       $storelocation= $_SESSION['location'];       $right_side_bar=$storelocation."-Right-sidebar";         $header_right=$storelocation."-Right-header";             }     }     add_action('init', 'session_manager', 1);      `$right_side_bar` is working fine while echo this in right sidebar it showing the session value, but `echo $header_right` is not working in header, i already tried with `wp_head instead of init in add_action` it cause `Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent`


title: How to extend LINK TO functionality in ATTACHMENT DISPLAY SETTINGS

text: In WP 3.4.x and earlier, it was possible to add a button to the media manager by messing around in an `attachment_fields_to_edit` filter. For example, a plugin could, when it figured out that an item was an audio file, append some HTML for an extra button to the url field, like so.                $playertag = "[audio $url]";      $fields['url']['html'] .=            "<button type='button' class='button data-link-url='$playertag' urlaudioplayer audio-player-$postid'>Audio Player</button>";       The new media manager has changed the set of buttons that were in that html tag into a pulldown menu -- a `<select .../>` item. The html code is emitted in media-template.php. The new code still calls `attachment_fields_to_edit` filters, but doesn't pass in any fields. Is there a way to extend this select item without hacking the core (which I won't do). Is it conceivable to write a bit of js which will use jQuery to add an item to it?


title: Category vs Tag vs Table

text: I have a site that will hold roughly 1000 posts/articles from an in-house magazine dealing with Australian naval history. The articles cover a range of subjects (such as Aviation, Intelligence, Ship Histories, Personal Histories and the like) and I've created categories to suit. The names of ships in an article is very important for research and cross- referencing but there are a LOT of ships. And, how does one distinguish between a ship that is the focus of an article and a ship that is merely mentioned in passing? I have uploaded about 300 articles so far. I've used the categories to identify the subject material, and I've created "tags" for the ship names (and other keywords). But tags dilute the significance of the ship covered by an article; e.g. if the article focuses on HMAS A, but also mentions HMAS B, C and D, then 4 ships are tagged but the relevance of the article to HMAS A is no greater than any of the other three ships. In addition, there's no way to create a list of articles by ship name or to cross-reference articles to the ship name in other material. So, I am pondering whether I should instead create categories for ships that are the focus of an article and use tags only for the names of the "passing reference" ships. This sounds good in theory but it could add, maybe, 300+ extra categories; and in many cases there might not be more than one article where that ship is the focus. Perhaps I am going about it the wrong way; might it be that I need a table devoted to ship names and create a meta link between the post and the table (in much the same way as, say, product names, work in an ecommerce transaction).


title: wordpress url correction

text: I have my wordpress site in a root folder like this "www.mysite/myblog/" so to get to the blog you have to go to "www.mysite/myblog/" I'm wanting to make it so that a user can go to "www.mysite" and it hits the blog. What do I need to do. All my images and everything have the ".../myblog/" path. I don't want to have to go through and correct all this because I'm sure that I'll mess something up. so basically wanting some help on how to do this. any advice would be great!


title: Need To Post Unformated Code

text: Im wanting to use wordpress to share some code snips. However when viewing the posts some of the code tries to format even though its in pre or code tags. Is there anyone way to modify                   <?php the_content(); ?>      So that it will replace <, and > with the correct <, and > methods? I think this is my issue.


title: PHP if statement printing the if parameters

text:
So I've got a list of posts on the right side of a page. I'm trying to make it so that when you're looking at one of the posts the corresponding link (on the right side of the page) is selected (just like when you're on a page, and that menu item in the nav is highlighted). Make sense? I'm trying to use this "if" statement to add the class "selected-highlight"               <div class="service-highlight-box-sidebar <?php if(single_post_title() == the_title()){ echo ' selected-highlight'; } ?>">
          <a href="<?php the_permalink(); ?>" title="<?php the_title_attribute(); ?>">            <?php the_title(); ?>
     <?php         if ( has_post_thumbnail() ) {  ?>           the_post_thumbnail('serivce-highlights');         }           the_content(' ');       ?>
      When I load the page it adds `<div class="service-highlight-box-sidebar post_title the_title selected-highlight">` to every one of the post links on the right of the screen. Note: it doesn't actually add "post_title" and "the_title", it'll add the dynamic post title and dynamic link title in their place. The problem is that it's adding them to the class instead of using them in the if statement to determine weather the class should be added. Should I look for the error in the code snippit above, or could this be a bigger problem with my template, or just a "no no" with wordpress in general? Thanks!


title: Wordpress Unit Testing cleaning up hooks and filters

text: Using Wordpress' unit testing suite has been going quite well, and it's nice the WP_UnitTestCase takes care of cleaning up table data after each unit test. But one thing that doesn't seem to be getting cleaned up are the hooks and filters. For example, I add a filter during one test, it would be really nice if it were automatically removed before the start of the next test. Is there any WP Core support for that? Or should I manually take a snapshot of the $wp_actions and $wp_filter global variables during setUp() and restore them during tearDown()?


title: Pulling values from a sepcific row in table

text: I'm trying to get the first and last name values for ONE person in a database where the meet certain conditions of being a team leader and having a specific project id. Because of this, it will always be one row. I have this               $leader_result = $wpdb->get_results("SELECT user_first_name, user_last_name FROM ".$wpdb->prefix."mro_attendees WHERE event_id = ".$project_id." AND user_role = 'team_leader' LIMIT 1");      But I'm not sure how to get the first and last names from they query. I tried setting up a while but when I did a test and echo'd the variables for the whiles I got nothing. What exactly am I doing wrong here? Is there something wrong with the WP query itself? Tried with updates and still not getting information out of the echo.               $leader_result = $wpdb->get_results("SELECT user_first_name, user_last_name FROM ".$wpdb->prefix."mro_attendees WHERE event_id = ".$project_id." AND user_role = 'team_leader' LIMIT 0,1");     $leader_select = mysql_query($leader_result);     $row = mysql_fetch_row($leader_select);     $leader_first = $row[0];      If I echo $leader_first I get nothing as well.


title: Nested Meta boxes?

text:
I am trying to set up a plugin that will add a meta box to the posts admin page asking one simple question: How many authors will add their 2 cents? The question is in a dropdown with a possible 4 values: 1,2,3,4 I then want two fields to appear, per number of authors: Author and Two Cents. Author is to be a dynamically populated dropdown list of users with author permissions. Two Cents is to be a WYSIWYG text field like the one for the post data itself. I have the meta box displaying on the posts admin page and I have all fields displaying. I now need help making the magic happen: I don't know how to make the fields appear only after the initial question is answered and I don't know how to save values to the post. Here is my code:               function two_cents() {     $screens = array( 'post', 'page' );     foreach ( $screens as $screen ) {         add_meta_box(             'myplugin_sectionid',             __( 'Two Cents', 'myplugin_textdomain' ),             'myplugin_meta_box_callback',             $screen         );     }     }     add_action( 'add_meta_boxes', 'two_cents' );          function myplugin_meta_box_callback( $post ) {     echo '';     _e( 'How many authors?', 'myplugin_textdomain' );     echo ' ';     echo '<select>             <option value="one">1</option>             <option value="two">2</option>             <option value="three">3</option>             <option value="four">4</option>            </select>';          echo '
';     echo '
';          echo '';     _e( 'Author', 'myplugin_textdomain' );     echo ' ';     wp_dropdown_users(array('name' => 'author'));          echo '
';     echo '
';          wp_editor( htmlspecialchars_decode($valueeee2), 'mettaabox_ID_stylee', $settings = array('textarea_name'=>'MyInputNAME') );     }      Pointers in the right direction and your help is greatly appreciated, thanks!


title: How do you get posts by meta_query using the JSON API plugin?

text: I would like to get post with an API method using a kind of meta query. I have 2 custom fields "place" and "dayoweek" and I want to retrieve via API call all the post that have some values for this 2 fields. It would more or less like this if you use php               $args = array(         'numberposts' => -1,         'post_type' => 'event',         'meta_query' => array(             'relation' => 'AND',             array(                 'key' => 'place',                 'value' => 'Melbourne',                  ),             array(                 'key' => 'dayoweek',                 'value' => 'saturday',                  )         )          );      My problem is..how do you do that using the JSON API get posts method? How do you make this call using arrays..               http://somewebiste/API/get_posts/?post_type=event&meta_key=place&meta_value=andorra&cat=1&meta_key=dayoweek&meta_value=saturday&orderby=title&order=ASC


title: Why do these errors appear on my wordpress site?

text: On my /wp-admin/ page I get this error:               Warning: call_user_func_array() expects parameter 1 to be a valid callback, function 'mytheme_admin_bar_render' not found or invalid function name in /home/rgomme1q/public_html/geoffrey/wp-includes/plugin.php on line 406      And on my edit page I get this error:               Warning: Invalid argument supplied for foreach() in /home/rgomme1q/public_html/geoffrey/wp-content/plugins/dropdown-menu-widget/shailan.DropDownMenu.php on line 239      Apart from these errors, the site functions perfectly. Also the files mentioned are never touched by me and are in their original state. I guess the errors come from a typo in another file, but how do I determine which file is the culprit?


title: Use wp_nav_menu to display ALL pages

text: I am currently building a wordpress theme. For the menu, I just want to display all the pages that are created in the order that they are created in (i.e. I don't want users to have to go into the 'menu' section of the site and create their own). I tried using wp_page_menu and this worked HOWEVER I need to add a walker class to expand the functionality, which you can't do with this function. So I need a way to display all my pages with using wp_nav_menu as my code - is there a way to do this? Here is my code currently:               <nav id="nav">         <?php wp_nav_menu( array( 'walker' => new Clapton_Nav_Walker ) ); ?>     </nav>


title: do_action pass array argument as reference not copy

text: I have successive hooks to an action which are passed an associative array like: `do_action($array)` I am trying to update the values in this array in the multiple `add_action` calls, however each add_action is getting a copy of the passed array, not a reference. How do I pass a reference? I am using PHP 5.


title: Wordpress multilingual site to work with other plugins

text: I have a project in which the client needs the site to support 5 different languages. After some research on Google and here, it's clear the two ways to do it would be either using Multilingual plugins or Multi-site. My question is, if I were to use the wordpress plugins such as qTranslate, how would the other plugins work, i.e slideshows, testimonials etc. For example, most of the slideshow plugins comes with only a single title fields. In that sense, is using plugins for the translation still efficient keeping in mind that I am going to be using sidebars and other plugins which don't support multingual? Or using the Multi-site is the only option?


title: How to use the Display Name as the post title in a custom post type?

text: I've created a custom post type called "teacher" and I want to use that person's display name as the title of their post. Details: 1. The "teacher" custom post type supports title. 2. Only logged in teachers can post. 3. I'm using frontend posting by Rev Voodoo I've come up with this based on various snippets I've found around here but can't get it to work:               function wpa65253_teacher_title( $title ) {         global $post;         if ( isset( $post->ID ) ) :             if ( empty( $_POST['post_title'] ) && in_the_loop() && 'teacher' == get_post_type( $post->ID ) )                 $title = get_user_meta($user->ID, 'display_name', true);         endif;         return $title;     }     add_action( 'submitpost_box', 'wpa65253_teacher_title' );      I've seen various questions about creating a title based on custom fields but I want to pull them from the user's name in his profile. This code by t31os also no longer works:               add_action( 'submitpost_box', 'hidden_type_title' );          function hidden_type_title() {         global $current_user, $post, $post_type;              // If the current type supports the title, nothing to done, return         if( post_type_supports( $post_type, 'title' ) )             return;              ?>         <input type="hidden" name="post_title"value="<?php echo esc_attr( htmlspecialchars( get_the_author_meta( 'display_name', $current_user->data->ID ) ) ); ?>" id="title" />         <?php     }      What am I doing wrong?


title: Force (new) users to update profile first time logging in after csv import using s2member

text: I have a large number of user profiles that I will be generating. Some of these user data sets lack an email address. I want to assign a username and a password for them to use to login, but upon logging in, force them to update their profile with a valid email address. I see password update/change on first login, and forcing them to complete the profile after they register, but none directly relating to importing of users and having their first login requring this of them. Add to this that I am using s2memeber, which its own user import lacks the ability to import without a valid email address. Im up for any suggestions


title: Using $paged redirects /page/2 to page 1

text: I've setup a custom query for my posts (single.php) with pagination, which by the way is working great with the default permalink structure. domain.com/p=ID&paged=2 if I switch the permalinks to /%postname%/ the page/2/ redirects to the first page.               <?php      $paged = (get_query_var('paged')) ? get_query_var('paged') : 1;     $args=array( 'connected_type'=> 'posts_to_posts', 'posts_per_page' => 3, 'paged' => $paged, 'order' => 'ASC', 'connected_items' => get_queried_object() );          $temp = $wp_query;     $wp_query= null;     $wp_query = new WP_Query();     $wp_query->query( $args );     if ( $wp_query->have_posts() ) : while ( $wp_query->have_posts() ) : $wp_query->the_post(); ?>              <a href="<?php the_permalink(); ?>" id="post-<?php the_ID(); ?>"><?php the_title(); ?>          <?php endwhile; endif; $wp_query = null; $wp_query = $temp; wp_reset_query(); ?>      What's confusing me is the fact that ir's working with the default permalinks, why isn't in working with the "pretty" links? Homepage pagination is working fine, just the post page that's messed up somehow. Can anyone point me to the right direction? where should I be looking for errors? I've deactivated all plugins, deleted htaccess and created a new one, still nothing.


title: Namespacing WordPress project according to FIG standards

text: I am trying to wrap my head around the namespaces, autoloaders and FIG standards and most importantly how to achieve their integration to WordPress as close as possible. Here is my file structure, created with help of awesome roots/bedrock WordPress stack.               |-- /web     |   |-- /app     |   |   |-- /mu-plugins     |   |   |   |-- autoload.php     |   |   |   |-- /cibulka-mu-base                 // abstract classes, traits, ... for features     |   |   |   |-- /cibulka-mu-feature-1            // features as custom post types, theme support, forms, ...     |   |   |   |-- /cibulka-mu-feature-2            // features as custom post types, theme support, forms, ...     |   |   |-- /themes     |   |   |   |-- /cibulka-parent-theme     |   |   |   |   |-- functions.php                // plays with MU plugins, sets default config     |   |   |   |-- /cibulka-child-theme     |   |   |   |   |-- functions.php                // plays with MU plugins, overrides default config     |   |   |-- /plugins     |   |   |   |-- /akismet     |   |   |   |-- /other third party software     |   |-- /wp     |   |   |-- /wp-admin     |   |   |-- /wp-includes     |   |   |-- etc.      How to mimic the file structure by namespaces and in the same time, by as much FIG-friendly as possible? In the same time, "the packages" of "the app" should be stored in separate folders, so they can be required by `composer.json` files and monitored by GIT. I've tried a lot of options, but to be honest, I am little overwhelmed by the number of possible solutions and by the fact, that none of them is very ideal. Can you tell me what was useful in your cases? ## Edit: Possible routes   * fully following the directory structure: `web\app\muPlugins\CibulkaMuBase` etc.   * "faking" vendor directory: `cibulka\MU\Base`, `cibulka\themes\parentTheme`, ...   * further manipulation of WP directory structure - limited options, complicating pretty much everything else, bad compatibility, ...   * **anything more clever**?


title: How to insert category and subcategory using 'wp_insert_post' function?

text: How would be the array, to insert a post category and subcategory? Thanks.


title: page works in preview but not live

text: Help! I'm new to word press and I'm not sure what I'm doing wrong. I made a new contact page that works perfect when I previeew it, but viewing it live shows a 404 error. What am I doing wrong? Nextchapterstudios.com Thank you!


title: How to devide post into more than one page using <!––nextpage––>?

text: I want to divide a post into multiple pages using `<!--nextpage-->`. Please guide me through this and also I want some customization in that. You can check here what type of pagination I want to do   ![enter image description here](http://i.stack.imgur.com/tel06.png) If it can be possible to divide post into multiple pages alphabetically then it will be great. My website is here.


title: Media Uploader: get deleted files

text: I am currently working on a plugin to upload files to wordpress using the file uploader. The user can save a list of files to use in another location of the theme. Everything works, except when I want to delete files. I can delete the files using the media uploader, which is no problem. The files are removed in the background of wordpress. But when a file is deleted in the media uploader, I also want it removed from the list the user is currently editing, so the files can't be saved to my custom database table when it no longers exists in the "media environment". I know which javascript I need for removing them from my list, but I don't know how to get the deleted files from the media uploader. Below are two possible solutions that would appear logical, but I haven't found the correct approach just yet. **Approach 1**               function someFunction() {         (...)         file_frame.on('select', handle_upload); //This works         file_frame.on('delete', handle_delete_media); //perhaps something like this exists?     }      **Approach 2** (Not sure if this is a good approach, as it requires selection of files)               function handle_upload() {         var files = file_frame.state().get('selection').toJSON(); //This works         var files = file_frame.state().get('deleted').toJSON(); //perhaps something like this exists?         (...)     }      Any help would be greatly appreciated. **EDIT** This is the code for opening the Media Uploader               function open_uploader(e)     {         e.preventDefault();              if(file_frame) {             file_frame.open();             return;         }              file_frame = wp.media.frames.file_frame = wp.media({             title: 'Select files for your List',             multiple: true,             button: {                 text: 'Insert into List',             }         });              file_frame.on('select', handle_upload);         //file_frame.on('delete', handle_media_delete); I NEED SOMETHING LIKE THIS              file_frame.open();     }      And this code is the script to add the selected files to the list, which works already. This is basically just some jQuery-code.               function handle_upload(e)     {         var files = file_frame.state().get('selection').toJSON();              jQuery(files).each(function(index, attachment){             var url = attachment.url.toString();             var media_id = attachment.id.toString();             var title = attachment.title.toString();             var description = attachment.description.toString();             (...)         });     }


title: Wordpress plugin: Getting posts where checkbox selected

text: I would like to have a plugin where I could work with all post data from posts that have a selected checkbox.. To get all posts is simple with the `get_posts( $args );` function... But how to add a checkbox to every post? So that I can use the filter parameter of the `get_posts( $args );` function to get only the selected ones? Hope you understand what I mean ;) Thanks for help!


title: How to reload the role specific registration form on validation errors?

text: I test a solution for separate registration for different roles and it works very well. But the validation part/function (see bellow) on errors reloads/reuse the generic registration link and not the role specific link, e.g. `http://example.com/wp-login.php?action=register` instead of `http://example.com/wp-login.php?action=register&role=seller`. How to avoid this? The validation function:               add_action('register_post','my_user_fields_validation',10,3);          function my_user_fields_validation($login, $email, $errors) {         global $firstname, $lastname;         //get the role to check         if (isset($_POST['role'])){             $user_type = $_POST['role'];         }         //check the fields according to the role         if (isset($user_type) && $user_type == "seller"){         //check sellers fields             if ($_POST['business_name'] == '') {                 $errors->add('empty_business_name', "ERROR: Please Enter in a Business name");             }             if ($_POST['business_address'] == '') {                 $errors->add('empty_business_address', "ERROR: Please Enter in Business address");             }          }         if (isset($user_type) && $user_type == "buyer"){             //check buyers fields             if ($_POST['buyer_name'] == '') {                 $errors->add('empty_buyer_name', "ERROR: Please Enter in a Buyer name");             }         }     }


title: Create new folder and upload files to custom folder via wp_handle_upload

text: I am using `wp_handle_upload` to upload files from a theme template file.               if ( ! function_exists('wp_handle_upload') ) require_once( ABSPATH . 'wp-admin/includes/file.php' );     $uploadedfile = $_FILES['attachedfile'];     $upload_overrides = array( 'test_form' => false );     $movefile = wp_handle_upload( $uploadedfile, $upload_overrides );     if ( $movefile ) {         //echo "File is valid, and was successfully uploaded.\n";         //var_dump( $movefile);          $attachedfilelink=$movefile['url'];     }      I want to create a folder inside root / uploads directory with user name of who is uploading and upload the file inside the folder. Any help ?


title: Category archive in menu

text: I am looking for a solution to show the archives for a specific category in my main menu. The first level menu entry would show the label of the category, say "News Digest", without linking to anything. One level under that, when hovering over "News Digest", I want to show the months of the current year. Below that, I want to show the previous years. In the end, it would look like: News Digest   * September 2013   * August 2013   * July 2013   * June 2013   * May 2013   * April 2013   * March 2013   * February 2013   * January 2013   * Year 2012   * Year 2011 Those menu entries would link to pages listing the articles belonging to that category, written during that particular time. I haven't been able to find any information about how to implement that. I'm a bit surprised as I guess other people probably tried to do that before me. Is there any plugin that I missed? If not, any indication on how I could implement that myself?


title: Show child custom post types on single-{parent}.php?

text: I'm very new to WordPress, and from the get-go I need to implement custom post types. Not sure I have all my WordPress marbles in one tin, so I'm asking for a bit of constructive criticism and above all patience. I want something similar to this: http://wp-types.com/documentation/user- guides/creating-post-type-relationships/. More specifically, the car rental website part, but only customized for events and artists. BUT, artists will be pre-specified and not added with an event, so I just want to maybe link them via checkbox, is this even possible? To be specific, this is the scenario: I have a site, which displays a load of events, each with a line up of artists. Now, I have created two (2) custom post types, Events & Artists. **Events** is a child of **Posts** , and **Artists** a child of Events. I have already added ' **Artist** ' posts in the post type. Artists should be able to be linked to multiple Events and Events should be able to have multiple Artists.


title: Is there easier way not to display all images attached on the page from media?

text: I'm thinking not to delete the images I attached on the page, but will just have conditions not to display images with order set to `0`. If I have code like this:               $thumbnail_ID = get_post_thumbnail_id();         $args = array(           'numberposts' => -1,           'order'=> 'ASC',          'orderby'=> 'menu_order',           'post_mime_type' => 'image',          'post_parent' => $post->ID,           'post_status' => null,           'post_type' => 'attachment',          'post__not_in' => array( $thumbnail_ID )        );         $attachments = get_children( $args );          How can I filter not to show those images which order isn't set?


title: Strict tag list - user should choose only existing tags for posts

text: While selecting tags for the posts the user is able to create new tags on fly. For example we have the tag 'animal' but the user misstpye it as 'aminal' - and Wordpress creates it. In our blog the strict tag structure is essential. How can I disable this function? **Edit** Solution added.


title: Pages for Cron use Only?

text: so I've got a bunch of custom page templates that are scripts that are meant to be run by cron to update various things on my wordpress site, there are not meant to be viewed by regular site users. Note: I'm using "regular" cron jobs, not "wp-cron" jobs. Q: Is there a way to block average joe from visting these pages but allow cron to still be able to execute the scripts contained in the pages ok? Thanks! -- UPDATE #1 -- **What do the crons job pages do?** The scripts on the pages that are triggered by cron use shortcodes to trigger a plugin that crawls various pages (the list of URLs to crawl is in an array thats fed to a for loop that triggers the shortcode) and do wordpress things like create post, categories, tags, etc. I'm creating a very niche search engine that crawls pages I tell it to then creates wordpress pages from the results.               $urls = array('http://url1.com', 'http://url2.com', 'http://url3.com');      ## etc.. for each page to be crawled.          ## crawl each url in the array          foreach ($url as $crawling) {         do_shortcode('[shortcode]');           }


title: wp_nav_menu not appearing for a couple pages

text: _I solved the problem with the page, the correct answer is ptriek's comment below._ Well I'm having a bit of an odd problem here, wp_nav_menu works on all pages EXCEPT my category pages (probably my archive page too but there's no links on the website to the archive pages so that's alright). Although there is archive.php in my theme files, this controls what is displayed on category, tag, archive, author, etc. pages. I just don't understand why, since every page uses the same header.php to display wp_nav_menu, it won't show up for the category pages. Am I overlooking something? I've been banging my head against my keyboard trying to figure this out and it just won't work! Using a very simple code: `<?php wp_nav_menu('container_class=menu- header&theme_location=primary'); ?>`


title: How to set title from page-template?

text: We store the data for the user profiles on our site in a mongodb and provide them via a REST API. So i added a page template page-profile.php. In that file we call the REST API and fill the template with the responding data. We added rewrite_rules to the functions.php, so the profile template knows which profile fetch from the REST API. **functions.php**               add_rewrite_rule('^termin/([^/]*)/([^/]*)/([^/]*)$',                      'index.php?pagename=profile&location=$matches[1]&industry=$matches[2]&slug=$matches[3]',                      'top');       **page-profile.php**               $slug = $location = htmlspecialchars(urldecode(get_query_var('slug')));     $office = $dataAccess->getProfile($slug);      That all works fine, we use the `$slug` to get the correct data from the REST API and store them in the `$office` variable. `$office->name` describe the name of the profile. My question is: How can i use the `$office->name` in the page title (needed for better SEO)? I know I can use the the wordpress filter `wp_title` to set the title dynamically in the functions.php. But how I can use the `$office->name` (page- profile.php) in the `wp_title` filter (functions.php)?


title: wp_list_categories() - current-cat class also inside posts?

text: I wrote my own function to list all taxonomy terms of a certain taxonomy …               function wr_list_taxonomy($taxonomy, $orderby, $hierarchical) {         $show_count   = 0;         $pad_counts   = 0;         $title        = '';              $args = array(           'taxonomy'     => $taxonomy,           'orderby'      => $orderby,           'show_count'   => $show_count,           'pad_counts'   => $pad_counts,           'hierarchical' => $hierarchical,           'title_li'     => $title         );              return wp_list_categories( $args );     }      So this function works exactly like `wp_list_categories()` and also puts out a "current-cat" class once I'm on a term-page. So imagine my URL structure …               www.mysite.com/term //current-cat works perfect     www.mysite.com/term/a-post-associated-with-this-term //current-cat not assigned      Is there a chance to also make the "current-cat" class work once I'm in a post but within this "category" just like pointed out above? **update:** The `wr_list_taxonomy()` function is called inside my `header.php` file.               <nav id="main-nav">                 <ul class="wr-nav" role="navigation">                         <?php                             global $post;                             $taxonomy = 'event_type';                             $term_id = 0;                             $terms = wp_get_post_terms( $post->ID, $taxonomy, array("fields" => "ids") );                             if ( !empty($terms) )                                 $term_id = $terms[0];                             wr_list_taxonomy($taxonomy, 'name', 1, $term_id); ?>                 </ul>     </nav>      I updated the `wr_list_taxonomy()` function to your version. Moreover I have another function that might be relevant for the thing I want …               /**      * Add category-slug as classname to wp_list_categories()      */          add_filter('wp_list_categories', 'add_slug_css_list_categories', 10, 2);          function add_slug_css_list_categories($list, $args) {              if ( $args["taxonomy"] == "event_type" ) {             $cats = get_terms('event_type');             $class = 'term term-';         } else {             $cats = get_categories();             $class = 'category-';         }              foreach( $cats as $cat ) {             $find = 'cat-item-' . $cat->term_id . '"';             $replace = $class . $cat->slug . '"';             $list = str_replace( $find, $replace, $list );             $find = 'cat-item-' . $cat->term_id . ' ';             $replace = $class . $cat->slug . ' ';             $list = str_replace( $find, $replace, $list );         }              return $list;     }      This function adds the "category-slug" to each `<li>` item in the `wr_list_taxonomy()` function. This works fine. I just need to have the "current-cat" class also applied when I'm on a single.php (post) site that is associated with the "current category" i'm in.


title: Remove inline width from figure

text:
I add an image with caption to my page and need to increase `<figure>` width. But wordpress is adding an inline width.               [caption id="attachment_44" align="alignnone" width="216"] caption [/caption]      So, the DOM look like this:

Caption.

      I try to remove width="216" from code, but the caption desappear. How I remove this inline style?


title: User permission per category of custom post type?

text: How to allow a User to post only for a unique category of a custom postype? Only one user per category can publish into that category. Is possible? Thank You!


title: Adding an extra parameter [string] to my posts' permalink?

text: I've been searching the internet for 6 hours now, so I decided to ask this in the forum and would appreciate every help. I just want **my permalink** to say (e.g. portfolio, post, etc)               http://mysite.com/?portfolio=xxxx&param=whatever      I need the **param** , because the post itself defines the "whatever" parameter and there is a search form in the post, which initializes itself using this parameter (the searchform gets the parameter, if it's in URL). For single links, I could've placed the param into the link, but the WP defines the permalinks restrictively. I tried adding **add_query_arg()** to functions.php without success (It's not even clear _where_ to place the code (single.php or functions.php) and _how_ to call the function from the post). I then tried adding **custom fields** and **Meta Boxes** , but they seem to conatin the extra parameter but not add it to the URL. So all I get is:               http://mysite.com/?portfolio=xxxx      a.) **BEST SOLUTION** The best way would be, to add a custom field to the post (or post type), which inserts a value the **param** and shows the permalink- URL with that parameter. b.) **JUDO SOLUTION** The simplest thing would be, to add this parameter (text) to the link. There are a gazillion post about this online, but they all refer to parsing of parameters which external links pass ($_GET) and conditionally change the appearance of the site or adding one specific parameter/value to each post/page. I do not need this. Is there any way to _add_ this **1 single parameter** to the permalink-URL directly from the post, without changing 18 php files and writing hundred lines of code? Thank you for any help! m PS. I am using WP 3.6.1 DE with inovado . **Things I have already tried** * * *   1. WP Codex add_query_arg()   2. Stackoverflow: question 4586835 how-to-pass-extra-variables-in-url-with-wordpress   3. Cookie-monster: wordpress-url-parameter-utility   4. Creativebloq: user-friendly-custom-fields-meta-boxes-wordpress-5113004   5. Farinspace: how-to-create-custom-wordpress-meta-box   6. stackexchange.com: questions 51444 - add-extra-parameters-after-permalink and finally   1. webopius: using-custom-url-parameters-in-wordpress


title: How to activate a plugin on the activation of a theme?

text: I want to use the hide unwanted shortcodes plugin to hide unwanted shortcodes from my desktop theme when my website is visited by mobile users. I'm currently using the any mobile theme switcher plugin on my website to show a different theme to mobile users but since I'm using different themes and they both use different shortcodes, how can I hide my desktop theme's shortcodes when my website is visited on a mobile device.? Thanks!


title: Get parent category class in post_class()

text: I am trying to add the parent category class in post_class() of some posts from one of my subcatgories. I have an advanved theme so I need to style all the posts from the parent cateogry using it's class, not the subcategory class (too much hassle in CSS).


title: Customize Editor Styles

text: I know there are plugins that do this, but since my needs are so small, I'm hoping there's another solution... I want to edit the `<hr />` style in the WordPress editor to have `clear: both;`. Is there a way to do this in the functions.php or something?


title: Turn get_posts as string into an array for use in theme admin options

text: I am trying to add a drop down list of all posts into a theme admin section...without forklifting the theme code. I need to pass the post title and id into the 'options'=>array() like so:               'getting-started-link-id'=>array(         'title'=>'LINK GETTING STARTED TO:',         'name'=>'page-option-item-getting-started-link-id',         'options'=>array('54'=>'Post #1','23'=>'Post #2', '654'=>'Post #3',)         'type'=>'combobox'     ),         I wrote a function that takes all the posts ID and name and turns them into a string:               function post_page_options(){         $post_page_options = get_posts('category=orderby=title&order=asc&numberposts=');         foreach( $post_page_options as $value ) :             $str .= "'$value->ID'" . "=>'" . $value->post_title . "', ";         endforeach;          return $str;     }      `$str` returns this:   '54'=>'Post #1','23'=>'Post #2', '654'=>'Post #3', I tried this but it does not work:                   'options'=>array( post_page_options() )      I tried turning the $str into an array() but the the array does not come out looking like the the format as in $str. Somehow adding the results of the $str into the 'options'=> seems like the easist approach so the theme admin code will do what it is already written to do which is take the 'options'=> array and turn it into a drop down list.


title: Why does wp_links still exist in the db schema?

text: I understand that _links_ used to be a big thing when Wordpress came out and during the blog rise, but the link feature is so underused nowadays that as of version 3.5 it is hidden by default (thus greatly discouraging its usage). Moreover, I don't see any reason why Links themselves shouldn't be a **Custom Post Type** as it would be much more consistent with the approach Wordpress has taken in its data architecture. Is **backwards compatibility** the only reason why such basic things as the db schema aren't touched? Or is there some other reason I am not grasping?


title: Set default image sizes in WordPress to hard crop

text: How do I set the medium and large images sizes in WP to hard crop? In my theme I can set the thumbnail size to hard crop using this:               add_theme_support('post-thumbnails');     set_post_thumbnail_size( 96, 96, true );      But I can see no way to make the medium and large images to hard crop. Is there possibly a way to remove the medium and large sizes and re-add them using:               add_image_size( 'medium', $width, $height, true );     add_image_size( 'large', $width, $height, true );


title: Attachment 0×0 size error

text: My theme uses 8 different thumbnail sizes. I imported my local installation to the final server using phpmyadmin to export the wordpress database. Everything is smooth except for the attachments: many post thumbnails are broken. The file is there and displayed, but at the wrong size. When i open the file in the media library or in a post 's "Add image" interface, it displays that the image size is (0x0). Only solution i find was to delete each post image and reupload it. Then it works, so it's the database import that's provoking the error. I don't get how this error happens. Any idea? And how to fix it? The "Rebuild Thumbnails" plugin doesn't solve it unfortunately.


title: Buy now button and thankyou page for my website?

text: I want to activate Paypal 'Buy Now' button for my products. After purchasing product it needs redirection to thank you page. How to do this via a plugin? Is there any plugin available for this task? Please recommend a plugin or an easy way to achieve this. Thank you.


title: Can't publish custom post type - "You are not allowed to edit this post."

text: Hey guys I've created this post type but when I click the publish button I receive the message: > You are not allowed to edit this post. Have I done something wrong in my code to disallow anyone from publishing a post of this custom type? Here's the code:               <?php     function image_post_type(){         $labels = array(                     'name'              =>  'Images',                     'singlular_name'    =>  'Image',                     'add_new'           =>  'Add New',                     'add_new_item'      =>  'Add New Image',                     'edit_item'         =>  'Edit Image',                     'new_item'          =>  'New Image',                     'all_items'         =>  'All Images',                     'view_item'         =>  'View Image',                     'search_items'      =>  'Search Images',                     'not_found'         =>  'No Images found',                     'not_found_in_trash'=>  'No Images found in Trash',                      'parent_item_colon' =>  '',                     'menu_name'         =>  'Images'                 );              $args = array(                     'labels'                =>  $labels,                     'public'                =>  true,                     'exclude_from_search'   =>  false,                     'publicly_queryable'    =>  true,                     'show_ui'               =>  true,                     'show_in_nav_menus'     =>  true,                     'show_in_menu'          =>  true,                     'menu_position'         =>  1,                     //'menu_icon'               =>  'icon32',                     'capability_type'       =>  'post',                     'map_meta_cap'          =>  false,                     'hierarchical'          =>  false,                     'supports'              =>  array('title', 'editor', 'thumbnail', 'custom-fields'),                     'register_meta_box_cb'  =>  'add_meta_box_callback',                     'has_archive'           =>  true,                     'query_var'             =>  true,                     'can_export'            =>  true                 );              register_post_type('image_post', $args);     }     add_action('init', 'image_post_type');          function add_meta_box_callback(){         add_meta_box('image_variations', 'Image Variations', 'image_variations_callback', 'image_post', 'side', 'low');     }          function image_variations_callback(){          }          function add_image_post_type_to_query($query){         if(is_home() && $query->is_main_query()){             $query->set( 'post_type', array('post', 'page', 'image_post') );         }         return $query;     }     ?>      Thanks in advance


title: Advanced Custom Fields Plugin - Conflict with Custom Post Type Default Editor

text: Advanced custom fields(2.1.4) plugin disables the wordpress default editor for custom post types. How can I fix this.


title: How to use mobile number instead of email

text: How can I use mobile number in registration form instead of email? I want to remove email field and add mobile number there. How to do that?


title: Change URL of plugin admin menu

text: Gravity Forms adds a Admin Menu called Entries that points to page=gf_entries. I am trying to modify this URL so that it defaults to page=gf_entries&id=2 instead. Below is the order of my WordPress Admin Menu. How can I update the URL of the Entries menu item?               Dashboard     Posts     Media     Forms     -Forms     -New Form     -Entries


title: Editing wp-includes/feed.php

text: I was not understanding why my RSS didn't update, after much wailing and gnashing of teeth I believe I have fixed this to a degree by editing wp- includes/feed.php. I changed this:               $feed->set_cache_duration( apply_filters( 'wp_feed_cache_transient_lifetime', 12 * HOUR_IN_SECONDS, $url ) );      To this:               $feed->set_cache_duration( apply_filters( 'wp_feed_cache_transient_lifetime', 1 * HOUR_IN_SECONDS, $url ) );      When it was changed the news did indeed refresh at least once and I believe I have set this to refresh once an hour. This is hard to test as an hour is a long time and sometimes there are gaps in the time that the RSS feeds themselves update. Say for instance I want this to update in 30 minutes what would this look like? I'm looking for the proper way to enter the hours, minutes and seconds. Thanks for any insight you may provide this seems like the last step. I'm trying to get the RSS feed in a news forum to update more frequently as users are news junkies and once every 12 hours just isn't fast enough for them to follow current events.


title: Facebook like button disappears after changing the static permalink to dynamic one!

text: ` <li class="fb-like fb" data- href="http://developers.facebook.com/docs/reference/plugins/like" data- layout="button_count" data-show-faces="true" data-send="false"></li>   `   The above code works like a charm, but it's a static href! when I change the href to the_permalink, the button disappears!      ` <li class="fb-like fb" data-href="<?php the_permalink(); >" data- layout="button_count" data-show-faces="true" data-send="false"></li>   `   Can you please tell me what am I doing wrong?


title: How to Display Child Taxonomy Posts

text:
I am trying to show items on a page grouped by child taxonomies in something that looks like this... Child Taxonomy 1 (h2) Item 1   Item 2 Child Taxonomy 2 (h2) Item 3   Item 4 I did manage to get the children of a taxonomy and get their posts, unfortunately when using the following code I get all parent taxonomy posts twice rather than have them grouped by their respective child taxonomy like... Child Taxonomy 1 (h2) Item 1   Item 2   Item 3   Item 4 Child Taxonomy 2 (h2) Item 1   Item 2   Item 3   Item 4 I am at a bit of a loss as to what I am doing wrong with my code that makes the posts show up under both groups rather than only under the child taxonomy to which they belong and would greatly appreciate a pointer to what I am missing.               <?php         $termID = 8; // Parent A ID         $taxonomyName = "product_category";         $termchildren = get_term_children( $termID, $taxonomyName ); ?>     <?php                       foreach ($termchildren as $child) {                   $term = get_term_by( 'id', $child, $taxonomyName );     ?>
<?php echo $term->name; ?>
                       <?php     $paged = (get_query_var('paged')) ? get_query_var('paged') : 1;     $wp_query = new WP_Query( array(                             'post_type' => 'product',                              'product_category' =>$term->name,                             'meta_query' => array(                                 'relation' => 'AND',                                 array(                                     'key' => 'product_active',                                     'value' => '1'                                 ),                             ),                             'posts_per_page' => -1,                             'orderby' => 'menu_order',                             'order' => 'ASC',                             'paged'=> $paged                                  )); ?>               <?php while ($wp_query->have_posts()) : $wp_query->the_post(); ?>          <?php the_title(); ?> <img src="<?php $image = wp_get_attachment_image_src(get_field('product_image'), 'full'); ?><?php echo $image[0]; ?>" alt="<?php the_title(); ?>" />
     <?php the_content(); ?>               <?php endwhile;            wp_reset_query();     ?>                 <?php     unset($term);     }     ?>


title: Using WP_Query() in Magento shows error

text: I am using Magento (directory `example.com/app`) and WordPress (directory `example.com/blog/wp-blog-header.php`). When I set up a `WP_Query` in Magento's `template\catalog\product\view.phtml` it shows the following error: > Fatal error: Cannot redeclare __() (previously declared in > \app\code\core\Mage\Core\functions.php:93) in wordpress\wp-includes\l10n.php > on line 98 Is there a way to get this to work?


title: How and where is wordpress adding mySQL content to database?

text: I am currently following this steps to change server and domain for my website. I have been exporting and importing mySQL from one data base to the other. I am about to delete the mySQL content of the database to replace it. I am scared that it will mess up my website. How does Wordpress create mySQL content on the DataBase and how can I make it re-write the content. In other words: why do i need to export and import the data base from the previous website and not just allow the wordpress files on the FTP to generate the new mySQL content? many thanks


title: Strip HTML Tags From Search Results

text: When I make a search, if there is an image title within a img tag, it's displayed in a very ugly fashion among the search results (the whole tag is displayed and the picture too). I found this script which is supposed to solve the problem and this is the only thing I found about the subject over the internet.               <?php     function super_search_exclude_activate() {         $striptags = "CREATE FUNCTION fnStripTags( Dirty longtext )             RETURNS longtext             DETERMINISTIC              BEGIN               DECLARE iStart, iEnd, iLength int;                 WHILE Locate( '<', Dirty ) > 0 And Locate( '>', Dirty, Locate( '<', Dirty )) > 0 DO                   BEGIN                     SET iStart = Locate( '<', Dirty ), iEnd = Locate( '>', Dirty, Locate('<', Dirty ));                     SET iLength = ( iEnd - iStart) + 1;                     IF iLength > 0 THEN                       BEGIN                         SET Dirty = Insert( Dirty, iStart, iLength, '');                       END;                     END IF;                   END;                 END WHILE;                 RETURN Dirty;             END;";         global $wpdb;         $wpdb->query("DROP FUNCTION IF EXISTS fnStripTags");         $wpdb->query($striptags);     }     register_activation_hook(__FILE__, 'super_search_exclude_activate');          function super_search_exclude_deactivate() {         global $wpdb;         $wpdb->query("DROP FUNCTION IF EXISTS fnStripTags");     }     register_deactivation_hook(__FILE__, 'super_search_exclude_deactivate');          function super_search_exclude_posts_search($search) {         if (is_search()) {             global $wpdb;             if (stripos($search, 'post_content LIKE')) {                 $search = str_replace("{$wpdb->posts}.post_content LIKE", "fnStripTags({$wpdb->posts}.post_content) LIKE", $search);             }         }         return $search;     }     add_filter('posts_search', 'super_search_exclude_posts_search');      I don't have any error message but the search engine doesn't return a result unless I deactivate the plugin and then I'm back to square one. What would be the issue? PS: I created a plugin from this script and activated it in the right admin section.


title: Edit raw HTML of the landing page

text: I just created and set up a landing page for my blog. I use Weaver theme. I checked every checkbox to remove all the stuff I don't want ( `Hide Page Title, Hide Site Title/Description, Hide Menus, Hide Standard Header Image` etc) and set page template to `Blank`. In fact I don't want **any** foreign stuff in my pure html+css+js page but it's not as easy as it seems. Maybe there's a php file somewhere in wordpress' folders corresponding to my page I can edit?


title: featured image box missing

text: The 'set featured image' box is not showing up at my 'Posts' and 'Pages' edit page. There is also no checkbox in my screenoptions. I have `add_theme_support( 'post-thumbnails' );` in my functions.php In my custom post types the box is showing up because of this: `'supports' => array( 'title', 'thumbnail'), ` How can i enable the set featured image' box for my Posts? Please help me :)


title: Ger posts from similar tags and categories

text: I want to retrieve 5 posts using any given post ID with following criteria:   1. If the post with the ID has any tags, then select the posts having same tags.   2. If the post does not have any tags, then select the posts with same category. I can do this with following condition statement. However the problem is in following situation: **Problem:** If post has a tag, but there are less than 5 posts with that tag, in that case I want to first get the posts with the same tags and then remaining posts from the same category. I am unable to figure out how I can do this. Here's my code:               $tags = wp_get_post_tags($post->ID);     if ($tags) {         $tag_ids = array();         foreach($tags as $single_tag) $tag_ids[] = $single_tag->term_id;              $args=array(             'tag__in' => $tag_ids,             'post__not_in' => array($post->ID),             'showposts'=> 5,         );            } else {         $categories = get_the_category($post->ID);           if ($categories) {             $category_ids = array();             foreach($categories as $cat) $category_ids[] = $cat->term_id;                  $args = array(                 'category__in' => $category_ids,                 'post__not_in' => array($post->ID),                 'showposts'=> 5,             );               }     }


title: Archive-posttype.php isn't loaded

text: I created a custom post type               add_action('after_setup_theme', 'cptui_register_my_cpt_packaged');     function cptui_register_my_cpt_packaged() {     register_post_type('packaged', array(     'label' => 'Packaged Foods',     'description' => '',     'public' => true,     'show_ui' => true,     'show_in_menu' => true,     'capability_type' => 'post',     'map_meta_cap' => true,     'hierarchical' => false,     'rewrite' => array('slug' => 'packaged-foods-list', 'with_front' => false ),     'query_var' => true,     'has_archive' => true,     'supports' => array('title','editor','excerpt','trackbacks','custom-fields','comments','revisions','thumbnail','author','page-attributes','post-formats'),     'taxonomies' => array('post_tag','pf_cat','pf_groc_cat'),     'labels' => array (       'name' => 'Packaged Foods',       'singular_name' => 'Packaged Food',       'menu_name' => 'Packaged Foods',       'add_new' => 'Add Packaged Food',       'add_new_item' => 'Add New Packaged Food',       'edit' => 'Edit',       'edit_item' => 'Edit Packaged Food',       'new_item' => 'New Packaged Food',       'view' => 'View Packaged Food',       'view_item' => 'View Packaged Food',       'search_items' => 'Search Packaged Foods',       'not_found' => 'No Packaged Foods Found',       'not_found_in_trash' => 'No Packaged Foods Found in Trash',       'parent' => 'Parent Packaged Food',     )     ) ); }      and two taxonomies called pf_cat and pf_groc_cat I am trying create a custom post type archive template and it always default to the archive.php Here are the taxonomies:               add_action('after_setup_theme', 'cptui_register_my_taxes_pf_cat');     function cptui_register_my_taxes_pf_cat() {     register_taxonomy( 'pf_cat',array (       0 => 'packaged',     ),     array( 'hierarchical' => true,         'label' => 'PF Categories',         'show_ui' => true,         'query_var' => true,         'show_admin_column' => false,         'labels' => array (       'search_items' => 'PF Category',       'popular_items' => '',       'all_items' => '',       'parent_item' => '',       'parent_item_colon' => '',       'edit_item' => '',       'update_item' => '',       'add_new_item' => '',       'new_item_name' => '',       'separate_items_with_commas' => '',       'add_or_remove_items' => '',       'choose_from_most_used' => '',     )     ) );      }          add_action('after_setup_theme', 'cptui_register_my_taxes_pf_groc_cat');     function cptui_register_my_taxes_pf_groc_cat() {     register_taxonomy( 'pf_groc_cat',array (       0 => 'packaged',     ),     array( 'hierarchical' => true,         'label' => 'PF Grocery Categories',     'show_ui' => true,     'query_var' => true,     'rewrite' => array( 'slug' => 'packaged-foods' ),     'show_admin_column' => false,     'labels' => array (       'search_items' => 'PF Grocery Category',       'popular_items' => '',       'all_items' => '',       'parent_item' => '',       'parent_item_colon' => '',       'edit_item' => '',       'update_item' => '',       'add_new_item' => '',       'new_item_name' => '',       'separate_items_with_commas' => '',       'add_or_remove_items' => '',       'choose_from_most_used' => '',     )     ) );      }      I am new to CPT and Taxonomies and I'm really struggling here. I read another question here about something very similar and he was requested to try the URL with the custom post type in it http://[websitehere].com/?post_type=packaged uses the archive-packaged.php template. http://[websitehere].com/?post_type=packaged&packaged-foods=organic- wines also works. But, when I try http://[websitehere].com/packaged-foods/organic-wines/ it defaults to the archive.php What in the heck do I have wrong? Thanks in advance.


title: exclude post from displaying in loop if it is in a category, but not in many categories

text: I am searching how to exclude posts from displaying in a loop if them are in a category x, but not in many categories... The Problem: if I do exclude posts i.e. out of category 5, all posts are listed in category 5 will be excluded. Also those which are also in category 3 and 1. how do i exclude:               while (have_posts()) : the_post();        if(in_category($myCatsToExcludeArray)) continue;       ...       ... some general outputs     endwhile;


title: How to wrap html around Settings API add_settings_section()

text:
I am writing a plugin and I'm currently implementing my admin menu using the wordpress settins API. As always with API's, it facilitates programming to a certain degree, but it seems like I have an issue: I need to wrap custom html around those sections. For example I want to wrap my form elements around a fieldset or I want to position logical units into two columns using CSS(float: right, float:left). In order to do so, I need to pack these sections into a container. This is the API function that echo's the sections.               function do_settings_sections( $page ) {             global $wp_settings_sections, $wp_settings_fields;                  if ( ! isset( $wp_settings_sections[$page] ) )                     return;                  foreach ( (array) $wp_settings_sections[$page] as $section ) {                     if ( $section['title'] )                             echo "
{$section['title']}
\n";                          if ( $section['callback'] )                             call_user_func( $section['callback'], $section );                          if ( ! isset( $wp_settings_fields ) || !isset( $wp_settings_fields[$page] ) || !isset( $wp_settings_fields[$page][$section['id']] ) )                             continue;                     //MY WRAPPING NEEDS TO START HERE                     echo '
';                     do_settings_fields( $page, $section['id'] );                     echo '
';                     //AND END HERE!             }     }      As far as I read the source correctly, there's no way to wrap custom html around it (only before, with the add_settings_section( $id, $title, $callback, $page ) $callback parameter). So how would you solve this problem? Should I just inject the appropriate containers into the the global $wp_settings_sections (With the ordinary hook I will write the div and then in the last field of each setting I can close the container with /div. But this is a very very ugly workaround and it find it repellent to say the least! Should I abandon the idea of using the great settings API?


title: How to link to local post

text: I am creating a post and would like to link to other post on my blog. What is the best way to do this? I don't want to hard link in case I update the post title. Is there a way to do this?


title: Redirecting user after updating profile?

text: I have been working around with adding stuff in user profile edit area. i am done with that but there is one thin i am unable to sort out. What i am planning to do is to redirect a user to a custom page (custom member page) after they successfully edited their profile (wp-admin/profile.php) . In case of error they stay there. Help is appreciate :) thanks


title: Win7 Dev Environment

text: I have Win7 32-bit Professional and I want to start learning to program and skin WordPress. My hosts will likely be LAMP, so I was going to run Win versions of those tools locally. Should I just get a linux VM, or will I be able to transfer what I do from the Win environment to the *nix hosting?


title: Right way for setting categories

text: My site follows this hierarchy HTML5 +   * Themes   * Resources   * Books   * Tools Wordpress +   * Plugins   * Themes   * Tools   * Books jQuery +   * Plugins   * Tools   * books and the same combinations for CSS3, SEO and others, but I don't know how to structure the categories and sub-categories in right way and how to target the specific blog-post with url like we select post with a specific category               www.example.com/categories      How do we target tools(sub-categories) in plugin(category)? For example               www.example.com/categories/sub-category


title: How to handle valueless attributes in shortcodes?

text: Some HTML elements accept valueless attributes such as `<input disabled />` or `<video autoplay />` How do I handle this case with shortcodes where I want to disable autoplay by default (= omit the attribute at all) but enable it optionally. Possible scenarios:               // [video]     <video>          // [video autoplay]     <video autoplay="autoplay"> // using XML syntax          // [video autoplay="autoplay"]     <video autoplay="autoplay">           // [video autoplay="false"]     <video autoplay="false"> // value doesn't matter - video will still auto play      The standard way of doing this doesn't help me as **I don't want to have a default value** :               // http://codex.wordpress.org/Shortcode_API#Attributes     function my_shortcode_handler( $atts, $content = null ) {         extract( shortcode_atts( array(             'attr_1' => 'attribute 1 default',             'attr_2' => 'attribute 2 default',         // ...etc         ), $atts ) );     }      I can definitely find my own hack around this problem but I am interested if there is a pretty way to do this.


title: Ubuntu 13.04 create new wordpress theme from scratch problems

text: I'm new to wordpress. I tried to create new theme, basically I just copied files from default theme and changed it's name, URI etc. But my theme is not showing in wordpress. Can you tell what steps are required to make new theme in Ubuntu.


title: Buddypress: Display multiple custom post types on member's profile

text: **GOAL** We have several plugins in Buddypress to display posts in member's profile page (posts of displayed user), some of them doesn't work anymore (bp-posts- on-profile) or new one (TCH_PostsOnProfile) and some of them which works like (buddyblog) doesn't show multiple custom post types yet, I have decided to try to do it without a plugin, with the help of this site I have collected some snippets and have created almost working new tab with member's custom posts with **if** conditional for user roles who created specific post types. I have succesfully added a new tab in member's profile in buddypress with code below in bp-custom.php **PROBLEM** After adding snippet in bp-custom.php and creating stats-profile.php template I have tried many combinations of different codes, but I cant's see anything yet, only empty broken profile page with member submenu and (missing footer and sidebar) **CONCLUSION** How can I display custom posts for custom user roles? Every user role has a different forms to fill out and those submitted forms I would like to display in their profiles with the help of new added tabs. **EXAMPLES** Job Applicant creates 2 custom post types: "portfolio" and "applicant", CPT "portfolio" is something like their curricullum vitae with personal data and photos, "applicant" is advertisement for searching for job. Agency creates agency portfolio (CPT "agency") and "employer" CPT (advertisement offering the jobs. User role Club creates CPT "club" etc. _bp-custom.php is here_               // Set up Custom BP navigation     function my_setup_nav() {           if ( user_can( bp_displayed_user_id(), 'job_applicant' ) ) {          global $bp;           bp_core_new_nav_item( array(                 'name' => __( 'Stats', 'buddypress' ),                 'slug' => 'stats',                 'position' => 20,                 'screen_function' => 'profile_screen_stats'            ) );                // Change the order of menu items           $bp->bp_nav['messages']['position'] = 100;       }     }          add_action( 'bp_setup_nav', 'my_setup_nav' );               // show feedback when 'Stats' tab is clicked     function profile_screen_stats() {     add_action( 'bp_template_content', 'profile_screen_stats_show' );     bp_core_load_template( apply_filters( 'bp_core_template_plugin', 'members/single/plugins' ) );     }          function profile_screen_stats_show() {     // call your stats template     locate_template( array( 'stats-profile.php' ), true );     }      _in stats-profile.php page I am trying to display those posts, this is the code I think that should suite my purpose best, template is in bp-default folder._               <?php        global $bp;       global $paged;       global $wp_query;       $temp = $wp_query;       $wp_query = null;       $user_id = $bp->displayed_user->id;       $paged = (get_query_var('paged')) ? get_query_var('paged') : 1;       $args = array(             'posts_per_page' => 10,             'cat' => -1,             'post_type' => array(                  'post',                 'portfolio',                 'applicant',                 'agency',                 'employer'                ),             'author' => $user_id,             'paged' => $paged         );      $wp_query = new WP_Query($args);       while ( $wp_query->have_posts() ) :   $wp_query->the_post();         the_title();       endwhile;       $wp_query = null; $wp_query = $temp;      ?>


title: Display custom post type in template

text: I have a custom post type called campsites, events and activities I want to display this in a list. So when the user click on the link, it will then display all the posts under that custom post type. Any help would be greatly appreciated. ### Edit               add_action('init', 'activity_resources_register_post_type');          function activity_resources_register_post_type() {         register_post_type('activity_resources', array(             'labels' => array(                 'name' => 'Activity Resources',                 'singular_name' => 'Activity Resources',                 'add_new' => 'Add new Activity Resources',                 'edit_item' => 'Edit Activity Resources',                 'new_item' => 'New Activity Resources',                 'view_item' => 'View Activity Resources',                 'search_items' => 'Search Activity Resources',                 'not_found' => 'No Activity Resources found',                 'not_found_in_trash' => 'No Activity Resources found in Trash'             ),             'public' => true,             'has_archive' => 'activity_resources',             'rewrite' => array("slug" => "activity_resources"), // the slug for permalinks             'supports' => array('title', 'editor', 'thumbnail')         ));     }


title: Why isn't my Meta_Query running?

text: Just FYI, I'm not an experienced coder, and I have had very little experience with coding PHP, it's safe to say I don't know the basics, just what I am teaching myself along the way to read and understand and then edit existing code. I have a site with a purchased Theme which includes a custom tax_query which I've copied the structure of to try and filter queries by different fields in the Meta data. I'm placing my function in the functions.php file within my Child theme which contains all my modifications so far. Here is my code:               function ah_meta_queries( $query = false ) {         if ( ! ( is_post_type_archive( 'listing' ) || is_tax( 'listing_type' ) || is_tax( 'listing_location' ) ) ) return;              if ( is_admin() || ! is_a( $query, 'WP_Query' ) || ! $query->is_main_query() ) return;              if ( is_post_type_archive( 'listing' ) ) {             $meta_query_args = array( 'relation' => 'AND' );                  // For each type of Meta Data, check if filtering is set, then add it to the query array                  if ( isset( $_GET['et-listing-rating'] ) && 'none' != $_GET['et-listing-rating'] ) {             $meta_query_args[] = array(                     'key' => 'listing_type',                     'value' =>  intval( $_GET['et-listing-rating'] ),             ); }                  if ( isset( $_GET['Fitness'] ) )             $meta_query_args[] = array(                     'key' => 'HN_Fitness',                     'value' => 'TRUE',             );                  if ( isset( $_GET['Furnished'] ) )              $meta_query_args[] = array(                     'key' => 'HN_Furnished',                     'value' => 'TRUE',             );                  if ( isset( $_GET['Kitchen'] ) )              $meta_query_args[] = array(                     'key' => 'HN_Kitchen',                      'value' => 'TRUE',             );                  if ( isset( $_GET['Parking'] ) )              $meta_query_args[] = array(                     'key' => 'HN_Parking',                     'value' => 'TRUE',             );                  if ( isset( $_GET['Pets Allowed'] ) )              $meta_query_args[] = array(                     'key' => 'HN_Pets',                     'value' => 'TRUE',             );                  if ( isset( $_GET['Pool'] ) )             $meta_query_args[] = array(                     'key' => 'HN_Pool',                     'value' => 'TRUE',             );                            // If user input Price-Low but no Price-High, make sure Listing Price Low or Listing Price High is more than Price-Low             if ( (isset( $_GET['price-low'] ) && '' !=$_GET['price-low'] ) && !isset( $_GET['price-high']) )             $meta_query_args[] = array(                     'relation' => 'OR',                     array(                           'key' => 'HN_Price_Low',                         'value' => $_GET['price-low'],                         'type' => 'numeric',                         'compare' => '>=',                      ),                     array(                         'key' => 'HN_Price_High',                         'value' => $_GET['price-low'],                         'type' => 'numeric',                         'compare' => '>=',                     ),             );                  // If user input Price-High but no Price-Low, make sure Listing Price Low or Listing Price High is less than Price-High             if ( !isset( $_GET['price-low']) && (isset( $_GET['price-high'] ) && '' !=$_GET['price-high'] ) )             $meta_query_args[] = array(                     'relation' => 'OR',                     array(                           'key' => 'HN_Price_Low',                         'value' => $_GET['price-high'],                         'type' => 'numeric',                         'compare' => '<=',                      ),                     array(                         'key' => 'HN_Price_High',                         'value' => $_GET['price-high'],                         'type' => 'numeric',                         'compare' => '<=',                     ),             );                  // If user input both Price-Low AND Price-High, make sure Listing Price Low or Listing Price High is BETWEEN Price-Low and Price-High             if ( (isset( $_GET['price-low'] ) && '' !=$_GET['price-low'] ) && (isset( $_GET['price-high'] ) && '' !=$_GET['price-high'] ) )             $meta_query_args[] = array(                     'relation' => 'OR',                     array(                           'key' => 'HN_Price_Low',                         'value' => array( $_GET['price-low'], $_GET['price-high'] ),                         'type' => 'numeric',                         'compare' => 'BETWEEN',                      ),                     array(                         'key' => 'HN_Price_High',                         'value' => array( $_GET['price-low'], $_GET['price-high'] ),                         'type' => 'numeric',                         'compare' => 'BETWEEN',                     ),             );                            // If any of the filters are set in the URL, then run the Meta Query                  if (    ( isset( $_GET['et-listing-rating'] ) && 'none' != $_GET['et-listing-rating'] ) ||                     isset( $_GET['Fitness'] ) ||                     isset( $_GET['Furnished'] ) ||                     isset( $_GET['Kitchen'] ) ||                     isset( $_GET['Parking'] ) ||                     isset( $_GET['Pets Allowed'] ) ||                            isset( $_GET['Pool'] ) ||                            ( isset( $_GET['price-low'] ) && '' !=$_GET['price-low'] ) ||                     ( isset( $_GET['price-high']) && '' !=$_GET['price-high'] )                 )                 $meta_query = new WP_Meta_Query( $meta_query_args );                          }     }      Some of the questions I have are: -why isnt this running? do I have to set the function to run anywhere else? -why is the function declared with the argument ( $query = false ) ? Any suggestions are very welcome!!


title: Restrict access to specific users

text: Is there a built-in function that would allow me to restrict access to registered users until the official launch date in Wordpress 3.4.2? The blog is self-hosted.


title: first excerpt fine, subsequent post excerpts shift to the right instead of displaying vertically

text:
The front page of the blog is intended to show post excerpts and a cropped version of the post image. The first/most recent excerpt is perfect, however the older subsequent excerpts are showing up somewhat shifted to the right. I'm thinking the problem lies in my loop, but I've been looking at it for so long I think a pair of fresh eyes is needed. index.php-               <?php echo get_header();;?>     <?php echo get_sidebar();;?>

             <?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>
                 <?php                     if ( has_post_thumbnail() ) {                         the_post_thumbnail( 'custom-image' );                     }                 ?>

<?php the_title() ;?>
                                      <?php the_excerpt('read more...'); ?>                     <?php endwhile; else: ?>
Sorry, no posts to list
                          <?php endif; ?>
>> Posted on <?php the_date('M-d-y'); ?> >> <?php the_tags('tags: ', ', ', '
'); ?>

          <?php get_footer(); ?>


title: Sort custom post type items by taxonomy description

text:
I want the portfolio items to be arranged in custom order (based on the category descriptions which I use number values to order) Current order

<?php _e('Sort Items','themename'); ?>:

<?php _e('All', 'themename'); ?>
             <?php             foreach ($cats as $cat ) : ?>
<a href="#<?php echo $cat->slug; ?>" rel="<?php echo $cat->slug; ?>"><?php echo $cat->name; ?>
             <?php endforeach; ?>
      If I have 3 taxonomies named _Gender_ , _Age_ , _Height_. I want the filter beside "All" to display them in above order, based on the taxonomy description.               Gender Desc "1", Age Desc "2" etc.      I want to to this on mass scale so not just 3 taxonomies, hence the need to number them.


title: WBR (word break opportunity) elements being inserted into shortcode $content in posts

text: Greeting all, I've written a simple WordPress shortcode which wraps inline $content in `<code>` tags. I see that sometimes the `$content` contains `<wbr />` elements, which must be inserted either by TinyMCE or by WordPress. I'd never even heard of `<wbr />` (word break opportunity) until I looked it up. I'm guessing that TinyMCE is inserting the elements when a post is saved in the WordPress visual editor, but I can't be sure. I looked through both the WordPress and TinyMCE source and I see mentions of `<wbr />` but I couldn't find where it is being injected into the post content. Do you know why the elements are being inserted, and if it's possible to turn off that behavior in shortcodes? For now, I'm working around the issue by removing the `<wbr />` elements using `preg_replace()`. But I consider this kind of hack-ish and I'd prefer to turn it off in a cleaner way. Any ideas?


title: How can i alter the amount of different images sizes being stored?

text: For a custom plugin i am using WP's media-uploader. How can i alter the amount of different image sizes being stored? At the moment the theme uses 5 different image sizes and for my plugin i only need 2 store two image sizes? Regards,


title: search page id issue

text: I have a little issue with something i working at. I have a notice on 404 pages and on search page when i try to find something that do not exists.               Notice: Trying to get property of non-object in wp-includes\post-template.php on line 29      I have a plugin of a slider and i enqueue the js and css using this method: Loading Scripts and Styles Dynamically Per Page Using a Shortcode ...and what i think is the cause is getting the ID of the page... i don't think the search page has an id. So if i want to use my slider in a widget on sidebar on search page what i will do? I encounter same problem and when i using               get_post_meta($post->ID, 'some_meta', true);      ..so the id of the page is causing notices... ..usually i check with is_singular().. any better ideas?


title: Wordpress Query showing multiple titles

text:
I have written a query to display in a jquery slider (nivo) however it appears that it is showing all the posts and not just one at a time This is my code:

             <?php $the_query = new WP_Query( 'showposts=2' ); ?>                 <?php while ($the_query -> have_posts()) : $the_query -> the_post(); ?>                     <?php the_title(); ?>             <?php endwhile;?>

      Can anyone advise? The website address is http://www.gordonlundie.com/Howe/ thanks EDIT ok i found a previous post where i was having a same issue yet its still doing the same :S
                <?php if ( !function_exists('dynamic_sidebar') || !dynamic_sidebar('recentprojects1-sidebar') ) :                       endif; ?>

                     <?php $the_query = new WP_Query( 'showposts=5' ); while ($the_query -> have_posts()) : $the_query -> the_post();?>
<?php the_title(); ?>
                     <?php the_content(); ?>
             <?php endwhile;?>
      Guidance on how i have gone wrong, so that i may not make this mistake in the future is greatly received rather than unhelpful comments.


title: Fontawesome icon vanishes in editor while switching text and visual mode

text: While switching between text editor mode or updating post fontawesome icon vanishes.Please do not refer to use any plugin.I think i tag is stripped by editor,how can I overcome this? My code in editor text mode                     or                     As long as I am in text mode everything is well but when I switch to visual mode all of my code gets vanish.


title: Enable the admin to sort custom taxonomy

text: I added a custom taxonomy (separate categories for a custom post type) like this:               register_taxonomy(self::$slug . '_category', array(self::$slug), array(         'label' => 'Kategorien',         'labels' => array(             'name' => 'Kategorien',             'singular_name' => 'Kategorie',             'all_items' => 'Alle Kategorien',             'edit_item' => 'Kategorie bearbeiten',             'view_item' => 'Kategorie anzeigen',             'update_item' => 'Kategorie aktualisieren',             'add_new_item' => 'Neue Kategorie erstellen'         ),         'hierarchical' => true,         'rewrite' => array(             'slug' => 'referenzen-kategorie'         )     ));      On the homepage I am fetching the categories like this:               $categories = get_categories(array(         'type' => 'sb_reference',         'taxonomy' => 'sb_reference_category'     ));      And displaying it. Now comes the catch: The admin of the site wants to influence the order of the displayed categories and his desired order is neither alphabetical nor by post count, but by his perceived relevance of the categories. So basically I have to give the taxonomy an additional field that he can write the order of the categories in (i.e. CategoryA is 0, CategoryB is 2, CategoryC is 1 etc.) My question: How can I add an additional field to the custom taxonomy or what are my alternatives?


title: A page that shows a list of a specific custom post type

text: I've created a custom post type called 'product'. I want to add a page link to 'products' in the menu, but I don't have that option. I would like to know if there is a way of displaying it the same way as if it were like a category... a page that shows all the 'products' like if they were posts, and that I could add to the menu. At this stage I can only add specific 'products' but not a link to a list of them. Any suggestions on how to make this work?


title: Category Page Template - Can't get category ID

text: I am creating a category template that uses WP_query to get posts from my custom post type...               <?php      $query = new WP_Query( array( 'post_type' => array( 'mycpt' ), 'posts_per_page' => 5 ) );     ?>          <?php while ( $query->have_posts() ) : $query->the_post(); ?>          <?php the_title(); ?>          <?php endwhile; ?>      How do i get the category id for the current category type? I can get the category title with...               <?php single_cat_title( '', true ); ?>      But how do I get the ID?


title: All-In-One-Event Plugin - displaying the correct time

text:
So I've successfully a list of events, however, the times echoed are wrong. For the events that occur multiple times, the first occurrence's time is correct, however the occurences after that display time fast forwarded by 8 hours. For example, first occurrence of an event would display 3:30 – 5:00pm as its time, which is correct. But then the second to sixth occurrence of the same event would show 11:30 – 1:00am as its time. How do I fix this? Sorry... the code is kind of lengthy but I really want to make sure I get this fixed. Btw, I don't want to use `echo $event->get_timespan_html();` because it will show February 25, 2014 @ 3:30 pm – 5:00 pm instead of just 3:30 – 5:00pm.               <?php                   // Gets localized time             $time = $ai1ec_events_helper->gmt_to_local( Ai1ec_Time_Utility::current_time() );             $bits = $ai1ec_events_helper->gmgetdate( $time );                  // Sets start time to today             $start = gmmktime(0,0,0,$bits['mon'],$bits['mday'],$bits['year']);                  // Sets end time to a year from today i.e. $bits['year']+1             $end = gmmktime(0,0,0,$bits['mon'],$bits['mday'],$bits['year']+1);                  // Look in class-ai1ec-calendar-helper.php for details             $get_events = $ai1ec_calendar_helper->get_events_between($start, $end, $spanning = false);                  date_default_timezone_set('Los Angeles'); // Match timezone settings in WP                  $i = 0;                  foreach($get_events as $event) {                          if ( $i == 50 ) break;                          // Event ID                     $eventID = $event->post->ID;                          // Event Title                     $eventTitle = $event->post->post_title;                          // Event URL                     $eventURL = $event->post->guid;                          // Event Date                     $eventMonth = date( 'M', $event->start );                     $eventDay = date( 'd', $event->start );                     $eventWeekday = date( 'D', $event->start );                          // Event Image                     $imgID = get_post_thumbnail_id( $eventID );                          // Event Time                     $startTime = date( 'g:i', $event->start );                     $endTime = date( 'g:ia', $event->end );                  ?>

                             <?php echo '
'. $eventTitle .'
'; ?>

                             <?php echo $event->city; ?>,                             <?php if ( $event->province == "Washington"): ?>                                 <?php echo "WA"; ?>                             <?php else: ?>                                 <?php echo $event->province;?>                             <?php endif;?>
                                                           <?php echo $event->venue; ?>
                             <?php echo $event->cost; ?>

                         <?php                             echo get_the_post_thumbnail( $eventID, 'full', $attr );                         ?>

                                                                           <?php                                          echo $eventMonth;                                     ?>                                                                                <?php                                          echo $eventDay;                                     ?>                                                                                <?php                                          echo $eventWeekday;                                     ?>
                                                                   <?php                                  if( $event->allday == 1 ) {                                         $timeSpan = 'All Day
';                                         echo $timeSpan;                                 } elseif( $startTime == $endTime ) {                                         $timeSpan = $startTime;                                         echo $timeSpan . '
';                                 }else {                                         $timeSpan = $startTime . ' – ' . $endTime;                                         echo $timeSpan . '
';                                 }                                 ?>

              <?php $i++; } ?>


title: wp_list_filter() and supports

text: I'm testing the function `wp_list_filter()`, basically I want to know if post_type has some specific feature before making stuffs. So I end up with this:               public static function get_post_types_with_support( $feature ) {        global $_wp_post_type_features;        $post_types = wp_list_filter( $_wp_post_type_features, array( $feature => 1 ) );             return $post_types;     }      The problem is I do not understand why I can't get it working with custom post type while I gave some specific support to them. For example, book post_type supports thumbnails, but I do not have it in my array when I display it. Where am I wrong? **EDIT** : by feature I mean support. If my post_type supports this feature then I can use it. My function is supposed to return array with post_types that support my feature e.g thumbnail


title: How to create a page for authors? like www.myblog.com/author/

text: I have **author.php** and it's working fine for authors separately. **eg:**   * if I click **author1** and it goes to `www.myblog.com/author/author1` and shows his details   * if I click **author2** and it goes to `www.myblog.com/author/author2` and shows his details Now I want to show all these users under 1 url like `www.myblog.com/author/author` If somone goes to `www.myblog.com/author/author/`then it should show the authors list with their details. How can I do that.? Any help will be very much appreciated. Thanks.


title: get_permalink() gives a certain page link only. how to solve this.?

text:
the_title('
', '
');      anywhere if I use `get_permalink()` it's just giving **myblog.com/about_us** eg: the above code I am getting H1 link as **myblog.com/about_us** weird... how can I solve this?


title: How to Filter in the "Add Media Popup" to show only "unattached" Media

text: Any idea how to hack WP 3.8.x for this feature?


title: Get category ID from nav menu

text:
Recently I am working on wordpress, but I've got stuck in nav menu item issue. My desireable result was a pull down caption like this: http://www.masterhands.com.tw/index.aspx   * Each category list on nav menu as an item. I made this by a default way: function.php register.    * I am fine with the code of pull down area, it relys on inputing category ID in WP_Query to show most recent 3 posts now. And I seperate it as another php. But the problems:   * How to get the cat ID but not the menu item ID?   * By just on hover? I was searching high and low for few days. This is the way I call post from category (pick category with offset) in a php named : caption.php
      <?php $cat_id = 2; //the certain category ID          $latest_cat_post = new WP_Query( array('offset' => 0, 'posts_per_page' => 1, 'category__in' => array($cat_id)));          if( $latest_cat_post->have_posts() ) : while( $latest_cat_post->have_posts() ) : $latest_cat_post->the_post();  ?>     // Where I post thing...
      I tried to dissect it part by part   * caption.php presently included in all php ()   * Hover on "menu li a" trigger pull down (.content is where the container is) > >      $(document).ready(function(){ >     $("#menu-menu-1 a").mouseover(function(){ >            $(".content").slideDown(100); >        });   >     }); >   The default menu by wordpress looks like:

     cat2

      So I think merely get the cat id from URL while on hover for '$cat_id' is a direct way?


title: Attach media to post by media category

text: I am attaching a media category to a uploaded media. When I am saving changes I'd like to automaticaly attach that media to post which name is the same as the media category. Has anyone done something like that ?


title: Deregister or disable duplicate check ($post_exists) in cpt saving/updating process

text: I have registered a custom post type which is ment to bring up 24 posts a year, titles only containg numbers 1-24. I did some rewrites to achive that the permalink structure of this posts will be `%post_title%-%year%`. So actually the problem is the regular saving process which duplicate-checks the post title before updating/saving it. I already did some search on that and found a post in the forums about a similar problem with importing. This led me to ask for if there's a way to hook into the cpt saving/updating process to set `$post_exists = false;`. Any ideas on that?


title: Hooking into wp_export filter for custom post type

text: I'm working with a CPT which has 5 taxonomies (tags, not categories). I am attempting to use the `wp_export` filter. The issue I am experiencing is when the filter is running: it appears to run it against the `wp_posts` table AND the `wp_users` table. So, when the query runs against the `wp_posts` table; all is good. We are filtering the posts based on the `post_date` column; which exists on that table. However, when our same filter ALSO runs on the `wp_users` table; we fail because the `wp_users` table does not contain a `post_date` column. Here is what WP seems to do (from my experience with this) with our custom query filter:   1. WP is running our updated filter against the `wp_posts` table. SUCCESS -> all posts are listed matching our query.    2. WP is running our updated filter against the `wp_users` table. FAIL -> `wp_users` table does not contain a `post_date` column. WP then does the same thing against the:   * `wp_terms` -> FAIL   * `wp_postmeta` -> FAIL   * `wp_comments` -> FAIL  Here is the (modified) query I am currently running - hooked to `wp_export`:               function reviews_query( $query ) {       $args = array( 'start_date' => false, 'end_date' => false );       if ( $_REQUEST['emember_tickets_start_date'] || $_REQUEST['emember_tickets_end_date'] ) {           $args['start_date'] = $_REQUEST['emember_tickets_start_date'] ;           $args['end_date'] = $_REQUEST['emember_tickets_end_date'] ;       }            global $wpdb;            if ($args['start_date'] && $args['end_date']) {           $start_date = isset($args['start_date']) ? date( 'Y-m-d', strtotime($args['start_date'])) : '';           $end_date = isset($args['end_date']) ? date( 'Y-m-d', strtotime('+1 month', strtotime($args['end_date']))) : '';           $query .= $wpdb->prepare( " AND {$wpdb->posts}.post_date BETWEEN %s AND %s", $start_date, $end_date );       }            elseif ( $args['start_date'] && !$args['end_date'] )  {           $start_date = isset($args['start_date']) ? date( 'Y-m-d', strtotime($args['start_date'])) : '';           $query .= $wpdb->prepare( " AND {$wpdb->posts}.post_date >= %s", $start_date );       }            elseif ( $args['end_date'] && !$args['start_date'] ) {           $end_date = isset($args['end_date']) ? date( 'Y-m-d', strtotime('+1 month', strtotime($args['end_date']))) : '';           $query .= $wpdb->prepare( " AND {$wpdb->posts}.post_date < %s", $end_date );       }            //var_export($query);       return $query;     }      My question... Is it possible to keep our 'updated custom query' from running against all these other tables where it is failing... and run it ONLY against the `wp_posts` table?


title: Child Theme vs Duplicate Theme Renamed

text: Okay, I quite often see people talk about child themes and the reasons for using them instead of modifying the existing theme, but they all seem to center around the idea that if the parent theme is updated all changes will be lost. When I've created sites in the past, I have always made a duplicate of the starting theme, changed the theme name in `style.css`, and worked directly there. It seems to me that using a single theme instead of a child theme would save overhead, and allow greater control over the code - removing unnecessary functions rather than working around them, for example. If I run into issues, I always have the original theme files to reference, and if the parent theme is updated, my child theme could still break anyway if function names and such change, so I don't see that as a real benefit. My web searches haven't turned up much on this topic save "developer preference", which is not really a reason. Are there any real benefits of using a child theme over duplicating and renaming the theme?


title: Allow single quote in URLs

text: I have a wordpress site hosted on a godaddy server running apache. My experience is on windows iss so this might be an easy question but I can't figure it out. I want to allow urls at my site like: http://my.site.com/biz/Jordan's_place/jordan/ The problem is two fold. 1) If I enter: http://my.site.com/biz/Jordan's_place/jordan/ the url is fine but if I enter: http://my.site.com/biz/Jordan's_place/jordan the url is rewritten to: http://my.site.com/biz/Jordans_place/jordan/ Note the lost single quote is shown in the browser address. 2) The page requires memebr acce3ss. When you browse to it without logging in you are sent to the login page with the url: /wp-login.php?redirect_to=/biz/Jordan\'s_place/jordan/ note the added backslash and then after login the page goes to: http://my.site.com/biz/Jordans_place/jordan/ Is it wordpress or the server that is messing with the single quotes? Am I crazy to want to allow single quotes in my urls? If so why doesn't php or javascript encode them? Thanks guys.