title: Is it safe to register a taxonomy without using any hooks?

text:
I'm creating a Wordpress site in which I wanted to use a custom taxonomy in my theme options, which I had registered using the 'init' hook. But the problem was that the 'init' hooks gets fired after the theme options (I'm using the Redux Framework plugin for the theme options). So when I used the get_categories() function inside my theme options, and tried to get the custom taxonomy, I was getting an 'invalid_category' error. So I decided to just register the taxonomy without any hooks and simply calling the register_taxonomy() function in the functions.php file and it worked. I just want to know if this is 'safe', as in, what would be the consequences if I simply call register_taxonomy function without using any hooks. Here is the code that doesn't work, while using the init hook:               function my_function(){       register_taxonomy( 'portfolio_category', 'portfolio', array(                         'labels' => array(                                   'name' => _x( 'Portfolio Categories', 'taxonomy general name' ),                                   'singular_name'     => _x( 'Portfolio Category', 'taxonomy singular name'     ),                                   'search_items'      => __( 'Search Portfolio Categories' ),                                   'all_items'         => __( 'All Portfolio Categories' ),                                   'parent_item'       => __( 'Parent Portfolio Category' ),                                   'parent_item_colon' => __( 'Parent Portfolio Category:' ),                                   'edit_item'         => __( 'Edit Portfolio Category' ),                                   'update_item'       => __( 'Update Portfolio Category' ),                                   'add_new_item'      => __( 'Add New Portfolio Category' ),                                   'new_item_name'     => __( 'New Portfolio Category' ),                                   'menu_name'         => __( 'Portfolio Categories' ),                               ),                         'hierarchical' => true,                       ) );          }     add_action('init', 'my_function');          $portfolio_categories = get_categories(array('taxonomy' => 'portfolio_category', 'hide_empty'=> 0));     echo "
", print_r($portfolio_categories), "
"; // This will return an error of 'invalid_taxonomy'      And here is one that works, (without using any hooks):               register_taxonomy( 'portfolio_category', 'portfolio', array(                         'labels' => array(                                   'name' => _x( 'Portfolio Categories', 'taxonomy general name' ),                                   'singular_name'     => _x( 'Portfolio Category', 'taxonomy singular name'     ),                                   'search_items'      => __( 'Search Portfolio Categories' ),                                   'all_items'         => __( 'All Portfolio Categories' ),                                   'parent_item'       => __( 'Parent Portfolio Category' ),                                   'parent_item_colon' => __( 'Parent Portfolio Category:' ),                                   'edit_item'         => __( 'Edit Portfolio Category' ),                                   'update_item'       => __( 'Update Portfolio Category' ),                                   'add_new_item'      => __( 'Add New Portfolio Category' ),                                   'new_item_name'     => __( 'New Portfolio Category' ),                                   'menu_name'         => __( 'Portfolio Categories' ),                               ),                         'hierarchical' => true,                       ) );          $portfolio_categories = get_categories(array('taxonomy' => 'portfolio_category', 'hide_empty'=> 0));     echo "
", print_r($portfolio_categories), "
";      Also the first code works, if I put it in a page template, so I know I'm doing it correctly. Please let me know about this Thanks.


title: wp_mail works with add_action('save_post', ...) but not an ajax action

text: I have two actions. One is after saving a post, so `add_action('save_post', 'on_any_post');` I have a second action triggered via AJAX, so               add_action( 'wp_ajax_nopriv_saveTaskPriority', 'saveTaskPriority' );       add_action( 'wp_ajax_saveTaskPriority', 'saveTaskPriority' );        In both `on_any_post` and `saveTaskPriority`, I have the following code:               $to = array('foo@bar.com');     $subject = 'foo';     $body = 'bar';          wp_mail($to, $subject, $body);      The only difference is, in the ajax function, I have `die('hi');` at the end. I **KNOW** the ajax method is being called, because I am returning data and `console.log`ging it. (Meaning I see 'hi' in the response of the POST in chrome developer tools) I get the email from the `save_post` action, but not the ajax action. What gives? **EDIT** : If I use straight up `mail()` in the ajax function, it works.


title: When to use esc_url, esc_html, esc_attr, and friends?

text: Discovered `esc_url` today while customizing an _s theme. I understand what the function does (sanitizes the URL inside), but what I'm unsure of is the scope of its use. It makes sense to me that if I'm accepting a URL input from a user, that I'd use this. But when I was looking at a function that displayed the entry's meta info (see it here...line 129 at the moment), it used `esc_url`, which doesn't make sense to me. If I'm working on a theme, do I need to be escaping ANY URL that I put in my template files?


title: Custom image size doesn't work

text: I'm developing my own theme. I'm trying to remove the default WordPress image sizes medium, large and full. I also want my own image size, `vividflow-full- width`. I'm using this Sumtips tutorial. At the `after_setup_theme`, this is runt:               add_image_size( 'vividflow-full-width', 682, 9999, true );      And at the `image_size_names_choose` action hook:               unset( $sizes['medium']);     unset( $sizes['large']);     unset( $sizes['full'] );          $myimgsizes = array(         "vividflow-full-width" => __( "Full width" )     );          return array_merge($sizes, $myimgsizes);      However, at the insert media screen, I only see the option to insert a thumbnail. What's going wrong? I'm sure the functions both codes are in are runt. I don't see any errors in my error log, nor get I any notices when setting `WP_DEBUG`.


title: Best way to present options for home page in admin?

text: I have a site with a custom home page, home.php. What's the right way to present the editable home page options in the admin tool? For example, there's a few custom text fields on the home page that should be editable in the admin tool. I'm looking for the best way to set this up so an admin user can change these options. **UPDATE:** imagine a site with a home page with a promotional blurb (text string) that I need to be able to let admin users (non-tech people) update easily. I'm trying to figure out how to present a screen in admin that says "What promotional text do you want on the home page? [ ** ___ __ ___ __ ___ __ ___ ____**]"? I thought about doing this via widget but that route is clunky and requires me to create a special sidebar just to hold the single widget. What's the best way to approach this?


title: Loading plugin text domain before registering post type

text: I'm building a wordpress plugin, that will register a post type. Im trying to set up a simple test case where all it does is registering a post type with get text functions and translating it with poedit. I have successfully created the .po and .mo files, and loaded them with the following code:               add_action('init', 'client_functions_textdomain');     function client_functions_textdomain(){         load_plugin_textdomain( 'client-functions', false, dirname( plugin_basename( __FILE__ ) ) . '/languages/' );     }      If i test a gettextcall right after loading this, everything translates fine. And the load_plugin_textdomain() returns true. But when i afterwards try to register a post type with the following code (taken from the codex), its doesn't translate:               add_action( 'init', 'codex_book_init' );     /**      * Register a book post type.      *      * @link http://codex.wordpress.org/Function_Reference/register_post_type      */     function codex_book_init() {         $labels = array(             'name'               => _x( 'Books', 'post type general name', 'client-functions' ),             'singular_name'      => _x( 'Book', 'post type singular name', 'client-functions' ),             'menu_name'          => _x( 'Books', 'admin menu', 'client-functions' ),             'name_admin_bar'     => _x( 'Book', 'add new on admin bar', 'client-functions' ),             'add_new'            => _x( 'Add New', 'book', 'client-functions' ),             'add_new_item'       => __( 'Add New Book', 'client-functions' ),             'new_item'           => __( 'New Book', 'client-functions' ),             'edit_item'          => __( 'Edit Book', 'client-functions' ),             'view_item'          => __( 'View Book', 'client-functions' ),             'all_items'          => __( 'All Books', 'client-functions' ),             'search_items'       => __( 'Search Books', 'client-functions' ),             'parent_item_colon'  => __( 'Parent Books:', 'client-functions' ),             'not_found'          => __( 'No books found.', 'client-functions' ),             'not_found_in_trash' => __( 'No books found in Trash.', 'client-functions' )         );              $args = array(             'labels'             => $labels,             'public'             => true,             'publicly_queryable' => true,             'show_ui'            => true,             'show_in_menu'       => true,             'query_var'          => true,             'rewrite'            => array( 'slug' => _x( 'book', 'URL slug', 'client-functions' ) ),             'capability_type'    => 'post',             'has_archive'        => true,             'hierarchical'       => false,             'menu_position'      => null,             'supports'           => array( 'title', 'editor', 'author', 'thumbnail', 'excerpt', 'comments' )         );              register_post_type( 'book', $args );     }      I suspect that this has to do with the fact that both are hooked into the 'init' action, and the registering happens before the text domain is loaded? I have tried the following with no success:   * added priority 0 to the textdoamin action, and priority 20 to book_init function   * i have loaded the text domain in the 'plugins_loaded' action Any help would be greatly appreciated! Thanks Malthe


title: Use different taxonomies in different custom post types' permalinks?

text: Is there any way to add %post_type% and %taxonomy% to permalinks? I want to have links from one custom post type have one taxonomy's terms in its permalink, and another post type to use another taxonomy's terms.


title: Navigational drop-down lists in Wordpress?

text: I'm trying to simplify a set of links by placing them in a drop down list (form style) with a submit button that will take users to the page in question. Ideally, I'd like it to behave like the drop-down lists on RedBubble where each selection is also associated with a different image. As a newbie to Wordpress and web development in general, I suspect that this may be more of a general coding question than Wordpress specific, but I'm hoping maybe there's a plug in that could help with this. However, if the solution is css or javascript based, I'm more than happy to give it a try.


title: Media upload not working on theme option in WordPress 3.8.1

text: I have this jQuery code in my plugin to display a media box preferably to upload an image or to pick an image from the media gallery:               (function($){     jQuery(document).ready(function() {          $('#upload_image_button').click(function(e) {              e.preventDefault();              //If the uploader object has already been created, reopen the dialog         if (custom_uploader) {             custom_uploader.open();             return;         }              //Extend the wp.media object         custom_uploader = wp.media.frames.file_frame = wp.media({             title: 'Choose Image',             button: {                 text: 'Choose Image'             },             multiple: false         });              //When a file is selected, grab the URL and set it as the text field's value         custom_uploader.on('select', function() {             attachment = custom_uploader.state().get('selection').first().toJSON();             $('#upload_image').val(attachment.url);         });              //Open the uploader dialog         custom_uploader.open();          });          });     })(jQuery);      and thee are the following elements in my plugin option that binds with that jQuery code:               <input class="nput" id="upload_image" type="text" name="the_box[authorpic]" value="<?php echo $options['authorpic']; ?>" /> <input class="button-primary" id="upload_image_button" type="button" value="Pick From Gallery" />      but now it doesn't work, I mean nothing happens when I click or press the button now as it should display the media box just like before (I'm using now WordPress 3.8.1) and I'm sure I load up the jQuery scripts (I tested it). What could cause this not to work any more? Any ideas, recommendations and suggestions will be greatly appreciated. Thanks in advance.


title: Advanced Custom Fields

text: I am using the Advanced custom fields plugin to add a upload image option to a page, but I am wondering if there is a way so that, when I output it to a theme with `<img src="<?php the_field('add_image'); ?>"/>` it is not full size, it is cropped or set to one of the wordpress preset media sizes. Right now it outputs the full size image, So unless I teach my user to crop and resize images this doesn't seem to work for me. Thanks in advance.


title: How to define WP_DEBUG as true outside of wp-config.php?

text: I am trying to create a debugging mode in one of my plugins so users can easily enable WP_DEBUG on their own, and hopefully report back to us with helpful error messages. Right now we ask them to modify their wp-config.php, but that's beyond some users' capabilities. I was hoping to just add `define( 'WP_DEBUG', true );`in our plugin if the user has checked that option, but it appears you can only enable WP_DEBUG from the wp-config.php file. Does anyone know of any way to enable WP_DEBUG from anywhere else but wp- config? Or is there another useful WP function that I could be using instead? Thanks, Dalton


title: wp remove  query

text: i want to remove a certain query in wp 3.1               add_filter( 'query', 'remove_delete_7_day_draft_queries' );           function remove_delete_7_day_draft_queries( $query ) {          global $wpdb;         $q = "SELECT ID FROM $wpdb->posts WHERE post_status = 'auto-draft' AND DATE_SUB( NOW(), INTERVAL 7 DAY ) > post_date";         if ( $q == $query) {             return false;         }              return $query;      }      but in the error log i see something like this: WordPress database error Query was empty for query made by get_default_post_to_edit any ideea how to remove the execution of the query without any error ? tx


title: Threaded Comments Feature not working

text: If a reader posts a comment on my blog, I'm able to reply to it. But the reply is not appearing on the post page, even after approving the comment. Number of comments to that specific post is 3, i.e., 2 from Readers + 1 Mine(Reply). Here is the example: http://www.gadgetcage.com/most-expensive-computers-in- the-world/16264/comment-page-1/#comment-65580 . Note: I have enabled Threaded Comments. Please help me out.


title: WP_Query filter and order by meta ordering by wrong joined table

text: I'm trying to both filter and order a Wordpress query using the meta_value, however the `ORDER BY` part of the query seems to be working on the wrong table. The query params here are:               array(12) {       ["post_type"]=>"op-events"       ["paged"]=>1       ["meta_query"]=>       array(2) {         ["relation"]=>"OR"         [0]=>         array(4) {           ["key"]=>"_simple_fields_fieldGroupID_9_fieldID_1_numInSet_0"           ["value"]=>"2012-03-28"           ["compare"]=>">"           ["type"]=>"DATE"         }       }       ["meta_key"]=>"_simple_fields_fieldGroupID_9_fieldID_1_numInSet_0"       ["orderby"]=>"meta_value"       ["order"]=>"ASC"     }      The idea is to filter by dates after today, then order the posts in ascending order by date. I might normally resort to building this query manually but you'll see the "_simple_fields" meta_key, this is because the fields are created by the Simple Fields plugin and thus I don't know what their keys will be. The resulting query generated is:               SELECT SQL_CALC_FOUND_ROWS wp_posts.* FROM wp_posts      INNER JOIN wp_postmeta ON (wp_posts.ID = wp_postmeta.post_id)      INNER JOIN wp_postmeta AS mt1 ON (wp_posts.ID = mt1.post_id)      WHERE 1=1      AND wp_posts.post_type = 'op-events'      AND     (         wp_posts.post_status = 'publish'          OR wp_posts.post_status = 'private'     )      AND     (         wp_postmeta.meta_key = '_simple_fields_fieldGroupID_9_fieldID_1_numInSet_0'          OR         (             mt1.meta_key = '_simple_fields_fieldGroupID_9_fieldID_1_numInSet_0'              AND CAST(mt1.meta_value AS DATE) > '2012-03-28'         )     )      GROUP BY wp_posts.ID      ORDER BY wp_postmeta.meta_value ASC      LIMIT 0, 10      For some reason this query isn't returning rows in the right order, the only thing I can think of is that the `ORDER BY wp_postmeta.meta_value ASC` line should actually be ordering by my1.meta_value. Can anyone shed any light on this?


title: Featured Image not showing on wordpress hosted under Amazon AWS

text: I created a wordpress website on Amazon AWS. I also installed the same theme on wordpress hosted under Bluehost. The problem with wordpress hosted under amazon is that it doesn't show the featured images. the test website for the amazon server is at another.datingat.ph ~ I have managed to make the s3 bucket public, but it still won't show the featured images. Whatever theme I use that supports featured image, the featured image won't show. Plugins work, but I cannot control whether or not I want them to show in a post. My theme already has "add_theme_support( 'post-thumbnails' ); // " other codes that are connected to featured images are: > // get the featured image for the post if( has_post_thumbnail($postid) ) { > $thumbid = get_post_thumbnail_id($postid); } and > // get the featured image for the post if( has_post_thumbnail($postid) ) { > $thumbid = get_post_thumbnail_id($postid); } I also tried "sudo yum install php53-gd" but no changes. Also, I think the apache is already set to "AllowOverride All" unless I should check another file via terminal? Please let me know the command that I need to input. I am still new to this and tried to Google it, but I cannot find an exact answer for my problem. =(


title: Custom Post Type Taxonomies -Posts not showing in Category or Tag pages

text: I have a made a custom post type called "Member Resources" the posts under this CPT have a few taxonomies such as categories and tags. Tags = "Diversity" Categories = "Guidance" When I go to the following urls: www.domain.com/tags/diversity www.domain.com/tags/guidance No posts appear. Though I have set public => true on the CPT function. Posts are displaying if you go to the Member Resources archive page though, so they are displaying, but not when you filter them by taxonomies. Any help would be appreciated! Thanks.


title: Showing RSS feed via fetch_feed. How to show the site title of the feed?

text: Question is simple. Can i get the title and main url of the site from where the posts are loading? Actually i want to linked to the main site. The url can be found by wordpress function esc_url(); function but what about site title? The page is here: http://citystir.com/author/designdons/ Thanks!


title: How can i link post_row_actions() with a custom action function

text: I have a custom post type define below and I want to add a custom row action to allow me to 'update' the post via the admin panel               class LeagueCpt     {         function __construct()         {             add_action( 'init', array(&$this,'registerLeagueCPT'));             add_filter('post_row_actions', array(&$this,'post_row_actions'), 0, 2);         }              function registerLeagueCPT()         {             $leagueLabels = array(                 'name' => _x( 'Leagues', 'league' ),                 'singular_name' => _x( 'League', 'league' ),                 'add_new' => _x( 'Add New', 'league' ),                 'add_new_item' => _x( 'Add New League', 'league' ),                 'edit_item' => _x( 'Edit League', 'league' ),                 'new_item' => _x( 'New League', 'league' ),                 'view_item' => _x( 'View League', 'league' ),                 'search_items' => _x( 'Search Leagues', 'league' ),                 'not_found' => _x( 'No league found', 'league' ),                 'not_found_in_trash' => _x( 'No leagues found in Trash', 'league' ),                 'parent_item_colon' => _x( 'Parent League:', 'league' ),                 'menu_name' => _x( 'Leagues', 'league' ),                 );                  $leagueArgs = array(                 'labels' => $leagueLabels,                 'hierarchical' => false,                 'description' => 'League Details',                 'supports' => array( 'title','editor','excerpt','thumbnail','custom-fields','page-attributes','comments'),                 'public' => true,                 'show_ui' => true,                 'show_in_menu' => true,                 'show_in_nav_menus' => true,                 'publicly_queryable' => true,                 'exclude_from_search' => false,                 'has_archive' => true,                 'query_var' => true,                 'can_export' => true,                 'rewrite' => true,                 'capability_type' => 'post'                 );             register_post_type('league', $leagueArgs );         }      This is the code that registers the row action               function post_row_actions($actions, $post) {         $actions = array_merge($actions, array(             'update' => sprintf('Update',                 wp_nonce_url(sprintf('edit.php?post_type=league&action=update&post_id=%d',$post->ID),                 'abc'))         ));         return $actions;     }      I've defined a function update() in the same php file, in which i plan to do real work               function update()     {         // do some custom update stuff on the post content     }      My problem is how can I ensure that the URL request with the update action calls the function above? I've used the following resources Custom Post Row Actions http://wordpress.org/support/topic/trying-to-add-custom-post_row_actions-for- custom-post-status Row actions for custom post types? http://wordpress.org/support/topic/replacement-for-post_row_actions http://www.ilovecolors.com.ar/saving-custom-fields-quick-bulk-edit-wordpress/


title: echo menu_order value in my theme

text: I thought this would be a simple task, but I cannot find anything on google. I would simply like to echo the meun_order value in my loop. I tried this but it's not in the post_meta table, its in the post's table.               <?php echo get_post_meta($post->ID, 'menu_order', true); ?>      Can anyone help please? Thanks Josh


title: Memory Outages - Need PHP/WP/IT expert

text: I am constantly experiencing memory outages on my server. The server is forking and spawning new connections like crazy. I have a VPS with WHM installed. This is the reply from my host: "The issue appears to be that your server is consistently hitting its memory resources. We've made adjustments already to the common causes such as your dns server spawning a thread for every CPU it sees on the new system, but I'd suggest you look into configuring your server a bit more to minimize memory usage. Your apache server's MaxClients setting seems to be fairly high as well, but was not able to weed through your configuration files to see where it is set." I entered through shell and tweaked the httpd.conf file a million times changing Maxclients, MaxRequestsPerChild, and MaxKeepAliveRequests all to no avail I am monitoring using TOP in WHM and the beancounter through putty (shell), and I see a ZILLION memory outages. I have absolutely NO IDEA what is sucking up all this memory. I have even gone through IP banning to see if robots were sucking up memory, but either I was unable to get the correct info or this is not the issue. IT/WP/PHP eprt neede BAD Thanks


title: Plugins in symlinked directories?

text: When I develop plugins I test them on multiple versions of WordPress by symlinking my plugin directory in the different `wp-content` directories. This is great since I only have to edit the files once, but it breaks an important construct to generate references to resources in my plugin: `__FILE__` refers to the physical plugin location, not the one in `wp-content`. How should I solve this? My directory structure looks like this:   * `/path/to/wordpress/development/dir/`     * `plugin-development/`       * `monkeyman-rewrite-analyzer/`         * `monkeyman-rewrite-analyzer.php`         * `js/`           * `monkeyman-rewrite-analyzer.js`     * `versions/`       * `3.1/`         * `wp-content/`           * `plugins/`             * `monkeyman-rewrite-analyzer` as a symlink to the above plugin       * `3.1-multi-dir/`         * `wp-content/`           * `plugins/`             * `monkeyman-rewrite-analyzer` as a symlink to the above plugin       * `3.1-multi-domain/`         * `wp-content/`           * `plugins/`             * `monkeyman-rewrite-analyzer` as a symlink to the above plugin If I want to enqueue the Javascript file, I should use `plugins_url( 'monkeyman-rewrite-analyzer.js', [base file] )`, but using `__FILE__` here will not work, because the actual file path will be `/path/to/wordpress/development/dir/plugin-development/monkeyman-rewrite- analyzer/monkeyman-rewrite-analyzer.php`, not `/path/to/wordpress/development/dir/versions/*/wp-content/plugins/monkeyman- rewrite-analyzer/monkeyman-rewrite-analyzer.php`, so WordPress cannot strip the first part out and generate a URL relative to the WordPress installation.


title: wp_verify_nonce vs check_admin_referer

text: What is the difference, which one should I use? I know that wp_verify_nonce checks the time limit, and check_admin_referer I think calls wp_verify_nonce as well as checking for an admin url segment, but I'm a bit confused on which one I should use and when. Thanks for the clarity.


title: How to remove duplicate Custom Fields?

text: I have migrated my blog from blogspot to WordPress. Then I have noticed many of the posts contain duplicate custom fields. Like blogger_author, blogger_permalink, blogger_blog are duplicated upto 5 times. How can I remove the duplicate Custom Fields?


title: Notices when submitting custom post type from front-end

text: I have a form in a page template that allows users to submit posts into a custom post type from the front-end:               $post = array(         'post_status' => 'draft',         'post_type' => 'stories',         'post_content' => wp_kses_post( $story_content ),         'post_title' => esc_attr( wp_kses( $story_title, array() ) ),         'post_author' => 4,     );          // Insert story into db     $post_success = wp_insert_post( $post );      It works, but I receive these notices               PHP Notice:  Trying to get property of non-object in /Users/username/Sites/the_site/wp-includes/comment-template.php on line 776     PHP Notice:  Trying to get property of non-object in /Users/username/Sites/the_site/wp-includes/comment-template.php on line 793     PHP Notice:  Trying to get property of non-object in /Users/username/Sites/the_site/wp-includes/general-template.php on line 1645     PHP Notice:  Trying to get property of non-object in /Users/username/Sites/the_site/wp-includes/link-template.php on line 1106     PHP Notice:  Trying to get property of non-object in /Users/username/Sites/the_site/wp-includes/link-template.php on line 1148     PHP Notice:  Trying to get property of non-object in /Users/username/Sites/the_site/wp-includes/link-template.php on line 1106     PHP Notice:  Trying to get property of non-object in /Users/username/Sites/the_site/wp-includes/link-template.php on line 1148      I've looked at the files referenced, and it seems to be related to the `comment_status` and `ping_status` of the submitted post, however, I assume that the defaults for `wp_insert_post` should input values for those. Even when I set them in my args array, I get the notices. How to fix this to get rid of the notices?


title: Create a Page Template Which Displays All Posts by Current User

text: I would like to create a page template that will display all of the posts by the currently logged in user. I managed to find an older thread which contained this code:               if ( is_user_logged_in() ):          global $current_user;     get_currentuserinfo();     $author_query = array('posts_per_page' => '-1','author' => $current_user->ID);     $author_posts = new WP_Query($author_query);     while($author_posts->have_posts()) : $author_posts->the_post();     ?>         <a href="<?php the_permalink(); ?>" title="<?php the_title_attribute(); ?>"><?php the_title(); ?>            <?php                endwhile;          else :          echo "not logged in";          endif;      however, the code does not appear to work (in fact, any page using the template which contains it simply won't load).


title: How to add favicon to my site - in both front end and admin panel

text: How can I add favicon to my WordPress site in both front end, and admin panel. I've tried many ways, but failed. I know, to show favicon the code is:               <link rel="shortcut icon" href="images/favicon.ico" />      How can I implement it?


title: Insert data through a script directly in the db

text: is it possible to insert data through a script or HTML site into the wpdb and this will show up as normal article in the, the same as when I use the 'create new post' page? Which tables are affected or should I care about? BR, mybecks


title: Using native wp image support instead of timthumb

text: After having no luck with timthumb, and on the advice from this site I am going to edit my theme so it works using native wp functions. However I'm a little stuck. I found this http://wpquestions.com/question/show/id/1098 Which appears to be a function which will resize images on the fly, but I'm not totally sure how to use it in my theme. In addition to that, I know there is the normal thumbnails feature in WP - but how would I use that instead of timthumb which currently is just a url in my image source?


title: Single post layout based on featured image size

text: **I have** two minimum image sizes to play with. One is 420x640px ("standing") and the other one is 980x420px ("landscape"). The normal loop with a regular layout is in place in my theme. **The goal** is to produce a layout for a single post that first check the size of the featured image (ie. "check if post has featured image size max width of 420px, if true addclass layout-single-post-standing" or something like that). I have been reading about responsive design but I am a beginner when it comes to that. Do any of you have an idea on where to start with this? **UPDATE:** Dictating layout based on the size of a featured image could be considered a flimsy mechanism. As it panned out this method worked very well. By making use of the built-in twentyten_header_image_width feature (functions.php) and extending it with several conditional statements (wp_get_attachment_image_src and more) in the WP Loop, as well as setting several (add_image_)sizes, we managed to pull it off. It is a very complex WP Loop with tons of echos but it meet our goal of using featured image size to decide on what layout to present to the visitor.


title: Alternate header image

text: Is there a convenient and configurable way to alternate between different header images? The main features I'm looking for are:   * Random select from a set of images   * Specific header image in given date range (a la Google Doodle)   * Specific header image for specific posts or pages


title: Wordpress is picking up links that don't exist

text: users online plugin and every time i go to check, i always see that most users are on a page that says "page not found" and this is the url that i am getting from it http://www.celebloid.com/wp-content/plugins/lightbox- gallery/js/jquery.lightbox.js the problem is that directory "lightbox-gallery" doesn't exist. How do i solve this prblem


title: Explanation for apply_filters function and its variables

text: I'm learning how to build html forms using PHP by taking an example from "simplr form registration" plugin. I'm looking at this code:               $form .= apply_filters('simplr-reg-instructions', __('Please fill out this form to sign up for this site', 'simplr-reg'));      Can you please explain what is happning here - what the function does, why is the need for 'simplr-reg-instructions' and 'simplr-reg'? Why can't this line simply be:               $form .= 'Please fill out this form to sign up for this site' ;      I've read the function reference but still can't figure it out.


title: Navigation menu not being assigned Theme Location

text: I am setting my navigation menu up using the following snippet in my `functions.php`.               add_action( 'init', 'add_menus' );             function add_menus() {                          register_nav_menus(                         array(                             'main_nav' => 'Main Navigation',                             )                         );          $new_menu_id = wp_create_nav_menu( 'Navigation' );                       $menu1 = array('menu-item-title' => 'Home','menu-item-object' => 'page','menu-item-object-id' => get_page_by_path('home')->ID,'menu-item-type' =>     'post_type','menu-item-status' => 'publish');              $menu2 = array('menu-item-title' => 'Register','menu-item-object' => 'page','menu-item-object-id' => get_page_by_path('register')->ID,'menu-item-type'     => 'post_type','menu-item-status' => 'publish');              $menu3 = array('menu-item-title' => 'Login','menu-item-object' => 'page','menu-item-object-id' => get_page_by_path('login')->ID,'menu-item-type' =>     'post_type','menu-item-status' => 'publish');          // add a menu item to that new menu     wp_update_nav_menu_item( $new_menu_id, 0, $menu1 );     wp_update_nav_menu_item( $new_menu_id, 0, $menu2 );     wp_update_nav_menu_item( $new_menu_id, 0, $menu3 );          // set our new MENU up at our theme's nav menu location     set_theme_mod( 'nav_menu_locations' , array('main_nav' => $new_menu_id ) );     }      When I create a new multi-site it generates the menu and the menu items, however it does not assign the Theme Location as set by:               set_theme_mod( 'nav_menu_locations' , array('main_nav' => $new_menu_id ) );      If I delete the menu and then refresh it does then assign it correctly, any idea what is going on?


title: Is a permastruct possible on pages?

text: Since a couple of weeks I'm trying to create my own rewritings on pages. I read a lot about rewriting with posts and custom post-types. BUT: I have pages that I call with variables. How is it possible to bring these variables into a permalink-structure? Currently, I have:               www.mysite.com/pagename/?arg1=value1&arg2=value2      but I want to have something like               www.mysite.com/pagename/value1/value2      I have fount the hook post_link which seems to be used on pages and page_link for pages. But page_link doesn't work in the same way. How can I do, what I want to do? Please help!


title: get_the_ID not returning correct ID value

text:
I have a loop (the_loop) to echo featured images on my slider but I need to filter it to specific post ID only. But get_the_ID is not working. Here's my code               <?$valid_post_id('1','2','3','4');?>     <?php while( have_posts() ) : the_post(); ?>            <?if(in_array(get_the_ID(),$valid_post_id)):?>
                  <div id="post-<?php the_ID(); ?>" <?php post_class(); ?><?php if( isset( $thumbnail ) ) : ?> style="background:url(<?php echo $thumbnail[0]; ?>) center no-repeat"<?php endif; ?>>

                         <a class="overlay" href="<?php the_permalink(); ?>" rel="bookmark">

<a href="<?php the_permalink(); ?>" title="<?php the_title_attribute(); ?>" rel="bookmark"><?php the_title(); ?>

                                 <?php the_excerpt(); ?>

            <?endif;?>     <?php endwhile; ?>


title: Run A Function When A New Site Is Created In Wordpress Using Multisite

text: i am currently developing a multi-site plug-in for word press.. i need to Run A Function When A New Site Is Created In Wordpress Using Multi- site


title: Using WordPress as piecemeal in existing site?

text: After some solid advice from people on here about using WordPress for a small (six page) website, I wanted to broach another question regarding using WordPress for a non-blogging site. Yet, I know my client would like to update various, but small portions of their site from time-to-time. I won't be installing WP in the root, but a sub-directory and have all my core site files sitting in the root. Here are my questions: Can I include content from Pages in WordPress and output that content on any page outside of the WP install directory? Is there something specific I would need to include? Do I have to use a Theme or can I still use my already built CSS? I'd like to be able to use my own CSS for the site and not have it be tied to a Theme - is that possible? Meaning I use www.example.com/css/styles.css vs www.example.com/wp-content/themes/styles.css. I also have a slider comprised of three DIVs for each panel, can I pull in that specific Page with that markup for the slider? Can I also make my own queries for data as well? Is there anything that I won't be able to accomplish or advise against doing? I'm mostly concerned about having to use a Theme, mostly because I don't know if I'll need to use it or not. Thanks for any help.


title: Override methods in Yoast SEO breadcrumb class

text: I've been trying to figure out if it is possible to override the output of the Yoast SEO breadcrumb class rather than editing the original file? Each url segment is wrapped in `<span></span>` but i'd like to wrap it in `<li></li>` Is this possible? Any pointers in the right direction would be appreciated. Thank you.


title: show un-approved comments at wordpress front end

text: I've almost finished coding up a function that allows **contributers** when they are the post author to manage comments left on their own post (portfolio) couldnt find a plugin to do it so had to get myself dirty. It will basically work like this: 1) User leaves a comment on post_authors portfolio. 2) Post_author is notified by email that they have a comment for moderation (this bit is handled by a plugin "notify-on-comments"). 3) Post_author logs in and goes to his/her portfolio page and in the comments are two links one for "delete" and one for "approve" comment. Now i can get the delete to work on **already published comments** , my problem is that i am wanting to **show the unpublished comment along with the published comments** (dont want folks having access to wp-admin dashboard to moderate comments, i want it all done on the front end), Does anyone know how i can do this part of showing the un-approved comment at front-end to contributers? Once completed i will be more than happy to share the code and credits should anyone else need it. Regards and thanks in advance


title: Rewrite rule help for gallery plugin

text: I am writing a basic gallery plugin for WordPress. In the plugin users can mark images as favorites and there is a page where users can see their favorites. I want to setup some rewrite rules for the galleries (domain.com/page/gallery/gallery-name) instead of query string variables (domain.com/page/?gallery=gallery-name) In my plugin settings, users can select a page for the plugin to run off. I store the page ID and want to use this as a base for everything in the galleries. Example URLs would be:   * domain.com/page - This would show the list of all the galleries   * domain.com/page/gallery/gallery-name - Gallery page with thumbnail images   * domain.com/page/gallery/gallery-name/2 - Paginated   * domain.com/page/image/image-name - Single image with various details   * domain.com/page/favorites - Listing images marked as favorites The add_rewrite_rule stuff is somehow completely confusing me and I can't get anything to work. I am using flush_rewrite_rules(), I know that is a common mistake when trying to setup custom rewrite rules. EDIT: I made progress and here is what I have so far:               $home = get_post($home_id);     // Gallery     add_rewrite_rule($home->post_name."/gallery/([^/]+)/page/?([0-9]{1,})/?$",'index.php?p=4&sunshine_gallery=$matches[1]&paged=$matches[2]','top');       add_rewrite_rule($home->post_name."/gallery/([^/]+)/?$",'index.php?p=4&sunshine_gallery=$matches[1]','top');       add_rewrite_rule($home->post_name."/gallery/([^/]+)/?$",'index.php?pagename='.$home->post_name.'&sunshine_gallery=$matches[1]','top');      // Image     add_rewrite_rule($home->post_name."/image/([^/]+)/?$",'index.php?pagename='.$home->post_name.'&sunshine_image=$matches[1]','top');       However, the pagination rules are not catching and the 'paged' variable is always 0.


title: WP custom routing does not work

text: I am trying to get custom rounting on WP without any plugins. I have a bunch of links looks like this: http://example.com/u/UserNickname11 I've created a page with slug = "userinfo" and added such code in function.php of theme:               add_action('init', function(){         add_rewrite_tag('%username%', '([^&]+)');         add_rewrite_rule('^u/([^/]+)/?', 'index.php?pagename=userinfo&username=$matches[1]', 'top');     }, 10);      This is not works (showing 404 wordpress page), meantime /index.php?pagename=userinfo&username=3323 works well. What I am doing wrong? Added: I made this working by changing permalink options to "default" and back to "custom". And it is works now. But I need an answer - how I can get new custom routes working without making this?


title: Exclude current post from loop

text:
I have a custom post type for accessories. When you view the post it also shows related posts. It looks great, but it also shows the current post within related posts. Is there a way to exclude the current post from the loop?
         <?php          $category = get_the_category();          $model = $category[1]->cat_name;         $accessory = array('numberposts' => 8, 'offset'=> 1, 'post_type' => 'accessory', 'category_name' => $model, 'order' => 'DESC');         query_posts( $accessory );        ?>           <?php if (have_posts()) : ?>            <?php while (have_posts()) : the_post(); ?>
                 <?php wp_link_pages( array( 'before' => '
' . __( 'Pages:', 'openeye' ), 'after' => '
' ) ); ?>
<?php the_title(); ?>
                 Part Number: <?php echo get_post_meta($post->ID, "accessory-part-number", true); ?>                 <?php $desc = get_post_meta($post->ID, "accessory-description", true); ?>
<?php echo utf8_truncate( $desc ); ?>
                 <a href="<?php echo get_permalink(); ?>">Learn more about the <?php the_title(); ?>
             <?php endwhile; ?>           <?php endif; ?>


title: Daily posts like an archive

text: I need to show 30 daily posts in the main page of a site. I also need to put 2 links, one that gets to a new page showing 30 posts made yesterday and the other to show 30 posts of 'tomorrow' if I'm looking at an older page. I tried to use `wp_get_archives( array( 'type' => 'daily', 'limit' => 1 )`, but the thing is that now I have a page that shows a list of dates, and I need to click it to see the posts. Is there a way form me to show the posts as soon as the visitor opens the site?


title: Any way to create a revision of a post ONLY with a new button in the Meta Box?

text: Quite sure there isn't a way baked in to do this, but anyone have any ideas on how I would get something like this done? I want to turn autorevisions off and ONLY have a revision created when a button is clicked (probably custom button placed in the meta box). Would be a super useful way to do more of a version control scenario with the posts instead of revisions every time you fix a spelling error. For instance, could we use this and tie it to a button click?                  /**      * Saves an already existing post as a post revision.      *      * Typically used immediately prior to post updates.      *      * @package WordPress      * @subpackage Post_Revisions      * @since 2.6.0      *      * @uses _wp_put_post_revision()      *      * @param int $post_id The ID of the post to save as a revision.      * @return mixed Null or 0 if error, new revision ID, if success.      */     function wp_save_post_revision( $post_id ) {         // We do autosaves manually with wp_create_post_autosave()         if ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE )             return;              // WP_POST_REVISIONS = 0, false         if ( ! WP_POST_REVISIONS )             return;              if ( !$post = get_post( $post_id, ARRAY_A ) )             return;              if ( !post_type_supports($post['post_type'], 'revisions') )             return;              $return = _wp_put_post_revision( $post );              // WP_POST_REVISIONS = true (default), -1         if ( !is_numeric( WP_POST_REVISIONS ) || WP_POST_REVISIONS < 0 )             return $return;              // all revisions and (possibly) one autosave         $revisions = wp_get_post_revisions( $post_id, array( 'order' => 'ASC' ) );              // WP_POST_REVISIONS = (int) (# of autosaves to save)         $delete = count($revisions) - WP_POST_REVISIONS;              if ( $delete < 1 )             return $return;              $revisions = array_slice( $revisions, 0, $delete );              for ( $i = 0; isset($revisions[$i]); $i++ ) {             if ( false !== strpos( $revisions[$i]->post_name, 'autosave' ) )                 continue;             wp_delete_post_revision( $revisions[$i]->ID );         }              return $return;     }      Would love to hear what you experts have to say! Thanks UPDATE: It seems as if this will be the way to go: remove_action('pre_post_update', 'wp_save_post_revision'); But I'm having trouble tying that to a specific button.. I don't want to disable revisions completely, and I don't want it to apply every time any button is pressed, just momentarily when this button is pressed. Thanks for your input!


title: unexpected problem in url rewrite

text: As per the answer provided in How to create custom URL routes? I have created the rewrite rule using the same function provided.               add_action( 'init', 'wpse26388_rewrites_init' );     function wpse26388_rewrites_init(){         add_rewrite_rule(             'gallery/([0-9]+)/?$',             'gallery?custom_gallery_id=$1',             'top' );             }      After the flushing of the rules `.htaccess` file was having the following rule :               RewriteRule ^gallery/([^/]+)/?$ /wordpress/gallery?custom_gallery_id=$1 [QSA,L]      upto this point everything was fine then I tried to make some modifications in the rule like               add_action( 'init', 'wpse26388_rewrites_init' );         function wpse26388_rewrites_init(){             add_rewrite_rule(                 'topic/([^/]+)/([^/]+)/gallery/([0-9]+)/?$',                 'gallery?custom_gallery_id=$3',                 'top' );                 }      this doesn't seems to be working at all. can anybody help me over this? thanks in advance.


title: How can I connect to another WP database and use WP_Query?

text: I can connect to the other database with `$db2 = new wpdb( $user, $pass, $db, $host );`, but **how to I get`WP_Query()` to use `$db2`**? I want to be able to use the loop just the same with `$db2` as I can with the original connection.


title: Override WooCommerce page-specific js in my theme

text: How can I replace the WooCommerce page-specific .js files with my own versions? For example on the cart page there's /plugins/woocommerce/assets/js/frontend/cart.min.js but I'd like to load /themes/mythem/woocommerce/js/cart.min.js in its place.


title: How would I use pre_get_posts to query another site for posts in my multisite network?

text: I have a multisite network of sites which should display blog content from each other if the blog post has a tag with the site name. To gather all posts within the network I use the SWT (Sitewide Tags) plugin as it seems most efficient. I store all posts in the main site (blog id 1) and from my other sites I want to query the main sites posts table for posts containing a tag with the querying site's domain name. I have working code in a page template (`home.php`) - see below - but I understand the action `pre_get_posts` are the way to go, but I can't seem to figure out how to change the table to query. Should I perhaps do a JOIN in the action `posts_join`? If my solution seems to be way more complicated than it should be, feel free to bash me with other suggestions :) This is my current template code:               $tags = array(         'lundalogik-se'     );     switch_to_blog(1);     $paged = ( get_query_var( 'paged' ) ) ? get_query_var( 'paged' ) : 1;     $wp_query = new WP_Query(array(         'post_status' => 'publish',         'paged' => $paged,         'orderby' => 'date',         'order' => 'desc',         'tag' => implode(",", $tags)     ));          while (have_posts()) : the_post();       [..]      How can I rewrite this in `pre_get_posts`? _Note; as you see the tag I'm searching for is static at the moment, this will change to match the domain name + ccTLD of the querying site or something similar later on._ _Note 2; I'd rather not use`switch_to_blog()` since I read it's expensive but haven't found a best practice for querying other blogs inside a network. Should I set the table name to query manually instead?_ I have read most posts both here, in blogs and in the Codex (WP_Query, pre_get_posts etc.) touching multisite querying but almost all talks of using switch_to_blog and restore_current_blog.


title: How to redirect the home page to a custom page?

text: I had a WordPress site which was moved to a directory called "test". Now, all the urls for the wordpress site is domain.com/test, /test/wp-admin. The main index page is a custom html page for domain.com. Now, I want to move the WP back to the root directory but let the domain.com point to the same custom html page. How can I achieve this? The custom html page is independent of the theme used in the WP site. Thanks


title: Category foreach Paging

text:
I'm using the following code to display categories on my homepage, what I'd like to do is add the ability for paging with previous and next links, I haven't been able to figure out how to do this with a `foreach` can anyone point me in the right direction? **Original Code:**               <?php          $cat = get_cat_ID("Photos");         $categories = get_categories("child_of=$cat");     ?>     <?php if (is_array($categories) && count($categories) > 0) : ?>         <?php foreach ($categories as $category) { ?>             <?php query_posts("cat=$category->cat_ID&orderby=rand&posts_per_page=1"); ?>                 <?php while (have_posts()) : the_post(); ?>                     <a href="<?php bloginfo('url'); ?>?cat=<?php echo $category->cat_ID; ?>"><?php the_post_thumbnail("gallery-thumb"); ?>                 <?php endwhile; ?>             <?php wp_reset_query(); ?>         <?php query_posts("cat=$category->cat_ID&orderby=name&posts_per_page=1"); ?>
<a href="<?php bloginfo('url'); ?>?cat=<?php echo $category->cat_ID; ?>"><?php single_cat_title(); ?>
         <?php wp_reset_query(); ?>         <?php $query = $category->count; ?>         <?php if ($query == 1) $query .= " Image"; else $query .=" Images"; echo '
('.$query.')
'; //Album Count ?>     <?php } ?>     <?php else : ?>
I hate to break it to you...but right now there are no albums available for viewing, please try again later.
     <?php endif; ?>      **Code Update:**               <?php         $parent = get_cat_ID("Photos");         $cats = get_categories("child_of=$parent");     ?>     <?php foreach ($cats as $cat) { ?>         <?php echo $cat->name; ?>         <?php $query = $cat->count; ?>         <?php if ($query == 1) $query .= " Image"; else $query .=" Images"; echo '
('.$query.')
'; //Album Count ?>     <?php } ?>      Thanks,   Josh


title: Wordpress WP_Query compare not working?

text: There are my arguments for my custom `WP_Query`.               $args = array(         'post_type' => 'post',         'posts_per_page' => '9',         'name'=>'Products',         'compare'=>'LIKE'     );     $the_query = new WP_Query( $args );     echo $the_query->request;      which returns the following query:               SELECT wp_posts.*      FROM wp_posts      WHERE 1=1          AND wp_posts.post_name = 'products'          AND wp_posts.post_type = 'post'      ORDER BY wp_posts.post_date DESC       As I can see, this is not creating a `LIKE` query like I'd like to have one.


title: 404 with Custom Post Type

text: I'm having some issues here. Im trying to create a custom post type (acessorio) and some categories for it (acessorios_categories). So, what happens is that none of both works. Gives me 404 in both cases. Alterady tried to flush the htaccess. Creating single-acessorio.php too. Dont work. Here's my code:                       add_action('init', 'register_acessorios');             function register_acessorios() {             register_post_type('acessorio',                       array(     'labels' => array(                                     'name' => 'Acessórios',                                     'singular_name' => 'Acessório',                                     'menu_name' => 'Acessórios',                                     'all_items' => 'Todos os Acessórios',                                     'add_new' => 'Adicionar Novo',                                     'add_new_item' => 'Adicionar Novo Acessório',                                     'edit_item' => 'Editar Acessório',                                     'new_item' => 'Novo Acessório',                                     'view_item' => 'Ver Página do Acessório',                                     'search_items' => 'Buscar Acessórios',                                 ),                                 'public' => true,                                 'show_ui' => true,                                 'exclude_from_search' => false,                                 'query_var' => true,                                 'show_in_menu' => true,                                 'capability_type' => 'post',                                 'hierarchical' => false,                                 'publicly_queryable' => true,                                 'has_archive' => false,                                 'supports' => array('title','editor','thumbnail',),                                 'taxonomies' => array('acessorios_categories',),                                 'menu_position' => 5,                                 ) );             }                       function add_acessorios_tax() {                  // Add new "Locations" taxonomy to Posts                  register_taxonomy('acessorios_categories', 'post', array(                       // Hierarchical taxonomy (like categories)                       'hierarchical' => true,                       // This array of options controls the labels displayed in the WordPress Admin UI                       'labels' => array(                            'name' => _x( 'Categorias', 'taxonomy general name' ),                            'singular_name' => _x( 'Categoria', 'taxonomy singular name' ),                            'search_items' =>  __( 'Buscar Categorias' ),                            'all_items' => __( 'Todas as Categorias' ),                            'parent_item' => __( 'Categoria Pai' ),                            'parent_item_colon' => __( 'Categoria Pai:' ),                            'edit_item' => __( 'Editar Categoria' ),                            'update_item' => __( 'Atualizar Categoria' ),                            'add_new_item' => __( 'Adicionar Categoria' ),                            'new_item_name' => __( 'Nova Categoria' ),                            'menu_name' => __( 'Categorias' ),                       ),                       // Control the slugs used for this taxonomy                       'rewrite' => array(                            'slug' => 'acessorios', // This controls the base slug that will display before each term                            'with_front' => true, // Don't display the category base before "/locations/"                       ),                  ));             }             add_action( 'init', 'add_acessorios_tax', 0 );                  flush_rewrite_rules( false );      Thanks for any help!


title: Add a term to an attachment submitted from front end

text: I have a front end post form where users can upload a file with their post that I save as an attachment using `media_handle_sideload()`. I need a way to add a term to that attachment so I can show a loop of all specific attachments by a user with that term.


title: Post-thumbnail only for specific post-types?

text: I have this in my `functions.php`               add_theme_support( 'post-thumbnails' );      This means all my post-types (normal posts and custom-post-types) have post- thumbnails enabled. Is it possible to just enable them inside a custom-post-type and not on normal posts?


title: AJAX post into pop-up div

text:
I want to AJAX post content into a pop-up div when I click on the post / page link. I have come up with the following code: Relevant HTML / PHP:
     <?php if (have_posts()) : ?>     <?php while (have_posts()) : the_post(); ?>
<a href="<?php the_permalink() ?>"><?php the_title();?>
     <?php endwhile; endif; ?>

      jQuery:               $('#hover-box').hide();     $('.links a').click(function( ) {         var url=$(this).attr('href');         $('#hover-box').fadeIn();         $('#hover-box').load(url + ' article');         return false;         });      This works fine, but I'm wondering if anyone could point out the drawbacks to this approach. Other solutions I've found (e.g. http://wordpress.stackexchange.com/a/41062/18329) seem much more complicated. Should I be using additional PHP? Other solutions also make use of admin- ajax.php (e.g. http://deadlyhifi.com/2011/12/loading-frontend-ajax-content-in- wordpress/). Any help / advice greatly appreciated!


title: Is there any action/filter hook to use when an image gets edited in the editor?

text: I can't find a specific hook. If I already have added an image to an article via editor and then I edit it, I'd like to intercept the code just before it is sent again to the editor. I already use 'image_send_to_editor' but it works on the first image insertion, not if the image gets edited. Can you help me please?


title: Include other parameters in permalinks for better management of browser history

text: In single.php, I have the following items that I manage (create, update, hide) with jquery/ajax:   * a `<select>` tag in which I return all website categories.   * a second `<select>` tag in which I return post titles depending on the selected category in first `<select>` tag.   * a `<div>` tag which contains a content based on the selected post in second `<select>`. This content is divided into tabs. On click on a tab, I display via ajax a meta value of the custom field related to this tab for the specific post selected in second `<select>` . In addition, I am making a jquery pagination system for each tab whenever the meta value is long. All jquery/ ajax actions are working like a charm respecting all rules of DOM updating and scripts reloading after triggering actions on updated DOM. In sum, I have 4 parameters while navigating in single.php:   * current category of post (returned by php).   * current post id (returned automatically since we are in single.php).   * current tab.   * current page inside tab. The problem is that I am actually including `history.js` to my website so that I can manage the history stack and the clicks on browser back-forward buttons. Actually, the only URL structure I am having is:               mywebsite.com/?p=post_id      As you know, Wordpress allows navigating between posts by only changing `p` parameter, so this url structure is maintained during all navigation. And inside each post page, I can do further navigation via AJAX, but keeping the same post permalink in adress bar, which is not good for history management, SEO, bookmarking..... How can I add the other 2 last parameters (current tab, current page) in an efficient way so that my URLs become like:               mywebsite.com/?p=post_id&tab=tab_number&pagi=pagi_number      Doing so, I think I can perform conditionnal tests inside `History.Adapter.bind(window, 'statechange', function() {}` so that I run history actions based on the values of the 3 parameters (current post_id, current_tab and current_page). Do you have an idea or a better approach for doing such? Making my website full jquery-ajaxified, respecting history and using wordpress is an issue that I am digging to resolve for a long time. Your help is really appreciated.


title: Wordpress PHP error handling and reporting in production environment

text: I'm trying to find a solution on how to handle the displaying and logging of errors in a PHP (Wordpress) production environment. **Is it possible to do the following (alternative suggestions welcome):**   * _Capture critical errors and send immediate email notification (this looks like a promising solution, but haven't tested in my production env yet)._   * _Don't display PHP errors on screen to visitors. Instead display a custom built error page. Something that's friendlier than the PHP "white screen of death". This includes the Wordpress specific errors, like the "Error establishing a database connection" one._ **Production environment details specific to this question:**   * WordPress 3.5.1   * Web Host: Windows Azure Cloud   * Web Server: IIS 7.5 **What I've already configured:**   * Development (local), Staging and Production enviroments   * Code is managed in source control (Team Foundation Server Version Control)   * Tested builds are pushed to production (Windows Azure Cloud)   * I have configured wp-config for multiple environments:     * Development and Production connect to different databases.     * Development configs:       * WP_DEBUG = true       * WP_DEBUG_DISPLAY = true       * WP_DEBUG_LOG = true       * display_errors (via @ini_set) = true     * Production configs:       * WP_DEBUG = false       * WP_DEBUG_DISPLAY = false       * WP_DEBUG_LOG = true       * display_errors (via @ini_set) = false


title: Specific upload folder for PDFs in custom Post type in WP multisite

text: I need to filter uploads to a specific folder for a custom-post type called "document" only for PDFs. So far, I have:               function custom_upload_directory( $args ) {     $base_directory = '/home/xxx/my_uploadfolder';     $base_url = 'http://xxxx/wp-content/uploads/my_uploadfolder';          $id = $_REQUEST['post_id'];     $parent = get_post( $id )->post_parent;     // Check the post-type of the current post          if( "document" == get_post_type( $id ) || "document" == get_post_type( $parent ) ) {         $args['path'] = $base_directory;         $args['url']  = $base_url;         $args['basedir'] = $base_directory;         $args['baseurl'] = $base_url;          }          return $args;     }     add_filter( 'upload_dir', 'custom_upload_directory' );      It works, but with some problems: : any kind of file is redirected in my_uploadfolder. Also, I can't delete these files from WP admin once there. Can somebody help?


title: Pass data from one page to anothe file/page in wordpress

text:
I have my custome theme in wordpress.This is the path of my custome theme. **C:\wamp\www\wordpress2\wp-content\themes\sscy1002\sscy1002** I have created a Page in wordpress which contains some form elements. Here is my Page Code :                <form action="<?php bloginfo('stylesheet_directory'); ?>/Query.php" enctype="multipart/form-data" method="post" name="contact">     Name: <input class="required input_field" id="author" type="text" name="author" />

         Email: <input class="validate-email required input_field" id="email" type="text" name="email" />

         Subject: <input class="input_field" id="subject" type="text" name="subject" />

         Message: <textarea class="required" id="text" cols="0" name="text" rows="0"></textarea>

         Image:<input type="file" name="file" />              <input class="submit_btn float_l" id="submit" type="submit" name="submit" value="Send" />         <input class="submit_btn float_r" id="reset" type="reset" name="reset" value="Reset" />              </form>      And here is my Query.php code under **C:\wamp\www\wordpress2\wp- content\themes\sscy1002\sscy1002** directory :               <?php     get_header();     ?>          <?     $name=$_POST['author'];     $email=$_POST['email'];     $subject=$_POST['subject'];     $message=$_POST['text'];     $image=$_FILES['file']['name'];     move_uploaded_file($_FILES['file']['tmp_name'],"imagess/".$image);     echo $name."
";     echo $email."
";     echo $subject."
";     echo $message."
";     echo "";     ?>     <?php     get_footer();     ?>      But when I am submitting form I am getting fatal error : **Fatal error: Call to undefined function get_header() in C:\wamp\www\wordpress2\wp-content\themes\sscy1002\sscy1002\Query.php on line 2** Please help me how to pass transfer data from one page to another file(or if Page) in wordpress. I also searched answer on google but and tried all the way which I got from google but not working. Sorry about wrong formatting of Question. Please help me!!!! Thanks!!!


title: Why is WP_Query not working with category_name?

text:
Why on earth is this piece of code not working?                   $my_query = new WP_Query('category_name=feature');         while ($my_query->have_posts()) : $my_query->the_post();             echo 'test';         endwhile;      I've tried with `Feature` and `feature`, no difference. I need to get post by category name. Any help appreciated. **update** This is not working either: `$my_query = new WP_Query('cat=3');` **code**               // index.php          <?php         include_once('header.php');     ?>

             <?php             query_posts( 'cat=3&posts_per_page=5' );                  while ( have_posts() ) : the_post();                 echo 'test';             endwhile;                       ?>

          <?php         include_once('footer.php');     ?>


title: conditional: if is page, and all subpages

text: What I'm currently trying to achieve is displaying certain menus on certain pages using one template and conditional statements, like so:               if (is_page('donate')){     wp_nav_menu(array(                 'menu'  =>  'donate',                 'container' => false,                 'menu_class'      => 'side-menu'             ));     } elseif (is_page('about-us')) {     wp_nav_menu(array(                 'menu'  =>  'about',                 'container' => false,                 'menu_class'      => 'side-menu'             ));     }      As all these pages use the same template I needed something that allowed the relevant submenus to display on the relevant pages, which works fine. The problem I'm now having though, is that both pages `donate` and `about` (and more to follow) have subpages, is it at all possible to display the relevant menu on ALL the subpages as well? Thus if you're on the donate page, or a child of the donate page the donate menu will be displayed, etc.


title: Building Forums with Custom Post Types

text: I'm trying to build some sort of a discussion boards by using custom post types and the built in comments. The structure is as following: An archive page to list all the pages of the Forum type, so each page is a "forum" Each "forum" has a title , a small description and then some threaded comments as threads with replies I think I'm at the right direction here, but I have a couple of question and maybe some one could assist me with them:   1. Is it possible to have user to be associated with specific pages? **Example:** I'd like user A, B, C to be able to view "Forum" (page) 1; user D, E, F -> "Forum" (page) 2; etc.   2. Is it possible to have users to be redirected on sign up to their profile page, but disable all other menus in the admin area for them?   3. Is it possible to allow some users to be able to moderate comments only but not to see the other options on the site? Any help would be great.


title: changing the style of sidebar

text: I am just a newbie in wordpress.I want the colour of the sidebar widget will be different in different pages. As the id and class are both same in every pages don't know how to change that.Is there any solution of it?Any help will be highly appriciable...


title: Page is displaying blog archives

text:
I've been playing around with the jquery plugin Fancybox on this page, but for some reason since making a few changes my page seems to be displaying blog archives rather than the normal content it should be displaying. I just wondered whether people have had a similar problem? There must be something I've done wrong for this page because all of the other page's content are displaying fine. This is the code for the portfolio.php page, but it is outputting something completely different.               <?php      /* Template Name: Portfolio */ ?>
             <?php include("includes/slideshow/slideshow-home.php"); ?>

<?php the_title(); ?>

                         <?php                         /* Run the loop to output the page.                          * If you want to overload this in a child theme then include a file                          * called loop-page.php and that will be used instead.                          */                         get_template_part( 'loop', 'page' );                         ?>
                         <?php                             $loop = new WP_Query(array('post_type' => 'portfolio', 'posts_per_page' => 10));                         ?>                         <?php while ( $loop->have_posts() ) : $loop->the_post(); ?>                         <?php                             $custom = get_post_custom($post->ID);                         ?>
<a href="<?php echo get_permalink(); ?>" class="various2"><?php the_post_thumbnail('thumbnail'); ?>
                         <?php endwhile; ?>

                                      <?php get_sidebar(); ?>
              <?php get_footer(); ?>      Thanks, Ash


title: Getting lots of  errors with sitemap on google webmasters

text: I use the Google XML Sitemaps (Wordpress Plugin) and the latest wordpress version. Recently i have had a lot of 404 not found errors in webmasters. The urls show up without any categories and it links to the sitemap.xml file. It shows the url as http://mysite.com/welcome-to-my-site/ instead of http://mysite.com/general/welcome-to-my-site/ Since the categories are missing these links return a 404 not found error. These faulty links are piling up and i am in a fix. Please help.


title: Videopress Short Tags not working when pulling page into template

text: Videopress doesn't work for me when I drag multiple pages into a template e.g. pulling them in by their path name...               $page = get_page_by_path('Showreels/Excerpts');      Does anyone know how I can paste a videopress link directly into the php since the shortcode doesn't seem to work?


title: All in One Seo and Permalinks

text: I'm using All in One seo and for the Post Title Format option I have it as: %post_title% kewyord1 keyword2 etc keyword1, keyword2 being my chosen keywords for my site Also, in Permalinks, I have it as /%postname%/ so that the post name shows up in the shortlink/url So with these configurations, if I make a post in with 'Books' in the title it will look like this: Books keyword1 keyword2 etc But the shortlink, or the actual url of that post would look like this: www.mydomain.com/books it doesnt contain the keywords I assigned in All in SEO I tried changing the Permalink to /%post_title%/ but that didnt do anything Anyone know how i can automatically get these keywords to show up in the shortlink automatically with having to manually do it?


title: User roles - enable custom posts disable posts

text: Im just wondering if its possible to create user role that allows to write/edit custom post type for example: Consultants, but not allow to write normal posts (used for as news for example). I know that if user wants to edit posts its a must to have edit_post enabled for him. Question is if i can create something like: edit_[custom_post_type] or something? Thanks in avance if anyone can help me with this issue... Kindest regards


title: All text disappeared (seems to be a database problem)

text: I have an issue with text in my posts. The site is http://2buntu.com.   As I don't own the server, I cannot get direct access to some things. I don't know what caused it but I think it was a plugin I activated. Since then I've tried deactivating plugins, but nothing worked. I have tracked the source of the problem with the help of a friend, now I need to find a way to fix it (if that is even possible on my end). > "MYSQL query returned error executing query "SELECT term_taxonomy_id FROM > wp_term_relationships_img AS img WHERE img.object_id = ORDER by > term_taxonomy_id" : => You have an error in your SQL syntax; check the > manual that corresponds to your MySQL server version for the right syntax to > use near 'ORDER by term_taxonomy_id' at line 1" That is the error we get. The problem was with an image tagger plugin. I removed the plugin but wordpress is still giving trouble. I forgot to mention, the posts are not wiped; I can edit them, etc. They just render as blank. Update:   Site is still not working. I deleted the offending plugin and the table it was using, but it seems post are still not having their content rendered :(. Please! I need help!!!


title: How do I display popular USERS based on USER PAGE views?

text: My website has **user detail pages** , specifically for **Subscribers**. I would like to list, maybe 5, of the most **popular users** based on their **detail page views** within a **one month period**. How should I go about this? I'm guessing this would be based on the `author.php` page template. **UPDATE:** Found this **article** that may be relevant but it is based on **post views**. How can I **effectively** change that so it would be based on **author views** instead? **UPDATE 2:** Just in case it's quite difficult, maybe it doesn't have to be **within a one month period**... just based on **overall total views** would be fine.


title: Wordpress Rss Feed URLs not Validating on any external applications and Rss feed widget

text: My Rss Feed Urls of my wordpress website are               http://www.engineershub.in/newhome/forums/forum/jntu-kakinada-updates/feed     http://www.engineershub.in/newhome/forums/forum/jntu-anantapur/feed     http://www.engineershub.in/newhome/forums/forum/jntu-hyderabad/feed     http://www.engineershub.in/newhome/feed      I Have Used these Feed Url's in Android & Windows Applications and in some Wordpress Widgets I don't Know what happened suddenly, Android & Windows applications stopped syncing and wordpress widgets showing this following error               RSS Error: A feed could not be found at http://www.engineershub.in/newhome/forums/forum/jntu-hyderabad/feed. A feed with an invalid mime type may fall victim to this error, or SimplePie was unable to auto-discover it.. Use force_feed() if you are certain this URL is a real feed.      and when I am trying to check validation of these urls in thirdparty applications then I am getting a error "INVALID FEED" but when I directly open these URLs in browser, they are opening I Have tried all the links in google to find a solution but failed, Now all my Mobile Applications stopped working, Please some one help me


title: Custom field template missing for some custom post types

text: I'm completely new to WordPress and I am supposed to maintain a website made by someone else. This website has multiple custom post types. For each custom post type, there is a custom field template. The problem is that for certain custom post types, the custom field template is blank and does not show any fields! But for other custom post types it works fine! I have no idea why this is the case and need help! Custom Field Template is visible but there are simply no fields for me to fill in, so it's not a Screen Options problem. Screenshots here http://imgur.com/a/xphSa I've tried to check for differences in the custom field template for the template which works and the template which doesn't but I haven't found any.. The WordPress version is 3.5.1, if that matters. ~~Edit: Here's the section of the code from custom-field-template.php that contains 'meta_box' Sorry if it's too much! I don't know what's relevant..~~ The problem seems to be from the PHP code used by the custom field template. Here is the part of the template that causes the issue. If I keep either one of these two fields, all fields disappear.               [Projects]     code = 1     type = checkbox          [Authors]     code = 0     type = checkbox      The PHP code for Code 0:               $values = array();     $defaults = array();          $i = 0;     $args = array( 'post_type' => 'staff', 'showposts' => '-1');     $loop = new WP_Query( $args );     while ( $loop->have_posts() ) : $loop->the_post();       $values[] = get_post_meta(get_the_ID(), 'Name', true);     endwhile;      And for Code 1:               $values = array();     $defaults = array();          $i = 0;     $args = array( 'post_type' => 'project', 'showposts' => '-1');     $loop = new WP_Query( $args );     while ( $loop->have_posts() ) : $loop->the_post();      $name = get_the_title();      $values[] = $name;     endwhile;


title: get_option returning a different value from what's saved

text:
add_action( 'admin_init', 'register_mysettings' );     function register_mysettings() {     //register our settings     register_setting( 'plugin_options', 'plugin_options', 'plugin_options_validate' );     add_settings_section('plugin_main', '', 'plugin_section_text', 'plugin');     add_settings_field('plugin_text_string', '', 'plugin_setting_string', 'plugin',           'plugin_main');     }          function poly_admin_form() {     ?>

Change who the email and name is from
     <?php if ($_REQUEST['settings-updated'] == 'true' ) : ?>

<?php _e( 'Options saved' ); ?>

     <?php endif; // If the form has just been submitted, this shows the notification ?>     <form method="post" action="options.php">     <?php settings_fields('plugin_options'); ?>     <?php do_settings_sections('plugin'); ?>               <?php submit_button(); ?>          </form>
     <?php }           function plugin_section_text() {     echo '';     }          function plugin_setting_string() {     $options = get_option('plugin_options');     echo "
     Admin Email	     <input type='text' id='plugin_text_string' name='plugin_options[text_string]' value='{$options['text_string']}' />

         Website Name or Person Name	         <input type='text' id='plugin_text_string' name='plugin_options[text_string_name]' value='{$options['text_string_name']}' />
     ";     }                   // validate our options         function plugin_options_validate($input) {         $options = get_option('plugin_options');         $options['text_string'] = trim($input['text_string']);         $options['text_string_name'] = trim($input['text_string_name']);         if(empty($options)) {         $options['text_string'] = 'nadogrand@gmail.com';         $options['text_string_name'] = 'Polyindustry';         }          return $options;     }                       //Sends bulk email             function bulk_mail(){         poly_subscription_activation();              add_filter('wp_mail_from', 'new_mail_from');         add_filter('wp_mail_from_name', 'new_mail_from_name');              function new_mail_from($old) {          return $options['text_string'];         }         function new_mail_from_name($old) {          return $options['text_string_name'];         }


title: How To Run Multiple Multi-Site Networks On Same Box

text: I'm building a multi-site project locally using the VVV Vagrant VM. I setup a sub-domain multisite install with domain mapping and two sub-sites. Everything works fine. This was my sandbox that I used to get started and figure things out. Now I've setup a new, exact replica (obviously URLS are different) of that working multi-site network on the same VM. Everything seems fine with the primary site, but when I create a new sub-site, its broken. I'm getting 404s for the admin and front end. It's quite confusing since the setups are identical. Same configurations and vhost in nginx. Same configuration files for Wordpress config, etc. I've checked and re-checked everything. So my question is: Are there any issues trying to run two or more instances of wordpress multi-site on the same box, IE the same MySQL instance. I understand Wordpress uses the same database to add blogs to the network, and just creates new tables with a blog-ID prefix. I just cannot seem to uncover the issue here. Thanks for the help. Ok, now that I've confirmed that this is possible lets go deeper. I've already included the proper rewrites in nginx, which are seen below. Both sites use similar rewrites. VHOST:               server {         # Determines the port number that nginx will listen to for this         # server configuration. 80 is the default http port.         listen       80;              # Listen for HTTPS requests as well         # listen       443 ssl;              # Tells nginx what domain name should trigger this configuration. If         # you would like multiple domains or subdomains, they can be space         # delimited here. See http://nginx.org/en/docs/http/server_names.html         server_name  agency.dev *.agency.dev;              server_name_in_redirect    off;              # Tells nginx which directory the files for this domain are located         root         /srv/www/agency/web;              ######################################         ##  Testing rewrites to remove /wp ###         ######################################              rewrite /wp-admin$ $scheme://$host$uri/ last;         rewrite ^/(wp-.*.php)$ /wp/$1 last;         rewrite ^/(wp-(content|admin|includes).*) /wp/$1 last;              # Includes a basic WordPress configuration to help with the common         # rules needed by a web server to deal with WordPress properly.              include /etc/nginx/nginx-wp-common.conf;     }      Above you'll notice the rewrites which remove /wp from the site URL. I'm using this rewrite because I have wordpress core files in a sub-directory, as this project is setup using Roots theme with Bedrock. I did notice when I installed the network it failed the wildcard DNS test. Which is odd since theres a wildcard entry in my virtual host file.


title: Vertical alphabetically post columns

text:
I need to create a 9 column list that outputs posts sorted vertical and alphabetically. I'm getting closer, but still not there. I have two separate loops I'm working with. The first loop I have the way I want it, sorted by letter, and alphabetically in tables. Problem here is that I just cant get the styling correct. The second one I've used `wp_query_columns` function from here. With this I get a loop that are correctly sorted, and with a `float:left` I have it aligned properly. What's missing here is that I need to set a pre-determed set of numbers per row, where I need it to be dynamically, and also I need it to be sorted after letter like the first example. I tried numerous ways to do this over the past few days, and I'm confused. Both of them seems to be on the right track, not sure which one I should pursue working with. You can see both outputs here (Scroll down for the second one) _Loop 1_               <?php          $last_char = '';     $args=array(     'post_type' => 'portfolio',     'orderby' => 'title',     'order' => 'ASC',     'posts_per_page'=>-1,     'portfolio-category' => 'indie',     'ignore_sticky_posts'=>1     );          $my_query = new WP_Query($args);          $columnCount = 0;          ?>          <?php if( $my_query->have_posts() ) : ?>     <?php  echo 'Alphabetic index of all ' . count($my_query->posts) . ' posts'; ?>
                    <?php while ($my_query->have_posts()) : ?>                 <?php if ($columnCount == 8): ?>                           <?php endif; ?>                           <?php $my_query->the_post(); ?>                 <?php $this_char = strtoupper(substr($post->post_title,0,1));                       if ($this_char != $last_char) : ?>
	      <?php   $last_char = $this_char; ?>
 <?= $last_char; ?>

      <?php else: ?>

<a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to    <?php the_title_attribute(); ?>"><?php the_title(); ?>

           <?php endif; ?>                           <?php endwhile; ?>               <?php if ($columnCount != 8): ?>
                  <?php endif; ?>
     <?php endif; ?>          <?php wp_reset_query();  // Restore global post data stomped by the_post(). ?>      _Loop 2_               <?php           $args=array(     'post_type' => 'portfolio',     'orderby' => 'title',     'order' => 'ASC',     'posts_per_page'=>-1,     'portfolio-category' => 'indie',     'gnore_sticky_posts'=>1     );                    $the_query = new WP_Query($args);     foreach(new WP_Query_Columns($the_query, 15) as $column_count) : ?>
         <?php while ($column_count--) : $the_query->the_post(); ?>
<a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>"><?php the_title(); ?>
         <?php endwhile; ?>
     <?php endforeach; ?>


How do I set a featured image for the homepage? I am not concerned with the outcome of having or not having a featured image within wordpress itself. I want to control the featured image when it gets used via an external link, for example facebook.


title: Retrieving meta-box from a custom-post-type

text: I am trying to display data from a custom post type on my home page, for which I am using a separate template. I'm getting a Fatal error: Call to undefined method WP_Query::have_post() when my code looks like this:               get_header(); ?>     <div class="home_main_text">          <?php while ( have_posts() ) : the_post(); ?>     <?php get_template_part( 'content', 'home' ); ?>     <?php endwhile; // end of the loop. ?>     </div><!-- #primary -->     <?php      $current = date("d/m/Y");     $args = array('post_type' => 'jh_dedications');     $loop = new WP_Query($args);              while ( $loop -> have_post() ) : $loop->the_post();         the_title();         endwhile;         ?>


title: Ubermenu cant handle my menu, how to deal with large number of menuitems?

text: I have a webpage with a large number of pages, around 250-300, and I output these in Ubermenu at the moment. Needles to say, my menu backend is very slow, and sorting is a pain in the.. well you know. Is there any other good way to deal with such large numbers of menuitems? Any suggestion would be appriciated!


title: Issue displaying multiple TinyMCE editors with WPAlchemy

text:
I have a custom post type with a WPAlchemy admin meta box class including multiple textareas with TinyMCE editors(for adding content to the custom post template). I've gotten the editors to display and function fine, however there is an awkward div at the bottom left of each textarea with "path" and a colon ":" It would be great if someone knows how to remove what I'm guessing is meta information for the editor (word count ect..) but it doesn't seem to be functioning correctly on save. Here's what I get when I inspect the element:
       Path       :
      Also the textarea and TinyMCE javascript function for displaying WYSIWYG editor: functions.php:               add_action('admin_print_footer_scripts','admin_print_footer_scripts',99);     function admin_print_footer_scripts()     {         ?><?php     }      WPAlchemy metabox class textarea:               <textarea cols="20" rows="20" class="temp_options_desc" name="<?php $mb->the_name(); ?>"><?php $mb->the_value(); ?></textarea>      Thanks!


title: get_template_part() isn't loading author information

text: Using `get_template_part()` I parted some of my theme's common post templates. My post template is `content-general.php`. Without parting thing is going fine. But just after parting the template -- using `WP_DEBUG, true` -- I discovered it's showing some **errors** in loading author information: > **Notice: Undefined variable: authordata** Along with: > **Notice: Trying to get property of non-object** I have the following code, where I have **`$authordata`** :               <a class="url fn n" href="<?php echo get_author_posts_url( false, $authordata->ID, $authordata->user_nicename ); ?>" title="<?php printf( __( 'View all posts by %s', 'your-theme' ), $authordata->display_name ); ?>">        <?php the_author(); ?>     </a>      I followed this WPSE thread and tried globalizing `$post` inside the template file (`content-general.php`) like:               <?php global $post; ?>      and the template is called within a default WordPress loop. But the problem is not solved.


title: admin panel save option with ajax

text: I create custom options in the admin panel but I have some difficulties to save it with ajax. I can't get the php script with action variable in ajax script. Here all my scripts: in functions.php :               require_once ($admin_path . "theme-options.php");          function load_custom_wp_admin_style() {         wp_enqueue_script('media-upload');         wp_enqueue_script('thickbox');         wp_register_script('theme-options', get_bloginfo('template_url').'/inc/theme-options.js', array('jquery','media-upload','thickbox'));         wp_enqueue_script('theme-options');         wp_enqueue_style('thickbox');      }     add_action( 'admin_enqueue_scripts', 'load_custom_wp_admin_style' );      in theme-options.php               add_action('wp_ajax_my_action', 'add_general_settings');     function add_general_settings(){                  if(get_option('logo-url') == ""){                 update_option( 'logo-url', 'http://localhost/wordpress/wp-content/uploads/2013/07/logo.png' );              }                  if(get_option('favicon-url') == ""){                 update_option( 'favicon-url', 'http://' );             }                  if(get_option('google-analytics') == ""){                 update_option( 'google-analytics', 'Goolge Analytics Here...' );             }              if(!empty($_POST)) {                  $logourl = $_POST['logofile'];             $faviconurl = $_POST['favicon'];             $analytics = $_POST['googleanalytics'];                  if(!empty($logourl)){             update_option( 'logo-url', $logourl );             }             if(!empty($faviconurl)){             update_option( 'favicon-url', $faviconurl );             }             update_option( 'google-analytics', $analytics  );         }     }       and in theme-option.js :               jQuery('#button-general').click(function() {              jQuery('#savemessage').html('Loading...');              var logofile = jQuery('#logofile').val();         var favicon = jQuery('#favicon').val();         var google_analytics = jQuery('#google-analytics').val();              var data = {             action: 'my_action',             logofile: logofile,             favicon: favicon,             googleanalytics: google_analytics,         };         // since 2.8 ajaxurl is always defined in the admin header and points to admin-ajax.php         jQuery.post(ajaxurl, data, function(response) {             jQuery('#savemessage').html('General Settings Saved').hide(2000);         });     });      If I try to alert(action) , my_action is undefinied... Because it's not present in the source code...


title: How to add a widget to the post editing view?

text: I would like to add some features (via authoring a plugin) to the post editor in wordpress. Is there a way to add a widget to the post editor view? Alternatively is there an existing plugin someone can point me too, that does this so I can see how they do it.


title: Preview Image Path in Admin Section

text: So I have run into a little glitch. i have a custom path for uploads and it works. the files get saved to the right place, etc. The problem I have is the 'widget box' in the admin section. immediately after uploading and setting the uploaded image as the featured image, it show up in the preview, instead of `www.blog.com/blog/uploads/POST_ID/image_name.png` it is showing `www.blog.com/blog/uploads/image_name.png` The path is broken. Again I am new to WP... is there a filter for the admin 'widget box's? The path I get back is: `<img width="266" height="145" src="http://mysite.com/blog/wp-content/uploads/image-350x192.png" class="attachment-266x266" alt="the title" title="the title">` But where the image resides is: `<img width="266" height="145" src="http://mysite.com/blog/wp-content/uploads/<POST_ID>/image-350x192.png" class="attachment-266x266" alt="the title" title="the title">` I cant add an image because of my rep so far... it appears in the same column as `tags` and `categories` in the admin area. It is a custom `widget` for this theme. **update**                   function media_upload_dir($upload) {             if(!isset($_REQUEST['post_id']))             return $upload;     $id = $_REQUEST['post_id'];             if (isset($_REQUEST['post_id'])) {                 $upload['path']    = "/path/www/blog/wp-content/uploads/" . $id;                 $upload['url']     = "http://site.com/blog/wp-content/uploads/" . $id;                 $upload['basedir'] = "/path/www/blog/wp-content/uploads/" . $id;                 $upload['baseurl'] = "http://site.com/blog/wp-content/uploads/" . $id;                 if (!file_exists("/path/www/blog/wp-content/uploads/" . $id)) {                     mkdir("/path/www/blog/wp-content/uploads/" . $id, 0777);                 }             }             return $upload;         }         add_filter('upload_dir', 'media_upload_dir');      cheers.bo


title: CSS for Custom Post Types

text: How do I assign CSS to custom post types so it displays different from other Custom Post Types? Example: Custom Post Type 1: Row of 4 Images Custom Post Type 2: a 2 column with an Image in the left column and text in the right column How would I do this?


title: Problem with admin login after deployment

text: I made a site for a friend and everything worked so far on my development box that we can start final deployment and testing so I decided to put it on the hosting. So I done the standard procedure to deploy:   1. backup the database to an sql script changed the db name and stuff to corespond to the host db name, replaced the links to correspond to the host address   2. Restored the script and the db looks fine. From what I can tell trough the PhPMyAdmin   3. changed the wp-config file to the correct data The page looks fine everything seems to work. Except that now I can't login to the admin site anymore when I type in the wp- admin.php it shows up but when I type in the login data and press login it goes blank :S Firebug dosent show up any error or something. All files have the permitions of 0644 and Folders 0755 (So default when the files get uploaded). you can try login with any username/password to see the result but if you need I give people that can help username and password over private messages. Link to the site Anyone got any idea to what might be the problem? Thanks for help EDIT: Hmm looks like something wrong with jQuery. Cos I get: $ is not a function in 2 scripts but they are my custom scripts and not the WP-core stuff


title: Change Buddypress Activity Stream Date format

text: I want to change the activity stream date format to make it something like facebook date. I mean I need to use "... ago" date format for today's activities and "December 31, 2012 at 10:00AM" like date format for older activities. How can I do this? Can this be done without modifying Buddypress core files? Another question, how to remove the link from the activity date? Thanks


title: Change permalinks structure for specific category

text: I need to change my permalink structure just for one category. Now I have: `/%postname%/` , but for News category I need this structure: `/%postname%-%post_id%/`. **Question:** how to add %post_id% in specific category?


title: Creating a child-theme: CSS not loading

text: I created a custom theme (style.css in the dashboard)               /*     Theme Name:     Client customisations     Description:    Child theme for the client Website     Author:         Me     Author URI:     http://example.com/about/     Template:       aries     Version:        1.0.0     */          @import url("../aries/style.css");          h2{         color: #4E8B4E !important;         font-size: 1.4em;     }         When I visit the front page in Chrome, I see that `wp-content/themes/aries` was loaded, but not my custom theme that is currently activated. What could be causing this issue?