title: Upload button in metabox not working

text:
The upload button is not working when put inside javascript, but it works when I put it outside the javascript.               /* -----------------------upload button------------------ */     function multiple_media_upload_js() {         $js_path = get_bloginfo('template_directory');         wp_enqueue_script('thickbox');         wp_register_script('my-upload', $js_path .'/assets/js/admin.js', array('jquery','media-upload','thickbox'));         wp_enqueue_script('my-upload');     }          function multiple_media_upload_css() {wp_enqueue_style('thickbox');}          add_action('admin_print_scripts', 'multiple_media_upload_js');     add_action('admin_print_styles', 'multiple_media_upload_css');                    /*  -----------------------MeTA Box-------------------------- */     add_action( 'add_meta_boxes', 'dynamic_add_custom_box' );          /* Do something with the data entered */     add_action( 'save_post', 'dynamic_save_postdata' );          /* Adds a box to the main column on the Post and Page edit screens */     function dynamic_add_custom_box() {         add_meta_box(             'dynamic_sectionid',             __( 'Client Information', 'myplugin_textdomain' ),             'dynamic_inner_custom_box',             'page');     }          /* Prints the box content */     function dynamic_inner_custom_box() {         global $post;         // Use nonce for verification         wp_nonce_field( plugin_basename( __FILE__ ), 'dynamicMeta_noncename' );         ?>
         <?php              //get the saved meta as an arry         $ourwork = get_post_meta($post->ID,'ourwork',true);              $c = 0;         if ( is_array( $ourwork ) ) {             foreach( $ourwork as  $track ) {                 if ( isset( $track['thumb'] ) || isset( $track['client-img1'] ) || isset( $track['client-img2'] ) || isset( $track['client-img3'] ) || isset( $track['client-img4'] ) || isset( $track['client-desc'] ) ) {                     printf( '
Thumb Image  : <input type="text" name="ourwork[%1$s][thumb]" value="%2$s" size="50" /> <input class="upload_image_button" id="_btn" type="button" value="Upload" />

Client Image 1 : <input type="text" name="ourwork[%1$s][client-img1]" value="%3$s" size="50" /> <input class="upload_image_button" id="_btn" type="button" value="Upload" />

                     Client Image 2 : <input type="text" name="ourwork[%1$s][client-img2]" value="%4$s" size="50"/> <input class="upload_image_button" id="_btn" type="button" value="Upload" />

                     Client Image 3 : <input type="text" name="ourwork[%1$s][client-img3]" value="%5$s" size="50" /> <input class="upload_image_button" id="_btn" type="button" value="Upload" />

                     Client Image 4 : <input type="text" name="ourwork[%1$s][client-img4]" value="%6$s" size="50" /> <input class="upload_image_button" id="_btn" type="button" value="Upload" />

                     client Description :
<textarea name="ourwork[%1$s][client-desc]" cols="75" rows="6" >%7$s</textarea>
                     %8$s
', $c, $track['thumb'], $track['client-img1'], $track['client-img2'] , $track['client-img3'] , $track['client-img4'], $track['client-desc'],  __( 'Remove Section' ) );                     $c = $c +1;                 }             }         }              ?>          <?php _e('Add Section'); ?>
<?php          }               /* When the post is saved, saves our custom data */     function dynamic_save_postdata( $post_id ) {         // verify if this is an auto save routine.         // If it is our form has not been submitted, so we dont want to do anything         if ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE )             return $post_id;              // verify this came from the our screen and with proper authorization,         // because save_post can be triggered at other times         if ( !isset( $_POST['dynamicMeta_noncename'] ) )             return;              if ( !wp_verify_nonce( $_POST['dynamicMeta_noncename'], plugin_basename( __FILE__ ) ) )             return;              // OK, we're authenticated: we need to find and save the data              $ourwork = $_POST['ourwork'];              update_post_meta($post_id,'ourwork',$ourwork);     }


title: Prevent users from adding taxonomy terms

text: I'm trying to prevent people from adding terms to some, but not all of my taxonomies. There are four taxonomies in a certain post type. I need to prevent people from adding to two of those. I used jQuery to prevent people from adding them on the taxonomy page, but I'm having trouble with the new post/edit post page. I can't just hide the box, because I need them to be able to search and select from existing items. I don't know if jQuery will do the trick, because I'd like that input box to still be available for searching for existing terms. So, does anyone know if this is possible?


title: Split a database will improve performance?

text: Hi to all I'm running a Wordpress MS installation and I would like to move a couple of heavy "sub" blogs on a different DB, will it encrease my performances? Actually I'm on a dedicated server with quadcore 2.5 Ghz, 6GB ram and a few nice stuff like Lightspeed eaccelerator and so on. I'm a "self made webmaster" so I need an easy to follow guide that can teach me how to split safely my DB and improve my performance. Thank you very much for this! (just read: Split WP install between 2 databases? is this the only solution available or there is an easier one?)


title: Created custom post type but selected template not staying selected

text: I have registered a new post type called Resources. I specify 'page- attributes' as a supported feature. When I go to create a new Resource post I see under Template that I can pick from a number of custom templates I have defined. But after I choose this and click update the setting isn't saved and the template isn't used. Any ideas?               function create_post_type() {     register_post_type( 'foo_resources',         array(             'labels' => array(                 'name' => __( 'Resources' ),                 'singular_name' => __( 'Resource' )             ),         'public' => true,         'has_archive' => true,         'hierarchical' => true,         'show_ui' => true,         'show_in_menu' => true,         'menu_position' => 5,            'supports' => array('title','editor','author','page-attributes'),         'rewrite' => array(             'slug' => 'resources',             'with_front' => false         ),               )     );      }


title: Setting a post's category

text: I'm creating new categories with **galleries** taxonomy :               $wpdb->insert("wpem_terms", array(         'name'=>'Custom Category',         'slug'=>'customcategory',         'term_group'=>0,     ));          //id of term     $id = $wpdb->insert_id;          $wpdb->insert("wpem_term_taxonomy", array(         'term_id'=>$id,         'taxonomy'=>'galleries',         'description'=>'',         'parent'=>'',         'count'=>'',     ));      It's working. And then i'm trying to publish a new post with this newly created category :               wp_insert_post(array(         'post_author'=>1,         'post_date'=>date('Y-m-d H:i:s'),         'post_date_gmt'=>date('Y-m-d H:i:s'),         'post_content'=>'',         'post_title'=>'',         'post_excerpt'=>'',         'post_status'=>'publish',         'comment_status'=>'closed',         'post_name'=>'',         'post_parent'=>0,         'post_type'=>'portfolio', // with 'portfolio' custom post type         'post_category'=>array($id),          ));      This is publishing post , it's OK but post's category isn't **Custom Category** . I think this line invalid :               'post_category'=>array($id),      Any ideas? Also i tried this :               'post_category'=>array(get_cat_ID("Custom Category")),


title: working with result of wp_dropdown_pages()

text: With `wp_dropdown_pages();` it's able to make a dropdown list with the pages of the blog. How can I work with this function? I want to get a specific custom field of the "dropdown-selected page". Don't know the way so solve this problem.


title: Export SQL query based on post type

text: I'm looking to export only wp_posts where post_type = post. Is that possible?


title: Custom Select Query - Selecting the Year?

text: I have a query were I'm grabbing all post types of "news" in 2010, but it doesn't select the posts from that year. What am I doing wrong?               $querystr = "         SELECT $wpdb->posts.*         FROM $wpdb->posts, $wpdb->postmeta         WHERE $wpdb->posts.ID = $wpdb->postmeta.post_id         AND $wpdb->posts.post_status = 'publish'         AND $wpdb->posts.post_type = 'news'         AND year($wpdb->posts.post_date) = 2010,         ORDER BY $wpdb->posts.post_date DESC      ";      Taking this line out does fetch the news posts, but really I want them from a particular year.               AND year($wpdb->posts.post_date) = 2010,


title: How to apply style to the body tag of a particular page?

text: I have the following code:               <?php      if ((is_home()) OR (!is_single()) OR (!is_page('171'))) : ?>         <body>     <?php else: ?>         <body class="last-page">     <?php endif; ?>      However it doesn't seem to work as expected. I want the class "last-page" to be applied to the body of the page with the id of 171 and pages that display single posts. If I take the third condition out, the "last-page" class is applied correctly to single post pages but with the third condition there it doesn't get applied to any of the two. I want the "last-page" class to be applied to both single post pages and page 171. Appreciate the help.


title: Instructions/Rules Inside Text Area

text: I know it is possible to change the "Enter Title Here". But is there’s a function to add text (“how to...”, “simple rules to post...”) inside the post text/input area! Any help?


title: how can I make $ work in wordpress for jQuery?

text: I have a plugin I want to use, but it depends on the $ identifier, as apposed to using jQuery. Is it possible to enable the $, to save me recoding the plugin? **EDIT** The plugin automatically adds the javascript, therefore I can't wrap it.


Recently I notice a tip on my site 008soft.com at the bottom of the source code:               <!-- This site is patched which an important unfixed problem since WordPress 2.5+ to 3.9+ -->      ![enter image description here](http://i.stack.imgur.com/XIA8h.gif) I do not know what causes it, and it is my first time encountered such a problem I have not got a clue, and I do not know how to get started, please help me and thx a lot


title: get all tags from category

text: i'm displaying all posts by category in my template and i was wondering: is it possible to get a list of all tags used by that category? i only found out how to make a tag-dropdown but it's from all articles, i couldn't find out yet how to filter it by category - any ideas? here's the link http://wphacks.com/how-to-display-wordpress-tags-dropdown- menu/ thx in advance


title: Modify CSS via Theme Control Panel

text: Hi to all I'm trying to create an advanced control panel for my first Wordpress template but I'm not able to add a function that I will need. The function that I'm trying to add is the possibility to choose the position of a DIV (left and bottom) via Admin Panel. (Apologize me for my really bad english) Here is the code I have in my functions.php               $shortname = appacqua     array( "name" => "Point on the map",         "type" => "section"),     array( "type" => "open"),     array(  "name" => "Have I to activate zona 1?",             "desc" => "Select if you want to show the first zone",             "id" => $shortname."_zona1c",             "type" => "checkbox",             "std" => "false"),     array( "name" => "Zona 1",         "desc" => "Choose the position",         "id" => $shortname."_zona1x",         "type" => "text",         "std" => "Left:???"),     array( "type" => "close"),      I can see "box" in my Admin Panel and I have no problems with Checkbox, if I echo $shortname."_zona1x" It shows the number, the only problem I have is when I try to add this to my style.css:               .zona1{width:27px;height:27px;background:url(icone/1.png) no-repeat;position:absolute;bottom:0;left:<?php echo $appacqua_zona1x;?>px;}      It doesn't work... If I use Google Chrome to Ispect the element it gives me something like this:               width: 27px;     height: 27px;     background: url(icone/1.png) no-repeat;     position: absolute;     bottom: 0;     left: <?php echo $appacqua_zona1x;?>px;      What am I doing wrong? Thank you very much for you help. Do you know if there is a way to create also a preview of this modification INSIDE the control panel (like inside an iFrame or stuff like this). Let's say that I'm a "self-made programmer" :P so please write "slowly" (lol) and be kind with me, thank you a lot!


title: No input file specified after enabling multi site

text: I am getting this error after enabling Multisite "No input file specified.", I can't find a solution in the internet, I hope you can help me. I have this in my htacces               RewriteEngine On     RewriteBase /     RewriteRule ^index\.php$ - [L]          # add a trailing slash to /wp-admin     RewriteRule ^wp-admin$ wp-admin/ [R=301,L]          RewriteCond %{REQUEST_FILENAME} -f [OR]     RewriteCond %{REQUEST_FILENAME} -d     RewriteRule ^ - [L]     RewriteRule ^(wp-(content|admin|includes).*) $1 [L]     RewriteRule ^(.*\.php)$ $1 [L]     RewriteRule . index.php [L]      and on my wp-config.php               define('WP_ALLOW_MULTISITE', true);     define('MULTISITE', true);     define('SUBDOMAIN_INSTALL', true);     define('DOMAIN_CURRENT_SITE', 'testdomainforrevol8.dk');     define('PATH_CURRENT_SITE', '/');     define('SITE_ID_CURRENT_SITE', 1);     define('BLOG_ID_CURRENT_SITE', 1);      Here's my website


title: I get 404 when I try to login ever since I changed the permalink

text: This is the website This is what the login http://wayfaroutadventures.com/blog/wp- admin/&reauth=1">looks like now Basically here's what happened: I had `www.mysite.com/blog` as the permalink instead of `www.mysite.com`, and `/blog` wouldn't go away. So then I changed it so it was `.com` without blog and it not won't let me login or anything, gives me a 404. I'm scared because I think I seriously screwed up and I don't know how to fix it! How do I get it so I can login again. I don't even care if its `/blog` anymore. I just want my site back.


title: How customizable is a self-hosted WordPress blog compared to a Blogger blog?

text: I currently have a **Blogspot** blog and I'm thinking of making the leap to a _self-hosted_ **WordPress** one instead. Everything I've seems to suggest this is the best way to go for the best possible experience, but main concern is customizability. I've messed around with a few Blogspot blogs and I know that you're given pretty much full access in terms of changing the look of your blog. I can get in there pretty "deep" and do whatever I like. When I've read about WordPress, though, a lot of people complain about the lack of customization. Is this true? Are they getting confused with the non- self-hosted version? Just how much visual customization will I get in a _self- hosted_ WP blog? I'd really like to know that I have full control over how things look before I take the plunge! Thanks a for any help.


title: Custom Post Type Images on Pages

text:
how would I go about displaying Custom Post type Titles and or Images from all custom post types in a template (they would also need to link respectively.) Thanks! Here is what I have so far. > >     $args = array( 'posts_per_page' => 115, 'offset'=> 1, 'category' => > "post-formats" ); >   >     $myposts = get_posts( $args ); >     foreach ( $myposts as $post ) : setup_postdata( $post ); ?> >
 >           <a href="<?php the_permalink(); ?>"><?php the_title(); ?><?php > echo get_the_post_thumbnail($thumbnail->ID, 'thumbnail'); ?> >
 >     <?php endforeach; >     wp_reset_postdata(); >   >
 >


title: Get current menu_order

text: WordPress implements a simple order functionality by default. What's the common method, to retrieve the `menu_order` for the current post or page?


title: Relationship with 2 custom post types

text: i want to relation to custom post types. I register post types with this code               add_action('init', function(){          $args = array(       'public'             => true,       'query_var'          => true,       'rewrite'            => array( 'slug' => '/' ),       'supports'           => array( 'title', 'excerpt'),       'query_var'          => true,       'label'              => 'Series'     );     register_post_type('series', $args);          $args = array(       'public'             => true,       'query_var'          => true,       'rewrite'            => array( 'slug' => '%series%', 'with_front' => false ),       'supports'           => array( 'title', 'excerpt'),       'query_var'          => true,       'label'              => 'Episode'     );          register_post_type('episodes', $args);          });      I have a serie named "Game of Thrones" it's work like this > http://wordpress.dev:8888/game-of-thrones Also i have a episode named "Test", and i want to relation like this > http://wordpress.dev:8888/game-of-thrones/test How can i do this? Thank you, and sorry for my bad english :)


title: Gallery image archive page

text: I need to create an image gallery archive page. Actually I need something like where user will be able to create an image gallery with a few images and with a title through admin panel. The gallery image archive will just show only one image with the gallery title. Please consider that an user is going to create galleries randomly, so at least 10 galleries will be shown from the user's latest created gallery. The other 10 galleries will be be shown by date like today's gallery, 14 July, 12 July etc. How can I achieve this? Any suggestions?


title: Select column name dynamically mySQL Query

text: $country="USA";     $dr=$wpdb->get_results("SELECT $country FROM wp_shipping WHERE ID=$ids");      I want the above query in WordPress file, where country name is given dynamically but I am not getting how to do this. When I execute the above query, the result is nothing.


title: How to create a profile page for users?

text: Is there way to create a profile page for all users( including who have not written any post)? Ex1: example.com/profile/alex >> ex2: example.com/profile/john I need to do something like this.


title: Can't use get_option function in PHP file located inside plugin folder

text: I am currently developing a small plugin which queries an API for some XML data. The XML data is then used to display a page. I wanted to do most of the display and formatting related stuff in client-side Javascript, because it was what I was comfortable with, but because the API was on another server, I was receiving _Not Same Origin_ errors. So I decided to create a PHP file (a "wrapper" for the API) in my plugin's directory which requests the data, and then echos the result. Then all I had to do was request the PHP file from inside the Javascript file, and I got access to the XML data without having the Same Origin policy causing errors. This all worked fine, but recently I've been working towards making the plugin not hard-coded with our API auth key, but instead use a Settings page. I set it up, and verified that all of the settings saved correctly. **The problem** I have is that my "API wrapper" PHP file does not know what the function get_options is (the error says it is "Not Defined"), and all the solutions I've read have suggested using include_once('wp-content/options.php), but that is also shooting out an error about not being able to find the file (Failed to Open Stream: No such file/directory). In summary, I need a way to access get_options from inside a PHP file which is inside my plugin's directory, but is NOT the main plugin file.


title: How Would You Enqueue A Google Web Font?

text: I'm using the Rosario font from the Google Web Fonts in my theme and I want to enqueue the font so that if there was ever a plugin that used a fancy font that there wouldn't be any conflicts or wasted bandwidth. I want to use the Normal 400, Normal 400 Italic, and Bold 700 in my theme. How should I enqueue the font? Is it worth including the last font variant in case the other script uses it? Several options I've been thinking about:   * Single              wp_register_style( 'rosario', "http://..." );        * Combined with Handle              wp_register_style( 'rosario_400_400-italic_700', "http://..." );        * ALL together              wp_register_style( 'rosario_400', "http://..." );     wp_register_style( 'rosario_400-italic', "http://..." );     wp_register_style( 'rosario_700', "http://..." );`      The third option looks the most explicit and but the multiple calls for same font will probably be more inefficient than simply loading the font twice. Thoughts?


title: List a custom taxonomy's terms, with links, on the taxonomy page

text: I have registered a custom post type in my functions.php file for "Wines", with this code:               function customposttype_wines() {          $labels = array(         'name'                => 'Wines',         'singular_name'       => 'Wine',         'menu_name'           => 'Wines',         'parent_item_colon'   => 'Parent Wine',         'all_items'           => 'All Wines',         'view_item'           => 'View Wine',         'add_new_item'        => 'Add New Wine',         'add_new'             => '+',         'edit_item'           => 'Edit Wine',         'update_item'         => 'Update Wine',         'search_items'        => 'Search Wines',         'not_found'           => 'No Wines found',         'not_found_in_trash'  => 'No Wines found in Trash',     );     $args = array(         'label'               => 'wines',         'description'         => 'Wine Reviews',         'labels'              => $labels,         'supports'            => array( 'title', ),         'unset'            => array ('date'),         'hierarchical'        => false,         'public'              => true,         'show_ui'             => true,         'show_in_menu'        => true,         'show_in_nav_menus'   => true,         'show_in_admin_bar'   => true,         'menu_position'       => 5,         'can_export'          => true,         'has_archive'         => true,         'exclude_from_search' => false,         'publicly_queryable'  => true,         'capability_type'     => 'post',     );     register_post_type(                      'wines',                     $args                      );          }     add_action( 'init', 'customposttype_wines', 0 );      And registered 9 custom taxonomies (brand, region, grape, etc.) with this code (repeated 9 times with only the `<XXX>` changing for each):               function customtaxonomy_<XXX> ()  {          $labels = array(         'name'                       => '<XXX>',         'singular_name'              => '<XXX>',         'menu_name'                  => '<XXX>s',         'all_items'                  => 'All <XXX>s',         'parent_item'                => 'Parent <XXX>',         'parent_item_colon'          => 'Parent <XXX>:',         'new_item_name'              => 'New <XXX> Name',         'add_new_item'               => 'Add New <XXX>',         'edit_item'                  => 'Edit <XXX>',         'update_item'                => 'Update <XXX>',         'separate_items_with_commas' => 'Separate <XXX>s w/commas',         'search_items'               => 'Search <XXX>s',         'add_or_remove_items'        => 'Add or Remove <XXX>s',         'choose_from_most_used'      => 'Choose from the most used <XXX>s',     );     $args = array(         'labels'                     => $labels,         'hierarchical'               => true,         'public'                     => true,         'show_ui'                    => true,         'show_admin_column'          => true,         'show_in_nav_menus'          => true,         'show_tagcloud'              => true,         'query_var'                  => true,     );     register_taxonomy(          '<XXX>s',         'wines',         $args      );     }     add_action( 'init', 'customtaxonomy_<XXX>', 0 );      Now I am trying to display the lists of custom taxonomy terms on the parent page of each, so when visiting www.mywebsite.com/wines/`<XXX>` there is a list, with links, to all the terms that have been entered. Right now when I visit www.mywebsite.com/wines/`<XXX>` I just see the 404.php error page. But if I visit a taxonomy term page I see the posts within there fine, ie: www.mywebsite.com/wines/`<XXX>`/term I tried using a taxonomy template hierarchy page, `taxonomy-<XXX>.php` but it will not load, still just shows the 404.php. Pulling hair here, any help is very appreciated.


title: Mixing custom post type and taxonomy rewrite structures?

text: Basically I want to achieve a glossary using custom post types and have some issues setting up rewrites the way I want them to be. I want it like that: The main glossary URL: `http://example.com/glossary/` Glossary terms starting with letter **A** : `http://example.com/glossary/a/` The URL for a single glossary term: `http://example.com/glossary/a/atomic/` I actually achieved this using the code below but I'm sure that it's a very awkward way to do it and I know it's malfunctioning somewhere as the wrong templates are called when viewing the pages. Except for http://example.com/glossary/, where archive-sumo-glossary-term.php gets called as expected, the other two just activate index.php in my theme. Here goes (`functions.php` in the theme):               add_action('init', 'create_glossary');     function create_glossary()     {         register_post_type         (             'sumo-glossary-term',             array             (                 'labels' => array                 (                     'name' => _x('Glossary Terms', 'post type general name'),                     'singular_name' => _x('Glossary Term', 'post type singular name')                     # And so on …                 ),                 'supports' => array('title', 'editor', 'thumbnail'),                 'public' => true,                 'rewrite' => array                 (                     'slug' => 'glossary',                     'with_front' => false                      ),                 'query_var' => 'glossary-term',                 'has_archive' => true             )         );              register_taxonomy         (             'sumo-glossary-letter',             'sumo-glossary-term',             array             (                 'hierarchical' => true,                 'labels' => array                 (                     'name' => _x('Letters', 'taxonomy general name'),                     'singular_name' => _x('Letter', 'taxonomy singular name')                     # And so one                 ),                 'show_ui' => true,                 'query_var' => 'glossary-letter',                 'rewrite' => false             )         );     }          add_filter('post_type_link', 'glossary_term_permalink', 10, 4);     function glossary_term_permalink($post_link, $post, $leavename, $sample)     {         if ($post->post_type == 'sumo-glossary-term')         {             $permalink = str_replace('glossary/', 'glossary/' . $post->post_name[0] . '/', $post_link);         }         return $permalink;     }          add_rewrite_rule('^glossary/([^/]*)?$','index.php?glossary-letter=$matches[1]','top');     add_rewrite_rule('^glossary/([^/]*)/([^/]*)?$','index.php?glossary-term=$matches[2]','top');


title: Constructing a Pay to Download music website with wordpress

text: Hi i searched the complete archive of wordpress plugins but couldn't find the right plugin to enable Paid downloads. The website is just a Pay to download "Full Music" site. Visitor is provided with a sample music to hear and if he decides to download the music he should pay to dowload via Payment gateway like Paypal, Alertpay etc. I would love to hear from your experiences and thoughts about this


title: How can I detemine the parameters needed by the_widget()?

text: I'm working with an old (now unmaintained) widget, which only allows one instance. Since I want to have a different sidebar on the homepage and I want this widget on both sidebars, I figure I need to do one of two things:   1. Update the plugin to use the new widget API   2. Use `the_widget()` to manually drop the widget into the custom sidebar I've opted to do the latter as a quick fix, but can't figure out the parameters needed to get it to display. Any suggestions would be greatly appreciated.


title: Is there a Twitter Wordpress plugin that changes https to http?

text: I log in and do all the administration over https in my wordpress blog (my own installation). When I publish something, I have the problem that the twitter plugins normally pick the current URL, with https:// instead of http:// (I'm currently using WP->Twitter). When accessed over https:// my page issues some warning and the disqus comments don't work. I really don't care because I should be the only one using https for my blog, but due to the twitter plug in, everybody sees it broken. Is there some other plug in that solves that? Or some other way to do it?


title: Default Permalink Structure for Pages

text: I'm trying to figure out a permalink structure for my pages (not posts) in Wordpress. Right now, I can add a "Category Base" for posts... so, something like www.mysite.com/categorybase/post1/ or www.mysite.com/categorybase/post2/ But, if I wanted to do something similar for pages, how would I do that? For example, www.mysite.com/pagebase/page1/ or www.mysite.com/pagebase/page2/ Anyone tried this before?


title: Send automatic mail to Admin when user/member changes/adds profile

text: Is there a way to send the updated/added values from profile, when a member/user updates his/hers data, to the admin of the site or another emailadress? Can this be the first step?               /* do something when user edits profile */     add_action('personal_options_update', 'notify_admin_on_update');     function notify_admin_on_update(){       // send a mail with the updated values to admin@mysite.com       exit;     }      What is best pracice to send emails from within WordPress?


title: How to find out who handles a permalink?

text: My previous question isn't faring too well. I guess it may be too specific. Let me approach the problem from another direction. There's an URL within my Wordpress site. It's occupied - sending the visitor to some resource. How can I identify the type of resource is associated with this URL, and then find the actual resource - page, category, post, whatever else might be holding up that URL? The link is not specific, no `/tag/`, `/category/` or such on the path. It's probably a custom permalink attached to some entity. I need to find that entity.


title: Editing URL character replacement

text: Whereabouts can I edit which characters in permalinks are replaced? For example apostrophe's are replaced with nothing, and I would like to have them replaced with hyphens instead. Thanks.


title: Cannot Use is_single() and is_admin in functions.php

text: I'm using a Thematic childtheme for my wordpress website, and instead of putting all my functions into the functions.php file, I thought I make it more organised by creating multiple other function files (admin_functions.php, single_functions.php ...) and included these files in my childtheme's functions.php file as follows:               require_once ('my-functions/admin-functions.php');     require_once ('my-functions/single-functions.php');      This works perfectly fine. However, I'm trying to make wordpress load only the needed files by using the conditional tags as follows:               if(is_admin())        require_once ('my-functions/admin-functions.php');     elseif(is_single())        require_once ('my-functions/single-functions.php');      and this just won't work. I can't seem to find a reason why. I thought that maybe there are some wordpress functions that must be called first before the conditional functions (is_single and is_admin) are usable. I can't seem to get anywhere though. Any help is most appreciated. Thanks


title: How can I edit the 'Most Used' tab in the categories meta-box to show another custom taxonomy?

text: The 'Most Used' tab in the categories meta-box is the one that can be seen in the Edit Post section. I want to replace the Most Used tab, with a tab that lists another Custom Taxonomy, or edit the existing tab to display the Custom Taxonomy. I have already created my custom taxonomy, and have spent a lot of time trying to modify this little section in wp-admin/includes/meta-boxes.php that pertains to wordpress' meta-boxes, and can be found at https://developer.wordpress.org/reference/functions/post_categories_meta_box/, and I have gathered that I need to make a change at line 440 where               $popular_ids = wp_popular_terms_checklist($taxonomy);      I suppose I might have to change $taxonomy to something else, possibly the custom taxonomy that I have created, but I am clueless about the syntax or the variable that might replace it. Any help would be appreciated, even something that might point me into the right direction.


title: Rewrite url for custom post type not working

text: I have a Custom Post Type and i want to rewrite the URL. nothing is working though. This is the adress i have now /?portfolio=adidas. When I rewrite the numerous ways i tried i always get this instead: feeds/active/ which seems to be a template for blogs in my theme. I think this can be due to me using the wp rss aggregator to pull rss feeds, who i call with a shortcode in my custom post, but seems to be stored somehow with the url Feeds/post_slug, and this is where i get directed. How can I change this? Tried pretty much every plugin on the market and all the code snippets i can found.. The custom post type is registered in my theme, and not in the functions. This is the code for that:               $args = array(     "singular_label"                => __("Portfolio Category", "swiftframework"),      'public'                        => true,     'hierarchical'                  => true,     'show_ui'                       => true,     'show_in_nav_menus'             => false,     'args'                          => array( 'orderby' => 'term_order' ),     'rewrite' => array('slug'=>'','with_front'=>false),     'query_var'                     => true     );          register_taxonomy( 'portfolio-category', 'portfolio', $args );               add_action('init', 'portfolio_register');            function portfolio_register() {            $labels = array(         'name' => _x('Portfolio', 'post type general name', "swiftframework"),         'singular_name' => _x('Portfolio Item', 'post type singular name', "swiftframework"),         'add_new' => _x('Add New', 'portfolio item', "swiftframework"),         'add_new_item' => __('Add New Portfolio Item', "swiftframework"),         'edit_item' => __('Edit Portfolio Item', "swiftframework"),         'new_item' => __('New Portfolio Item', "swiftframework"),         'view_item' => __('View Portfolio Item', "swiftframework"),         'search_items' => __('Search Portfolio', "swiftframework"),         'not_found' =>  __('No portfolio items have been added yet', "swiftframework"),         'not_found_in_trash' => __('Nothing found in Trash', "swiftframework"),         'parent_item_colon' => ''          );          $args = array(           'labels' => $labels,           'public' => true,           'show_ui' => true,         'show_in_menu' => true,         'show_in_nav_menus' => false,         'menu_icon' => 'dashicons-format-image',     'rewrite' => array('slug'=>'','with_front'=>false),         'supports' => array('title', 'editor', 'thumbnail'),         'has_archive' => true,         'taxonomies' => array('portfolio-category')             );            register_post_type( 'portfolio' , $args );       }            add_filter("manage_edit-portfolio_columns", "portfolio_edit_columns");             function portfolio_edit_columns($columns){           $columns = array(               "cb" => "<input type=\"checkbox\" />",               "title" => "Portfolio Item",             "description" => "Description",             "portfolio-category" => "Categories"           );                return $columns;          }               add_action("manage_posts_custom_column",  "portfolio_custom_columns");              function portfolio_custom_columns($column){           global $post;           switch ($column)           {               case "description":                   the_excerpt();                   break;             case "portfolio-category":                 echo get_the_term_list($post->ID, 'portfolio-category', '', ',,'');                 break;         }       }


title: Not able to export large no. of posts in csv

text: I have custom post type `product` like wp ecommerce. There are 30k posts in it. Also have relate custom taxonomy. Basically am trying to export those posts in csv, but query_posts with so many records is giving me trouble... Any tips???


title: Migrating a website using custom image tags to use featured images instead

text: I have a site that was built using a Wordpress 2.x era theme that uses a custom field "image" to hold the URL to use as a featured image for each post. I am migrating to use the PageLines Platform Pro theme, which uses the now standard Featured Images feature - and I am looking for a way to automatically migrate the thousands of old posts to work with this new theme without losing their featured image. This other similar Stack Exchange question has an accepted answer that solves this problems by using the Get The Image plugin to fall back to a custom field if there is not a featured image set. The problem with Get The Image however is that it requires modifying the theme to add a function call. This will break with every upgrade to PageLines, and makes it harder to change themes in the future. I am looking for a way to do a one-time migration, but I haven't found any simple instructions how to manage this. Any ideas?? UPDATE: This tutorial seems to indicate one way to do this: http://pmg.co/migrating-post-thumbnails-on-old-wordpress-themes Is this the best way? Are there any other techniques I should pursue?


title: Get all categories and posts in those categories

text: I am looking for a solution that allows me to print the following:               Cat 1        Cat 2        Cat 3      Post 1       Post 1       Post 1      Post 2       Post 2       Post 2      Post 3                    Post 3                                Post 4      **EDIT** I am looking for something that will only require _one_ database query! So if you have a `foreach` in your code followed by a `new WP_Query` then that is not what I am looking for (I am planning to put this onto my website's homepage).


title: Pagination for sub-pages

text: I have a top level page with a lot of subpages.   When a user visits the top level page they currently see the titles/thumbnails/excerpts of **all** of the subpages.   How can I paginate the display of the subpages so that **only** 3 are displayed at a time, giving the user the ability to navigate via the typcial "< Previous 1,2,3,4,5 Next >" pagination menu? Any help would be greatly appreciated. Thanks!


title: Pagination Help on Crazy Custom Authors Page

text: I've got a custom authors page for a multi-author blog. http://blog.securitytechnologies.com/meet-the-team/ Here's the code I'm using to generate the page (thanks to other folks in the support forums for providing it):               <?php     $excluded = "1,2,3,7,20,21";  // To exclude external admin author IDs     $sql = "SELECT DISTINCT post_author, umeta.meta_value as last_name     FROM $wpdb->posts     JOIN $wpdb->usermeta umeta ON ($wpdb->posts.post_author = umeta.user_id     AND umeta.meta_key = 'last_name')     WHERE post_author NOT IN ($excluded)     AND post_status = 'publish'     AND post_type = 'post'     ORDER BY last_name, post_author     ";     $authors = $wpdb->get_results($sql);         if($authors):     foreach($authors as $author):     ?>          What I can't figure out is how to set a maximum number of authors per page and paginate. I've got WP-PageNavi installed, but I'm not having any luck implementing it here on a custom template page. Thanks in advance.


title: How do I get thumbnail generator to recognize the_permalink tag?

text:
Help! I am trying to create a Digg-clone by integrating "BM Shots" (a webpage thumbnail generator) with "Recommended Links" (a social voting plug-in for Wordpress). Recommended Links allows for user submitted URLs to be displayed via "the_permalink" tag. I'm trying to use BM Shots to generate web page thumbnails based on user submitted URLs. BM Shots work just fine, but I can't get BM Shots to recognize "the_permalink". The default usage of BM Shots looks like this...                           <?php                 $url = 'http://www.binarymoon.co.uk/';                 $width = 300;                 echo bm_mshot ($url, $width);                 ?>      But I want it to work like this...                           <?php                 $url = the_permalink;                 $width = 300;                 echo bm_mshot ($url, $width);                 ?>      I'm able to get it to work with other Wordpress tags, which is useless, but not "the_permalink." I'm not a coder, so I could use some suggestions, even if they seem obvious. EDIT// Here is what the loop looks like                           global $wp_query;                 $plugin_settings = get_option( 'reclinks_plugin_settings' );                 $start =  ( $wp_query->query_vars['paged'] ) ?                  ( ( $wp_query->query_vars['paged'] -1 ) * $wp_query->query_vars['posts_per_page'] + 1) : 1;                 ?>                 <?php if ( have_posts() ) : ?>                 <ol style="list-style-type:none; margin-left:-22px;" start="<?php echo $start; ?>">                 <?php while ( have_posts() ) : the_post(); ?>
                 <img src="<?php                 $url = the_permalink;                 $width = 300;                 echo bm_mshot ($url, $width);                 ?>" width="100"  style="float:left;">
<a href="<?php the_permalink(); ?>"><?php the_title(); ?>
                  <?php reclinks_favicon(); ?> <?php reclinks_domain(); ?>
<?php reclinks_votebox(); ?>
                 <?php endwhile; ?>
                 <?php else : ?>
<?php _e( 'No recommended links yet. Add one?', 'gad_reclinks' ); ?>
                 <?php endif; ?>        * http://wordpress.org/extend/plugins/recommended-links/   * http://www.binarymoon.co.uk/projects/bm-shots-automated-screenshots-website/


title: How to create a Wordpress options page

text:
I've followed this guide precisely: http://codex.wordpress.org/Creating_Options_Pages However when I do `do_settings_fields`, it says: `Missing argument 2 for do_settings_fields()` Even though it says to put only one argument in there. Strangely, the example given on that very same page says to use `do_settings()` \- which appears to not even be a function! Something tells me I need to create a 'section' as described here: http://codex.wordpress.org/Function_Reference/add_settings_section But I'd rather find a quick fix for what I've already done. :) **EDIT** I've been messing around with it for the past hour, and discovered several wordpress functions which apparently don't exist.. This is my latest code, which doesn't give me an errors, but also doesn't do anything apart from register the menu page:               <?php     // Register the menu     add_action('admin_menu', 'bang_menu');     function bang_menu() {         add_menu_page( 'BANG! Dashboard', 'BANG!', 'administrator', 'bang-admin', 'bang_dashboard');     }          // Register settings     add_action('admin_init', 'bang_settings');       function bang_settings() {     register_setting( 'bang-options-group', 'joinform_api_url' ); // Register the setting     add_settings_section( 'bang_section', 'Joinform configuration', null, 'section_options_page_type' ); // Register the section     add_settings_field( 'api_url', 'API URL', 'field_joinform_api_url', 'section_options_page_type', 'bang_section' ); // Define callback function for setting     }               function field_joinform_api_url() {         echo 'field here...';     }               function bang_dashboard() {              echo '

Joinform configuration
                          <form action="options.php" method="post">';                     settings_fields( 'bang-options-group' );                     do_settings_sections( 'bang_section');     etc...


title: How to remove the RichText Meta Box

text: How can I remove the rich text box editor in WordPress? I have used the `remove_meta_box` function specifying the boxes ID, but it does not work like it does for other core meta boxes: The code I tried:               function remove_rich_box()     {         remove_meta_box('postdivrich', 'client', 'normal');       }     add_action( 'do_meta_boxes', 'remove_rich_box' );      Where the second paratmeter "client" is my custom post type.


title: Images are not showing up in "Uploaded to this post"

text: I had to delete all my files of web site for some reasons. Then I've restored the files back to host. But the problem is that; Firstly, I uploaded all the images (about 4000) to upload folder via FTP. Then I realised that images are not showing up in media library. Than I used some plugins such as, Add from Server, Media Tools, but they coludnt operate all the files. I dont know why. Then I deleted all the files again and uploaded via Wordpress Library -> Add new. After uploading all images they showed up in media library BUT they are not attached to "Uploaded to this post" of posts. If anyone knows the solution, could you please help me about this. Thanks.


title: I keep getting logged out in Firefox

text: For some reason, tonight when I have gone to work on my Wordpress installation I firstly found myself logged out, even though there was a few cookies left in Firefox relating to the website and when I looked on the Simple:Press forum it had remembered my user name but knew I wasn't logged in. Nevertheless, I logged in again and it worked perfectly... until I navigate to a different page when it seems as though I never logged in; furthermore if I try to go directly to the Admin Dashboard from the page when it says I am logged in, it asks me to login again and the URL says `reauth=1` at the end. Strangely, this only occurs in Mozila Firefox and it works perfectly on the same computer using Internet Explorer! Also, I can recall me doing anything to the installation yesterday for it to invoke this kind of behaviour today! Any ideas would be much appreciated. Thanks In Advance.


title: Why are xmlrpc.php and wp-cron.php being called so often?

text: I'm running a Wordpress website and I have found from the server logs that xmlrpc.php and wp-cron.php are being requested (POST requests, of course) very frequently--including some suspicious ips that reek of malicious activity or attempts. My understanding is that xmlrpc.php provides an "API" for others to interact with the site. wp-cron.php is for periodic tasks. So why do I see so many requests that those pages? Are hackers looking for some kind of backdoor or security hole?


title: Custom Post Type UI

text: I'm using the plugin custom post type ui to create a post type says movie. Everything is ok. I create a movie and its viewable at               http://localhost/wordpress/movies/test/      however, when i go on http://localhost/wordpress/movies/ I was expecting to see test as a movie in all the list of movies but nothing is displayed Code generated by the plugin:               register_post_type('movies', array(         'label' => 'Movies',         'description' => '',         'public' => true,         'show_ui' => true,         'show_in_menu' => true,         'capability_type' => 'post',         'hierarchical' => false,         'rewrite' => array('slug' => ''),         'query_var' => true,         'supports' => array(                 'title','editor','excerpt','trackbacks',                 'custom-fields','comments','revisions','thumbnail','author',                 'page-attributes',),         'taxonomies' => array('category','post_tag',),         'labels' => array (               'name' => 'Movies',               'singular_name' => 'Movie',               'menu_name' => 'Movies',               'add_new' => 'Add Movie',               'add_new_item' => 'Add New Movie',               'edit' => 'Edit',               'edit_item' => 'Edit Movie',               'new_item' => 'New Movie',               'view' => 'View Movie',               'view_item' => 'View Movie',               'search_items' => 'Search Movies',               'not_found' => 'No Movies Found',               'not_found_in_trash' => 'No Movies Found in Trash',               'parent' => 'Parent Movie',     ),) );


title: Best way to insert something directly after <head>

text: Could someone perhaps tell if it would be possible to insert -in this case- a `<script></script>` directly after `<head>`, but before:               <script type="text/javascript">     addLoadEvent = function(func){if(typeof jQuery!="undefined")jQuery(document).ready(func);else if(typeof wpOnload!='function'){wpOnload=func;}else{var oldonload=wpOnload;wpOnload=function(){oldonload();func();}}};     var userSettings = {             'url': '/html5/',             'uid': '1',             'time':'1332528635'         },         ajaxurl = '/html5/wp-admin/admin-ajax.php',         pagenow = 'dashboard',         typenow = '',         adminpage = 'index-php',         thousandsSeparator = '.',         decimalPoint = ',',         isRtl = 0;     </script>


title: PHP Template way of coding for wordpress theme development

text:
here is the simple PHP template system i have found The Class (template.class.php)                        <?              class Template {              public $template;              function load($filepath) {               $this->template = file_get_contents($filepath);               }              function replace($var, $content) {               $this->template = str_replace("#$var#", $content, $this->template);              }              function publish() {               eval("?>".$this->template."<?");                }               }              ?>      The Template File (design.html) This file will contain the design of your web site and the blank fields that will be merged with content data.                                                              <title>#title#</title>
Hello #name#!

The time is: #datetime#
               <? echo "
Embedded PHP works too!
"; ?>                                   Usage (index.php) Now we will create a script that load the template and use the class to merge the data.                      <?             include "template.class.php";                  $template = new Template;             $template->load("design.html");             $template->replace("title", "My Template Class");             $template->replace("name", "William");             $template->replace("datetime", date("m/d/y"));             $template->publish();              ?>      Now for a simple wordpress post loop index.php                          <?php               get_header();             if (have_posts()) :              while (have_posts()) :              the_post();                the_content();               endwhile;               endif;                    ?>      Question is, how to use above wordpress loop and the top PHP template system together, this is to convert an html template into a wordpress theme.


title: Passing custom args in paginate_links

text: For example i've `domain.com/about?project=1` but i've permalinks enabled and i'm using thins to generate the pagination paginate_links. The proble is that the links generated are like this `domain.com/about?project=1/page/1` and it breaks everything because the project is taken as `1/page/1` There is a way to get `domain.com/about/project/1/page/1` in the paginations links? I'm submitting that from a form using get to display the project.


title: Broken markup when using the_excerpt() in a widget?

text:
The text returned by the_excerpt() does not respect my widget format. I couldn't explain it better so I will just show you my code:               function widget($args, $options) {         extract($args);              $post_type = $options['post_type'];         $num_of_posts = $options['limit'];              // Create a new instance         $second_query = new WP_Query( array(                             'post_type' => "$post_type",                             'posts_per_page' => "$num_of_posts",                             'post_status' => 'publish',                         ) );               // The Loop         if ($second_query->have_posts()) :           while( $second_query->have_posts() ) : $second_query->the_post();               $byh_content .= "
" . the_excerpt() . "
";           endwhile; else :               $byh_content = "
No " . $options['post_type'] . "s found.
";         endif;         wp_reset_postdata();              $title = "
" . $options['title'] . "
";         $content = $byh_content;              echo $before_widget.$title.$content.$after_widget;     }      The result isn't what I expected. Here's what it looks like when rendered: ![widget rendered](http://i.stack.imgur.com/KwfXJ.png) The title should be at the top. The reason is that, the excerpt isn't where it is supposed to be: ![enter image description here](http://i.stack.imgur.com/Ol8XO.png)


title: Migrating from metaboxes to wp_editor()

text: I got a client requirement where the editing facilities available in wordpress had to be available for content that was meant to be displayed on the sidebar of a particular post/page. The content to be displayed was implemented originally using metaboxes which contained a single textarea where content was input as raw HTML and did not have insert/upload facilities. I have decided to migrate this design to use `wp_editor()` as it gives all the wordpress native editing facilities (without using a metabox as it is not recommended). But I am not sure how to get the entered data and POST it to the backend and then tie into the following action to save the data: `add_action( 'save_post', 'save_sidebar_content' );` I was also using the following helper functions:               get_post_meta();     add_post_meta();     update_post_meta();     delete_post_meta();      I would like to know if there are any such functions to ease the CRUD operations related to this data when using wp_editor(). Thanks in advance. nav


title: Use one Wordpress database with multiple instances of one site

text: Is there a way to use the same database, tables and all, with two different domains? For example, two employees each have thier own subdomain to develop / test with, so there may be two instances of a site:               jack.example.com/test_blog/     jill.example.com/test_blog/      however, since the base url is stored in the database, it seems that it would require two distinct databases for this set up to work properly. Is there any way around this?


title: excluded_categories parameter in next_post_link() behaving unexpectedly

text: I have a Wordpress template with a single.php page. The page has "next" and "previous" arrows to allow navigating through all posts. I want to exclude posts from some categories from being included in the "next" and "previous" calculation. I have this code:                // in single.php      next_post_link( '%link', '← Previous', false, '11 and 13 and 15');       This should show the link to the next post. Posts in categories 11, 13, and 15 should not be considered as per the `$ignore_categories` parameter. This works for posts that have **only** one of the categories listed set, e.g. `15`. But posts that **additionally** have a non-excluded category (like `16` or `23`), do **not** get excluded and they show up as the next post link. Is this the intended behaviour? It doesn't seem to make sense to me. Is there anything I can do to change it so a post gets excluded whenever it has one of the excluded categories, short of rebuilding the entire functionality?


title: How to: Retrieve an attachment image from post and output it

text: If anyone can help me I would be gratefull! * * * I got a _gravity form_ with the post_type fields including the submit image when submited it displays the:   * title   * content    * image    * tags **So my question is:** When I go to single.php I posted a code: `get_related_author_posts();` which calls the authors last two posts in function.php. _Please take a look at the code, that contains/illustrates the problem:http://pastie.org/1926079_ * * * I need a little help from my friends the wordpress gurus :) Thank You all in advance. I'm still learning the more advanced functions but this is where I'm stuck:)


title: menu link to custom post_type?

text: is there a way to add a custom post_type (directors) link to a menu? I can add the individual director posts but not the link to all of them. I'd like to avoid using custom links as this will be used in several sites and not always at the root. (so making a default /directors/ wont always work). PLus i'd like it to behave like normal menu links when active etc. best, Dan.


title: Settings API erases itself?

text:
I have two forms created using Settings API, and when I save one of them the other one gets erased and vice versa. Here's the whole code so you could paste it into your functions.php file and see for yourself:               // Register settings     function registerSettings() {          register_setting('XX_theme_settings', 'XX_theme_settings' );          add_settings_section('theme_options', 'Theme Options', 'theme_options_generate', 'page1' );      add_settings_field( 'XX_Option1', 'Option 1', 'text_input', 'page1', 'theme_options', 'XX_Option1' );     add_settings_field( 'XX_Option2', 'Option 2', 'text_input', 'page1', 'theme_options', 'XX_Option2' );      add_settings_field( 'XX_Option3', 'Option 3', 'textarea', 'page1', 'theme_options', 'XX_Option3');       add_settings_field( 'XX_Option4', 'Option 4', 'textarea', 'page1', 'theme_options', 'XX_Option4');            add_settings_section('theme_options2', 'Theme Options2', 'theme_options_generate2', 'page2' );      add_settings_field( 'XX_Option5', 'Option 5', 'text_input', 'page2', 'theme_options2', 'XX_Option5' );     add_settings_field( 'XX_Option6', 'Option 6', 'text_input', 'page2', 'theme_options2', 'XX_Option6' );      add_settings_field( 'XX_Option7', 'Option 7', 'textarea', 'page2', 'theme_options2', 'XX_Option7');       add_settings_field( 'XX_Option8', 'Option 8', 'textarea', 'page2', 'theme_options2', 'XX_Option8');               };          add_action('admin_init', 'registerSettings');          //Generate section 1         function theme_options_generate() {          echo 'This is a Settings Section 1';      }     //Generate section 2     function theme_options_generate2() {          echo 'This is a Settings Section 2';      }          //Generate text input callback         function text_input($args) {         $options = get_option('XX_theme_settings');         echo "<input id=". $args ." name='XX_theme_settings[". $args ."]' size='40' type='text' value='{$options[$args]}' />";         }          //Generate textarea callback          function textarea($args) {         $options = get_option('XX_theme_settings');         echo "<textarea id=". $args ." name='XX_theme_settings[". $args ."]' rows='7' cols='50' type='textarea'>{$options[$args]}</textarea>";      }          //Add admin pages     function registerMenus() {          add_menu_page('Theme Options', 'Theme Options', 'edit_theme_options', 'theme_menu_slug', 'theme_options_page');      add_menu_page('Theme Options2', 'Theme Options2', 'edit_theme_options', 'theme_menu_slug2', 'theme_options_page2');           };          add_action('admin_menu', 'RegisterMenus');           //Generate Page1 form     function theme_options_page() { ?>        <form action="options.php" method="post">        <?php settings_fields('XX_theme_settings'); do_settings_sections('page1'); ?>
  <input name="Submit" type="submit" class="button-primary" value="<?php _e('Save Changes'); ?>" />
         </form>
<?php echo var_dump(get_option('XX_theme_settings')); ?>
          <?php }          //Generate Page2 form     function theme_options_page2() { ?>         <form action="options.php" method="post">        <?php settings_fields('XX_theme_settings'); do_settings_sections('page2'); ?>
  <input name="Submit" type="submit" class="button-primary" value="<?php _e('Save Changes'); ?>" />
         </form>
<?php echo var_dump(get_option('XX_theme_settings')); ?>
          <?php } ?>      I know I'm not validating data (yet), but I guess it should just work (and not earse the whole array every time) out of the box, right? What went wrong?


title: plugin_dir_url() adds path to url

text: For some reason I get the following output from               var_dump( plugin_dir_url( __FILE__ ) );      > http://local.dev/wp-content/plugins/C:/development/xampp/htdocs/vanilla/wp- > content/themes/twentyeleven/ in a local install. Note: I deactivated **all** plugins and added the line on top of the `functions.php` file of the default and unmodified TwentyEleven Theme


title: How to redirect a virtual page (e.g. /blog) to the home page?

text: I want my to reach my website's main page when entering an url like: http://example.com/blog However, I can't seem to get it to work with a typical rewrite rule:               RewriteRule ^/blog$ /      I'm always taken to my site's 404 page. Works fine if I specify a specific file (e.g. "/foo.html") instead of "/", but "/index.php" doesnt't work. How can I make this work?


title: Creating directory in uploads - wp_mkdir_p() or WP_Filesystem?

text: I don't think I ever had practical need to create folders/files in WP before, but for a plugin I need cache (for resized images) folder in `wp- content/uploads`. Which raises the question - do I really need to go through all the process with `Filesystem API` (including messily asking for FTP credentials when needed), or `wp_mkdir_p()` is good enough for this?


title: Edit the "Post updated. View post" link

text: Is it possible to edit the "Post updated. View post" link and remove the "View post" entirely? Also change the "Post" to the name of a cpt? Thanks guys! Update: Here is the code I used and it worked like a charm. I hope this helps others! In my example I use "Contact" as my cpt: ![enter image description here](http://i.stack.imgur.com/0RQL8.png) `               add_filter('post_updated_messages', 'contact_updated_messages');     function contact_updated_messages( $messages ) {          $messages['contact'] = array(     0 => '', // Unused. Messages start at index 1.     1 => sprintf( __('Contact updated. View Contact'), esc_url( get_permalink($post_ID) ) ),     2 => __('Custom field updated.'),     3 => __('Custom field deleted.'),     4 => __('Contact updated.'),     /* translators: %s: date and time of the revision */     5 => isset($_GET['revision']) ? sprintf( __('Contact restored to revision from %s'), wp_post_revision_title( (int) $_GET['revision'], false ) ) : false,     6 => sprintf( __('Contact published. View Contact'), esc_url( get_permalink($post_ID) ) ),     7 => __('Contact saved.'),     8 => sprintf( __('Contact submitted. Preview Contact'), esc_url( add_query_arg( 'preview', 'true', get_permalink($post_ID) ) ) ),     9 => sprintf( __('Contact scheduled for: %1$s. Preview Contact'),       // translators: Publish box date format, see http://php.net/date       date_i18n( __( 'M j, Y @ G:i' ), strtotime( $post->post_date ) ), esc_url( get_permalink($post_ID) ) ),     10 => sprintf( __('Contact draft updated. Preview Contact'), esc_url( add_query_arg( 'preview', 'true', get_permalink($post_ID) ) ) ),     );          return $messages;     }      `


title: How to enable suggested edits?

text: I like the idea of enabling any user of my website to suggest edits to a page. Much like the edit system on Stack Exchange but different in that anyone should be able to edit, not just registered users. All edits would go through an approval process. How could I implement that?


title: Which freelance sites are recommended to find WordPress developers/programmers, etc

text: I've been using drupal for a few years and it's overkill. I want to pay someone to migrate my content (blog posts and pages) over to wordpress without spending more than is necessary. Is there a specific site such as odesk, elance, guru, rentacoder, etc. that is popular with wordpress programmers and tends to have the best rates? Thanks...


title: How we count the user draft posts

text: I am trying to use the total posts count currently i am using the this query               $args=array(     'author' => $userID,     'post_type' => 'post',     'post_status' => $poststatus,     'posts_per_page' => 212     );     <?php echo count_user_posts($args); ?>      `$poststatus` have 2 options `draft` and `publish`. But when i run this query one condition work good and that is `publish`. but when i try to run `draft` it not showing correct count of draft posts. So tell me where i am wrong in the query.


title: Restrict certain actions to plugin-specific admin menu pages only

text: I'm working on a plugin and want to restrict some things to my plugin-specific admin menu pages only. Therefore, I write the slugs being returned when adding (sub)menu pages into an array so I can check later on the current page against it. The problem seems to be that `get_current_screen` is returning **`null`** when called from/before `admin_init`. I add the menu pages, however, hooked to `admin_menu` \- which is before `admin_init`. Here is the **not working** code:               add_action( 'admin_menu', 'my_admin_menu' );     function my_admin_menu() {         // Set up plugin admin menu         $menu_pages = array();         $menu_pages[] = add_menu_page( ... );         $menu_pages[] = add_submenu_page( ... );              $screen = get_current_screen(); // UNFORTUNATELY, $screen is null here         $screen = $screen->id;         foreach ( $menu_pages as $page ) if ( $screen === $page ) {             // Do plugin-specific stuff         }     } // function my_admin_menu      So, do I really have to store the pages array in a way that I can access it later in a function hooked somewhere after `admin_init`? I thought about just using the page slugs where I defined the pages and then forget about it. As toscho pointed out, one may use the _slugs_ as hooks (what they actually are):               $page = add_menu_page( ... );     add_action( $page, ... );      However, when in need of the **current screen** , that hook is located too early in the chain, so one could/should use `add_action( 'load-' . $page, ...);` instead.


title: Disable Jquery UI post tabs

text: Hey all, I'm using Jquery UI tabs with the WordPress Post Tabs plugin and it works like a charm. However, I'd like to auto disable or hide tabs that do not have any data. I've worked with Jquery quite a bit but I'm lost in this mess. Any help would be appreciated. Thanks! Jquery Tabs Information from the official site Initialize a tabs with the disabled option specified.               $( ".selector" ).tabs({ disabled: true });      Get or set the disabled option, after init.               var disabled = $( ".selector" ).tabs( "option", "disabled" );     //setter     $( ".selector" ).tabs( "option", "disabled", true );      * * * Found in wordpress-post-tabs.php line 105                  <script type="text/javascript">         jQuery(function() {         <?php          if($wpts_count and $wpts_count!=0){            for($i=0;$i<$wpts_count;$i++) {   ?>             jQuery("#tabs_<?php echo $i;?>").tabs({ cookie: { expires: 30 } });             //getter             var cookie = jQuery("#tabs_<?php echo $i;?>").tabs( "option", "cookie" );             //setter             jQuery("#tabs_<?php echo $i;?>").tabs( "option", "cookie", { expires: 30 } );             <?php if(isset($wpts['fade']) and $wpts['fade']=='1'){ ?>                 //fx for animation                 jQuery("#tabs_<?php echo $i;?>").tabs({ fx: { opacity: 'toggle' } });                 //getter                 var fx = jQuery("#tabs_<?php echo $i;?>").tabs( "option", "fx" );                 //setter                 jQuery("#tabs_<?php echo $i;?>").tabs( "option", "fx", { opacity: 'toggle' } );            <?php }}} ?>          });     <?php if($wpts['reload']=='1') { ?>         function wptReload(ar)         {          location.href=location.href.split(/\?|#/)[0] + '#' + ar;            location.reload(true);          return false;         }     <?php } ?>         </script>


title: Troubles with making a custom template for posts

text: Is it possible to make a template for all posts in a custom post type? For example I would like to be able to change an adsense ad or some other element on every post by simply editing a custom template. I have been experimenting with templates that are pretty static, but I am stumped on which one to copy/edit for the posts.


title: Difference between esc_url() and esc_url_raw()

text: http://core.trac.wordpress.org/browser/trunk/wp-includes/formatting.php#L2239 I'm confused about when should either of them be used. Assuming I have this URL: `http://site.com/?getsomejavascript=1`, which is dynamically generated javascript:   * if I include the script with `esc_url(add_query_arg('apples', 420))`, I get `http://site.com/?getsomejavascript=1&apples=420` and it breaks because of those `#038;` references   * if I use `esc_url_raw(add_query_arg('apples', 420))` I get the correct URL: `http://site.com/?getsomejavascript=1&apples=420` but in the documentation I find out that esc_url_raw should only be used to escape URLs inserted in the database...


title: What characters are allowed as a shortcode tag and how should they be sanitized?

text: I am working on a plugin where the user can define shortcode tags himself. What would you suggest to allow in there? My thought is only allow ascii characters. So how do I sanitize? `strip_tags` and then regex to allow only `a-z, 0-9` or is there a better solution? Does WordPress have filter for that? Could I maybe use the filter WordPress uses for slugs? thanks for the answers i will just do this, if there must be one ascii char anyway then i just require three.               foreach ( $shortcodes as $key => $var ) {          $var = preg_replace('/[^a-z0-9_]/', '', $var ); // strip away everything except a-z,0-9 underscore          if ( strlen($var) < 3 )         continue; // if less then 3 chars AFTER the strip don't save


title: loop over all custom taxonomies for current custom post type and their values

text: What I want to do: I have four custom post types. I only want to use one, which I can do like this: `$current_posttype = get_post_type( $post->ID ); // get current post type `. Next up, I want to loop through all the custom taxonomies that are attached to that custom post type. So, for example:               custom post type: movies     custom taxonomy 1: genre     custom taxonomy 2: rating     custom taxonomy 3: year     and so on..      I want to output the following (for the current post):               genre: Western     rating: 4     year: 2000      What I do know is that I can use the following code to output all terms of a custom taxonomy.               // Get terms for post      $terms = get_the_terms( $post->ID , 'genre' );           // Loop over each item since it's an array      if ( $terms != null ){         foreach( $terms as $term ) {          // Print the name method from $term which is an OBJECT      if ( $term->name != null ) {      ?></br><?php print $term->name ;      // Get rid of the other data stored in the object, since it's not needed      }      else {      }       unset($term);     } }       What I don't know is how to loop over this, with a foreach loop. I can't figure it out. Any help or suggestions? Thanks.


title: How to modify the default feed via a function

text: I am trying to add a functionality to the default wordpress feed. The problem is i managed to do this modifying the rss feed php file. The problem number two that i have in mind is when wp gets an update also that file will be updated and my code will disappear. So i am looking to for a way to insert my code as a filter or something else for the rss feed. Note: **My code does not modify the default feed content, instead i want to display another feed from external site.**               add_filter( 'the_name_for_the_rss_filter', 'my_function' );          function my_function( $some_var ){ global $some_var;          if($some_var == true){          // let's say:      // echo file_get_contents("http://example.com/feed/");     // exit(0);          }          }


title: why is the current page title being output?

text:
this is in my sidebar.php file, which is pulled in in the header.php file (is this bad practice?). anyways, the last item in the list is the current page title, despite my query_posts with an args of only the custom post type of newsletters               <?php        if (function_exists('dynamic_sidebar') && dynamic_sidebar('Sidebar Widget')) : else : ?>

Newsletters

       <?php          $args = array ('post_type' => 'newsletters');         query_posts($args);         if (have_posts()) : while (have_posts()) : the_post();?>
<a href="<?php the_field('pdf');?>"><?php the_title();?>
            <?php wp_reset_query(); endwhile; endif; ?>


title: Resolve a custom post type name vs. page permalink conflict (same slug)

text: I have a custom post type called "visningshus", and also a Page with that slug. This is as it should (must) be. Currently, "http://my-site.com/visningshus" lists all posts of that type. I want to show the page that has that permalink slug instead. How can I make Wordpress not make the post type name take precedence, but instead the permalink, and show the Page?


title: wordpress JSONAPI introspector always limits number at 10?

text: I'm a little new to Wordpress and the JSON API so forgive me if this is a newbie question but i'm trying to get _all_ of the posts of a few different custom post types and return them as JSON via my own JSON controller (extending the JSON API) if I do this:               $posts = $json_api->introspector->get_posts(array('post_type' => array('post','tweet','gallery','video','music'), 'post_parent' => 0, 'order' => 'ASC', 'orderby' => 'date', 'numberposts' => 100000000000));     echo count($posts);      I only get "10" posts but there are a lot more in the db. Whereas if I do this:               echo count(get_posts(array('post_type' => array('post','tweet','gallery','video','music'), 'post_parent' => 0, 'order' => 'ASC', 'orderby' => 'date', 'numberposts' => 100000000000)));      I get "74", the correct number of posts in the db. Essentially the JSON API is limiting the returned value to only 10 posts. I'm pretty sure I can hack the JSON API plugin to allow more but that seems like it would mess up my code for any API upgrades. Is there a way to set the JSONAPI->introspector post number to "all" Thanks [Mods: I have cross posted this in stack overflow a minute ago but wasn't sure which site would be better to post this question please let me know and I'll remove as appropriate]


title: Add a drop down list to comment form?

text: Can somebody help me to create a drop-down menu or (radio buttons) in Wordpress comment form, so that a new user could make a selection of their user roles (for example teachers + students) ?   1. Output from dropdown list or radio button would appear somewhere in the comments area.    2. The best of all would also be if WordPress which already automatically populate   email, login name would also display new extra field info (dropdown list OR   radio button) to logged in users who already has their user roles assigned   3. I don't want to use a plugin for that.   4. I know that there a lot of tutorials about adding extra custom fields to the comment form including this web where I have found 3 similar requests unfortunately marked as duplicates, on my opinion they are not dups at all, because there's no code or tutorial for using known values as (select - dropdown- radio) button.


title: Secure way to use name_save_pre?

text: I created a custom post where I need to change the post name regarding to the custom field and taxonomy values. This is how I did it:               add_filter('name_save_pre', 'save_name');     function save_name($name_to_ignore) {              global $post, $meta_box, $wpdb;               $this_post_id = $post->ID;              // verify nonce -- checks that the user has access          if ( !isset($_POST['wp_nonce']) || !wp_verify_nonce( $_POST['wp_nonce'], basename(__FILE__) )) {             return $post_id;         }              if ($_POST['post_type'] == 'mytype') :               $name1 = $_POST['term1'];               $name2 = $_POST['term2'];               $name3 = $_POST['custom_field_1'];               $name4 = $_POST['custom_field_2'];               $my_post_name = $name1."-".$name2."-".$name3."-".$name4."-".$this_post_id;             endif;             return $my_post_name;     }      I just want to is it secure to save the data this way. Cause I read somewhere else (which is I forgot where), said that using $_POST['Custom_field']; is very easy to get hacked. Is it true?


title: How to make wordpress folder (/wordpress) redirect to /?

text: I have my website setup with Wordpress in its own folder. The URL website.com/wordpress is currently a 404 (which makes sense since the page doesn't exist), but I want it to redirect back to the root. I've tried using the Redirection plugin to setup the redirect, but it is still a 404. Any ideas?


title: Functions.php code that only runs on localhost?

text: I would like to run an add_action in functions.php only if the theme is being loaded from my localhost development site. How would I get this to run only on localhost?               function livereload(){     ?>         // mycode      <?php     }     add_action('headway_body_close', 'livereload');


title: custom post type and taxonomies in a php class

text: I used this class in the tutorial to create two custom post types http://code.tutsplus.com/articles/custom-post-type-helper-class--wp-25104 According to `add_taxonomy()` function if the taxonomy already exists then `$E2` will be added to that taxonomy. this is achieved by using `taxonomy_exists()`               if( ! taxonomy_exists( $taxonomy_name ) )     {         /* Create taxonomy and attach it to the object type (post type) */         // register_taxonomy()     }     else     {         /* The taxonomy already exists. We are going to attach the existing taxonomy to the object type (post type) */        // register_taxonomy_for_object_type()     }      here logic is correct but when ever i register a taxonomy for two post_type's only the second post_type will get this taxonomy, first post_type will not be registered with taxonomy               $E1 = new Custom_Post_Type('E1');        $E2 = new Custom_Post_Type('E2');          $E1->add_taxonomy( 'tax1' );        $E2->add_taxonomy( 'tax1' );      upon debugging i found out that `taxonomy_exists()` returns false even when taxonomy is registered. I tried making $wp_taxonomies global since it holds all taxonomies, but no use. so problem is with detecting whether a taxonomy is already registered or not.


title: Good way to store content and settings for an RSS plugin

text: I am building an RSS reader plugin and I'd like some advice on how to store the data and settings for this plugin. The idea is to be able to enter a set of feed sources and associate each one of these sources with one or more categories. Thus you can have several categories e.g. sports, politics each having their own associated feed sources. So for example:   * Sports      * ESPN.com     * Sportingnews.com When the feed items from these feed sources are imported every few hours via Cron they are then stored as custom post types. Each feed item must of course be associated with the feed source. When it comes to display feed items the plugin will use this logic:   1. Check which category is being called (via shortcode)   2. Check which feed sources are associated with that category   3. Get feed items associated with feed sources identified in step 2 I am still unsure about how all this data needs to be stored. The plugin will have a settings page and for that I am settled about storing everything in the wp_options table. However when it comes to the feed sources, categories and feed items, I'm still confused how to store them best. Any suggestions on how to do this? I've been reading about the CPTonomies plugin which seems to do what I need, but I want the functionality in built into this plugin and I cannot use another external plugin.


title: Thumbnail & Category link aside post

text: I've been trying to figure out for days how http://quotelicious.com was able to place thumbnails and category links in a separate box alongside the actual post. Any ideas?


title: Making images in posts link to the image file rather than the attachment page

text: So I've got a bunch of content with images inserted into them. The users inserting content have done the default option of linking to the attachment page which isn't great. I've altered the               image_default_link_type setting to make this link to the **file** by default now. But I'd like to use a light box or something to display images on the site, which requires the to go to the image file, not the attachment page. Whilst I can make this work for images added since the default was changed, I was wondering if there was any solution that could make this change for me that was not going through and altering the content of each post? TIA, Dan.


title: Add menu headings to Wordpress sub menus

text:
I'm using the native Wordpress menu. I have two top-level links with sub menus - I'd like for those sub menus to display the name of the parent menu item. So if I have a parent menu item named "Gardens" containing a sub menu of "Flowers" and "Plants", that sub menu should say "Gardens" at the top, and then list the sub menu links below it. I've gotten as far as creating a walker to insert some H3 heading text in the sub menu. It looks like this:               class Subnav_Header_Walker extends Walker_Nav_Menu     {         function start_lvl( &$output, $depth = 0, $args = array() ) {             $heading = 'Heading Text Here';             $indent = str_repeat("\t", $depth);             $output .= "\n$indent

" . $heading . "
\n";         }         function end_lvl( &$output, $depth = 0, $args = array() ) {             $indent = str_repeat("\t", $depth);             $output .= "$indent
\n";         }     }      It's not great, but it's working. Now I just need some code to get the name of the parent menu item. Can anyone help me with this? Thanks!


title: How to list categories and subcategories in JSON format?

text: I need to integrate this plugin with my WordPress site, and the categories must be in this format:                "Option 1": {"Suboption":200},      "Option 2": {"Suboption 2": {"Subsub 1":201, "Subsub 2":202},                     "Suboption 3": {"Subsub 3":203, "Subsub 4":204, "Subsub 5":205}                    }      How can I get that?   I tried the options of the json-api. And this is the walker:                 class MyWalker extends Walker_Category {         var $tree_type = 'category';              var $db_fields = array ('parent' => 'parent', 'id' => 'term_id');              function start_lvl( &$output, $depth, $args = array() ) {             if ( 'list' != $args['style'] )                 return;                  $indent = str_repeat("\t", $depth);             $output .= "$indent:{";         }              function end_lvl( &$output, $depth, $args = array() ) {             if ( 'list' != $args['style'] )                 return;                  $indent = str_repeat("\t", $depth);             $output .= "$indent}\n";         }              function start_el($output, $category, $depth , $args = array() ) {             extract($args);             $cat_name = esc_attr( $category->name );             $cat_name = apply_filters( 'list_cats', $cat_name, $category );             $output .= '"' . $cat_name.'=>'.$depth . '",';         }              function end_el($output, $page, $depth = 0, $args = array() ) {             if ( 'list' != $args['style'] )                 return;                  $output .= "\n";         }     }


title: wordpress illegal string offset 'parameter' error

text: I am getting the error illegal string offset when creating a checkbox in the admin. my code look like this.               <input  type="checkbox"  id="slideThre" name="custom_settings[checked]" value="1" <?php checked(1, $custom_options['checked']);?>/>      There is no error when I check the box and save. The error appear when I uncheck the box and save. What could be wrong? thanks.


title: bloginfo() and get_template_directory_uri() with SSL?

text: I have a Wordpress theme I'm attempting to put on an SSL-only website. There is no non-SSL version of the site. The Wordpress theme uses various functions like `bloginfo('pingback_url')`, `bloginfo('template_directory')`, `get_template_directory_uri()`, etc... All the typical functions for a theme. All of these functions generate `http` links, not `https`, so therefore none of them load, since a non-SSL version of the site does not exist. How do I force Wordpress to use `https` for EVERYTHING?


title: Can I use one wordpress plugin twice in a website?

text: I'm using Contact Form 7. I have used it once in my wordpress website as a simple contact form. Now I have to add another contact form for registration process if someone would like to apply for a job. Now, do I have to install again the plugin? Or can I use it again? I would like also to add some function on the registration form for the applicants.


title: Protocol neutral URLS with wp_enqueue_script (SSL issues)?

text: How do I use wp_enqueue_script so that I get protocol neutral URLs? Here is how I'm currently using it: `<?php wp_enqueue_script('name', get_bloginfo('template_directory'). '/js/name.pack.js'); ?>` I saw that `home_url()` is protocol aware so I figured `theme_url()` would be also but I'm getting the error below when I use it. `Call to undefined function theme_url()`


title: query_posts result differs from wp_query request result

text: I have a multisite Wordpress setup (3.5.1, I cannot risk updating) on which I am querying some posts after having switched to the correct blog. I have a query_posts function with the following parameters:               $posts = query_posts('posts_per_page=5&paged=1&post_status=publish&orderby=date&order=desc');      from this query of posts the query_vars becomes (`$GLOBALS['wp_query']->query_vars`):               Array (         [posts_per_page] => 5          [paged] => 1          [post_status] => publish          [orderby] => date          [order] => desc          [error] => [m] => 0          [p] => 0          [post_parent] =>           [subpost] =>           [subpost_id] =>           [attachment] =>           [attachment_id] => 0           [name] =>           [static] =>           [pagename] =>           [page_id] => 0           [second] =>           [minute] =>           [hour] =>           [day] => 0           [monthnum] => 0           [year] => 0           [w] => 0           [category_name] =>           [tag] =>           [cat] =>           [tag_id] =>           [author_name] =>           [feed] =>           [tb] =>           [comments_popup] =>           [meta_key] =>           [meta_value] =>           [preview] =>           [s] =>           [sentence] =>           [fields] =>           [menu_order] =>           [category__in] => Array ( )           [category__not_in] => Array ( )           [category__and] => Array ( )           [post__in] => Array ( )           [post__not_in] => Array ( )           [tag__in] => Array ( )           [tag__not_in] => Array ( )           [tag__and] => Array ( )           [tag_slug__in] => Array ( )           [tag_slug__and] => Array ( )           [ignore_sticky_posts] =>           [suppress_filters] =>           [cache_results] => 1           [update_post_term_cache] => 1           [update_post_meta_cache] => 1           [post_type] =>           [nopaging] =>           [comments_per_page] => 50           [no_found_rows] =>      )      The query Wordpress says it executes to find these posts is then (`$GLOBALS['wp_query']->request`):               SELECT SQL_CALC_FOUND_ROWS wp_5_posts.ID      FROM wp_5_posts      WHERE 1=1 AND wp_5_posts.post_type = 'post' AND (wp_5_posts.post_status = 'publish')      ORDER BY wp_5_posts.post_date desc LIMIT 0, 5      If I execute this query on the database the resulting IDs are:               12059     12046     12038     12030     12026      However, if I loop over the posts:               foreach($posts as $p){         echo($p->ID."<br>");     }      I get the following ID's:               11741     11721     11643     12059     12046     12038     12030     12026      Does anyone know how this is possible? The array $posts is empty before calling query_posts and I do not understand why these posts occur in the array. If I select these posts in my MySQL database by hand there is no noticeable difference between them that would make the first three special in some way, and all three are older than the other 5 requested. Thanks in advance!


title: Why is Posts page selected when showing single Custom Post Type?

text: In Settings-Reading I have selected a static page from my "Front page displays". My Front page is "Home" and my Posts page is "News". I have also added a Custom Post Type called "Project" without an archive or a slug and I have added a page "Projects" which uses the template `projects.php`. So far so good, all is working, except one thing. When I visit a single Project (CPT), in my top navigation "News" becomes selected. In the body-tag it gets the class `single single-project postid-114 single-format-standard logged-in` And in the nav-menu News has a class of `page_item page-item-6 current_page_parent`. I don't understand why this (News getting the `current_page_parent`-class) would be happening, as I expected that none of the page_items would become selected. Two questions:   1. How can I get rid of this?   2. And ideally, how can I make it so that "Projects" becomes selected? Below a screenshot to (hopefully) clarify things. ![enter image description here](https://img.skitch.com/20110623-8gs8e2cx6eeb2qgata5mn8s7j.jpg)


title: making an index from custom taxonomies and tags of posts (not hierarchical taxonomy)

text: i have attached custom taxonomies to posts. now i'm looking for the best way, architecturally speaking, for automatically creating list that would look like this: **energy (32):**   * how to build a solar system (asaf)   * how to fix a solar panel (saar)   * managing your lead-acid deep-cycle battery (ofra)   * hybrid system design (asaf)    * take the green pill (saar) _more energy? ->_ explanation: it should query all instances of a specific taxonomy (let say tags, and afterwards i'll do the same with other taxonomies as well) and make a list of that will have the tag name as a title with number of posts in the tag in brackets, and a list of the newest posts under that list with the author name in brackets.each post should link to the post, and name of author should link to the author page. in the bottom it should have a generic link to that specific tag archive page. the function i'm trying to build should generate that list automatically for every tag that has more then 10 posts tagged. the next difficulty level is to make it show every post only one time (for posts that are tagged with number of tags it will show the post only on the first tag). i've tried to find a plugin that i can tweak to doing that but i could not find any thing close enough, so i decided to build it myself. what i'm asking is for everything between a a tip for the road and a "yesterday i've developed the same function, it's working great, here's the code. have fun". Cheers, Asaf.


title: How to return HTTP 404 when no search results found?

text: When user search and there is no results found wordpress still return 200 OK. I want to change it to 404 Not Found. Is it possible to return 404 Not Found header in search.php? If yes, how to do that?. Thanks.


title: image.php content pulled with AJAX

text:
I made a custom gallery set on my single-page theme where it lists the titles of the gallery post type, and when clicked, the thumbnails are ajaxed below. Then, I made another ajax to watch the thumbnails and show the full size image on the right. To get the content of the full size image, I created the image.php file and ordered it to have the same structure of where it will be attached. All worked fine and well until I click on the thumbnail and the ajax kicks in, but the image itself doesn't load. When inspecting the code for the image.php, I noticed that it pulls the image in question using some php that I don't fully get:

          <?php if (have_posts()): while (have_posts()) : the_post(); ?>                                <?php if ( wp_attachment_is_image( $post->id ) ) : $att_image = wp_get_attachment_image_src( $post->id, "full"); ?>                 <img src="<?php echo $att_image[0];?>" width="<?php echo $att_image[1];?>" height="<?php echo $att_image[2];?>" alt="<?php $post->post_excerpt; ?>" />             <?php else : ?>                 <a href="<?php echo wp_get_attachment_url($post->ID) ?>" title="<?php echo wp_specialchars( get_the_title($post->ID), 1 ) ?>"><?php echo basename($post->guid) ?>             <?php endif; ?>                        <?php endwhile; ?>          <?php else: ?>          <?php endif; ?>

      So my question is: Is it really possible to bring the image from image.php with ajax? Maybe it needs the address bar to get the post id or something. I'm having this suspicion because ajax is not adding anything there. Here is the ajax that should bring up the image:               $(document).ready(function() {                   $('#thumbnails').on('click','a', function(event) {                  var aCarregar = $(event.target).attr('href')+' #texto-galeria';             $('#texto-galeria').fadeOut('fast',carregarConteudo);             $('#carregando').remove();             $('#conteudo-galeria').append('Carregando...');             $('#carregando').fadeIn('normal');                       function carregarConteudo () {                 $('#texto-galeria').load(aCarregar,'',mostrarNovoConteudo);             }             function mostrarNovoConteudo () {                 $('#texto-galeria').fadeIn('normal',esconderCarregando);             }             function esconderCarregando () {                 $('#carregando').fadeOut('normal');             }                  return false;         });          });      By the way, without the ajax, the image.php displays the image nicely. Thank your for you time!


title: Set a payment method programatically

text: Having a hard time trying to figure this out. I'm wanting to set the payment method for the Woocommerce checkout so that the user doesn't have to choose. The only choice they have is PayPal. I wanted to use:               global $woocommerce;     $gateways = $woocommerce->payment_gateways()->get_available_payment_gateways();     $gateways["paypal"]->set_current();      But this doesn't seem to work. I've tried putting this in "init" and at the top of the "form-checkout" template but no joy.


title: How to add user email to url address?

text: How can I automatically give user email address to url? I have this url:               /trk?o=80&p=663&s1=&s2=&s3=&email=      And I need get WordPress user email to the end of this url `&email=`


title: Unable to get wp_get_attachment_url to show

text: I'm trying to show a link to the full size image of an attached image. I took a code for Wordpress' Twelve Thirteen theme:               <?php      $metadata = wp_get_attachment_metadata();     printf( '%3$s',     esc_url( wp_get_attachment_url() ),     esc_attr__( 'Link to full-size image'),     __( 'View Full Size' ),     $metadata['array'],                                     $metadata['array']     );     ?>      It shows on the twelve thirteen theme with a magnifying class and the text 'Full Resolution (width x height). It doesn't show the theme 'terrifico' I'm using. What am I doing wrong?


title: WP is ignoring .htaccess rewritten URL

text: I have two domains being served from the same WP install. _edit: **not** multi-site_ In `wp-config.php` I have `define('WP_SITEURL', "http://$hostname/wordpress");` etc. The two domains will have similar content, but we want to be able to have them at the same path, e.g. `domain1.com/about-us` and `domain2.com/about-us`. I've therefore set up these two pages `\dom1\about-us` and `\dom2\about-us`, and in my `.htaccess` I have:               # BEGIN WordPress     <IfModule mod_rewrite.c>     RewriteEngine On     RewriteBase /          RewriteCond %{HTTP_HOST} dom1 [NC]     RewriteRule ^((about\-us|etc).*) /dom1/$1 [NC,QSA,L]          RewriteCond %{HTTP_HOST} dom2 [NC]     RewriteRule ^((about\-us|etc).*) /dom2/$1 [NC,QSA,L]          RewriteRule ^index\.php$ - [L]     RewriteCond %{REQUEST_FILENAME} !-f     RewriteCond %{REQUEST_FILENAME} !-d     RewriteRule . /index.php [L]     </IfModule>     # END WordPress      I get _(edit: WordPress)_ 404 error pages for the above URLs. I've added `print_r($_SERVER);` in my 404 template and get the following (simplified output).               Array     (     [REQUEST_URI] => /about-us/     [REDIRECT_REDIRECT_STATUS] => 200     [REDIRECT_STATUS] => 200     [HTTP_HOST] => dom1.dev     [SERVER_NAME] => dom1.dev     [REDIRECT_URL] => /dom1/about-us/     [QUERY_STRING] =>      [SCRIPT_NAME] => /index.php     [PHP_SELF] => /index.php     ...     )      Doesn't that mean that the rewrite has worked, but WP is not using it? Many thanks in advance.


title: create a permalink based on a post type

text: I want to create a permalink based on a post type. I am using twitter bootstrap nav walker file. In this way:               example.com/#home     example.com/career     example.com/#testinomial     example.com/contact      i am new in wordpress