How to get terms of not only the current cat but also of all its children

I'm modding a theme to use parent taxonomy terms instead of all taxonomy terms, now I've been able to only display the parents, but now I've run into a count problem. Basicly this is the code that has to be changed               $_products_in_term = get_objects_in_term( $term->term_id, $taxonomy );       This gets all the terms of the current term, which then later is used to do an intercept with and then count. Now how could I mod this code to not only get the terms of the current term but if it has children get the terms of all its children , (will only go 1 deep, not gonna work with grandchildren) This is the code the full code                              foreach ($terms as $term) {                           // Get count based on current view - uses transients                     $transient_name = 'wc_ln_count_' . md5( sanitize_key($taxonomy) . sanitize_key( $term->term_id ) );                          if ( false === ( $_products_in_term = get_transient( $transient_name ) ) ) {                          //  $_products_in_term = get_objects_in_term( $term->term_id, $taxonomy );                          $args2['child_of'] = $term->term_id;                     $terms = get_terms( $taxonomy , $args2 );                     $term_array=array();                     foreach($terms as $terms){                     $term_array[]= $terms->term_id;                     }                          $_products_in_term = get_objects_in_term( $term_array, $taxonomy );                               set_transient( $transient_name, $_products_in_term );                     }                          $option_is_set = (isset($_chosen_attributes[$taxonomy]) && in_array($term->term_id, $_chosen_attributes[$taxonomy]['terms'])) ;                           // If this is an AND query, only show options with count > 0                     if ($query_type=='and') {                              $count = sizeof(array_intersect($_products_in_term, $woocommerce->query->filtered_product_ids));                              // skip the term for the current archive                         if ( $current_term == $term->term_id ) continue;                               if ($count>0 && $current_term !== $term->term_id ) $found = true;                              if ($count==0 && !$option_is_set) continue;                          // If this is an OR query, show all options so search can be expanded                     } else {                               // skip the term for the current archive                         if ( $current_term == $term->term_id ) continue;                              $count = sizeof(array_intersect($_products_in_term, $woocommerce->query->unfiltered_product_ids));                              if ($count>0) $found = true;                          }


Thumbnails for media Library images

I have somee Item in the media library, where I want to retrieve the thunbnail from. I use the normal post thumbnail functions (tried some of them), with normal posts or cpts's the work fine. As media library items are handled, similiar to posts, I thought the normal wp thumb function could work there, too. There are also thumbs created, as i can see on the server. But no one fo WP's Thumb Fuunctions returns that thumb. Here an example Function, I use:                <?php echo get_the_post_thumbnail($post->ID, 'size-1'); ?>      The post ID is correct. The Thumbnail size is registered and works for other posts fine. Thank YOu!


Will WordPress get my server hacked?

I'm building a web application where the needs of security are the most important thing. If my server/website were to be vulnerable for an attack, my entire business would collapse and my brand would have irreparable damage. I thought it OK to have a wordpress install on a subdomain of this site for content creation and building a solid source of traffic. I do fear however, that it is possible because of this wordpress install that I am increasing the attack-surface of my server and compromising the security of my site. Some of the things I have done in regards to security are:   * install iThemes WordPress security   * keep the wordpress install updated   * minimize the number of plugins active   * change login URL   * reduce user privileges and not using Admin to log in   * backing up my data and keeping important files off wordpress subdomain When I build my main web application on the primary domain, will this WordPress install affect the security? Also, is it a good security practice to use a subdomain for a wordpress install so that if it does get breached, I can somehow setup my Apache server to deny access to my main files on the primary domain?


Edit the (automatic) HTML layout of nav menus

I registered my menu in functions.php, called it from header.php and set it all up in the Appearances > Menus backend. The problem is, I need to manually insert a div surrounding `<ul class="sub-menu"> ... </ul>` where my drop-down menu is. There is no way around it like adding the div's class to the ul etc., as in order for it's drop-down functionality to work it must be inserted in that way, so that my code can be:

             Menu Item

      Is there any easy way to get that `<div class="dropdown">` and `</div>` part in easily? Or would the only way be by writing a script? Thank you!


Non Latin page permalink problem

Custom Structure is selected in Permalink Settings and custom permlink is setted up into "/%postname%/". Then post's slug(permalink) is setted up into non Latin language text, so that they are working fine. But only pages are not working. If page's slug is setted up into English text, this is working fine. By the way if 'Day and name' or 'Month and name' is seleced in Permlink Settings, non English pages are working fine. I can't know the reason. Is it impossible to work non English pages if custom permlink is setted up into "/%postname%/"? And Non Latin lanuage's example are hebrew , chinese and korean and son on.


custom post type edit / publish hook

What hook gets called when I edit or publish a custom post type of name 'episode gallery' ? I tried following but none worked.               add_action('save_post', 'update_custom_ngg_table');     add_action('update_postmeta', 'update_custom_ngg_table');     add_action('publish_post', 'update_custom_ngg_table');     add_action('edit_post', 'update_custom_ngg_table');     add_action('edit_page', 'update_custom_ngg_table');     add_action('publish_page', 'update_custom_ngg_table');     add_action('save_page', 'update_custom_ngg_table');     add_action('publish_episode-gallery', 'update_custom_ngg_table');      I am about to give up :)


Custom Field data only shows after manual post update

I have a custom field [address] that converts a street address and displays it on a google map on the front end post. Upon manual post update, the latitude and longitude address co-ordinates populate correctly into the [address] custom field and hey presto, the Google Map shows up on the front end post. **The problem I have is this:** The [address] custom field is being populated by an import script (wp- allimport) which updates my posts via daily cron, from a master file. The cron import update works fine for all post details (e.g. date, images etc), except for the [address] custom field. It does populate the [address] custom field correctly, but the Google Map does not show on the front end. I believe this is because the post needs to be updated a second time in order for the latitude and longitude co-ordinates to "stick". **How can I rectify this? I have several thousand posts that are updated daily, so doing it manually is not an option!** Things I've tried: I also read these related posts but didn't see anything conclusive. Automate post update for all posts? (I tried Bainternet's suggested code, which simply outputted the custom field data, but but not as the geo-coded map) http://stackoverflow.com/questions/2297486/render-google-map-in-wordpress- based-on-address-custom-field?rq=1


Fetch a single row from a custom table for to a given ID

When I want to get a single row from a custom table of my WordPress database by providing a username through function call, it does not work. When I mention the username in where clause of the query, however, it works. Why is that? I am using the following code:               function gettingonly($phl) {          global $wpdb;     $mylink = $wpdb->get_row("         SELECT *         FROM $wpdb->wp_philosophy_philosopher         WHERE philosopher=%s",         $phl     );     if ($mylink) {         print "<input type='text' value='".$mylink->philosopher."'>             <input type='text' value='".$mylink->about."'>";         }     }      Is this the right method to fetch a row by providing the value through PHP function?


Using ob_get_content to get_search_form puts into infinite loop

I am trying to change the look of my searchform. It basically needs to have two text fields. I want this to be in form of a plugin, which anyone can activate. SO obviously I do not have any control over `searchform.php`. And I also read that if searchform.php is present, then echo parameter is ignored (`http://codex.wordpress.org/Function_Reference/get_search_form#Notes`) This made me look at the code snippet under the heading "MOAR OBJECT BUFFERZ!!!" at: `http://shinraholdings.com/363/3-wordpress-hacks-to-unlock-some-much-needed- features/4/` I copied the code as it is and added a filter like: `add_filter('get_search_form','shinra_searchform');` However, the code seems to go in an infinite loop. I put an echo statement after lines 11 and 12. The one after 12 never gets printed while the one after line 11 keeps on getting printed continously. I tried changing the filter to pass the argument to:   1. `add_filter('get_search_form',shinra_searchform(true),1);`   2. `add_filter('get_search_form',shinra_searchform(false),1);`   3. `add_filter('get_search_form',shinra_searchform($echo),1);` But none of these work. Can someone please help me out?


Loading dynamic content with AJAX breaking jQuery

I'm creating a theme that uses only the homepage. When a button is clicked, the content for that section is loaded into a div on the homepage via AJAX (script below).               $.ajaxSetup ({           cache: false       });           var ajax_load = "<img src='<?php bloginfo("template_url"); ?>/images/loading.gif' alt='Loading...' />";                var loadUrl = "http://localhost:8888/cnNew/?portfolio=portfolio-test";              $("#ourTeam").click(function(){                 $("#main")                     .html(ajax_load)                     .load(loadUrl + " #content");             });      All of the .js files are being loaded in via wp_enqueue_script:               function my_init() {         if (!is_admin()) {             // comment out the next two lines to load the local copy of jQuery             wp_deregister_script('jquery');             wp_register_script('jquery', 'https://ajax.googleapis.com/ajax/libs/jquery/1.4.3/jquery.min.js', false, '1.4.3');             wp_enqueue_script('jquery');             wp_enqueue_script( 'galleria_plugin', get_bloginfo('template_directory') . '/js/galleria.js', array('jquery') );         }     }     add_action('init', 'my_init');          function my_scripts() {         wp_enqueue_script( 'carousel', get_bloginfo('template_directory') . '/js/carousel.js', array('jquery') );         wp_enqueue_script( 'backstretch', get_bloginfo('template_directory') . '/js/jquery.backstretch.min.js', array('jquery') );         wp_enqueue_script( 'nivo_slider', get_bloginfo('template_directory') . '/js/jquery.nivo.slider.pack.js', array('jquery') );         wp_enqueue_script( 'tabify', get_bloginfo('template_directory') . '/js/jquery.tabify-1.4.js', array('jquery') );         wp_enqueue_script( 'mouse_wheel', get_bloginfo('template_directory') . '/js/scroll/jquery.mousewheel.js', array('jquery') );         wp_enqueue_script( 'scroll_pane', get_bloginfo('template_directory') . '/js/scroll/jquery.jscrollpane.min.js', array('jquery') );     }     add_action('template_redirect', 'my_scripts');      THE ISSUE: Since the page isn't refreshing and the content is being loaded into a DIV via AJAX when a button is clicked, i'm guessing, the content that is being loaded in that uses jQuery and other .js files is coming in broken because the .js files have already loaded without that content being on the page. I need to find a way to "refresh" the already loaded .js files so that the newly loaded content doesn't come in broken. Or am I approaching this in the wrong way? I'm a novice when it comes to AJAX since this is the first time i've used it. I was given this: http://www.wphardcore.com/2010/5-tips-for-using-ajax-in- wordpress/ as a reference but I found it hard for me to follow. Thanks for the help!


Ajax Form seems to post, but does not return

I have a very simple form with 3 checkboxes allowing users to flag a video as inappropriate. I'm trying to make a simple ajax request to create an email, and give the user some feedback. The form seems to post, and the info is being sent in the headers, but nothing is being returned. I'm really new to using ajax, so I'm sure I just missing something. template-file.php:                                          <div id="reportTrailer-<?php echo $i; ?>">
                           <form id="report-form-<?php echo $i; ?>" class="form-inline" method="post" action="">                                                                        <input type="checkbox" name="inappropriate" id="inappropriate" value=""> Inappropriate                                                                                <input type="checkbox" name="incorrect" id="incorrect" value=""> Incorrect Trailer                                                                                <input type="checkbox" name="copyright" id="copyright" value=""> Copyright Infringement                                                                    <button class="btn btn-primary pull-right" type="submit" name="Submit" id="gcpl_rt_send"> Send Report</button>                                 <input type="hidden" name="reported" id="reported" value="true" />                                 <input type="hidden" name="subject" id="subject" value="Explore DVD Trailer Reported" />                                 <input type="hidden" name="dvdname" id="dvdname" value="<?php echo $results[$key]['title']; ?>" />                                 <input type="hidden" name="dvdnum" id="dvdnum" value="<?php echo $results[$key]['stdnum']; ?>" />                             </form>

      functions.php:               add_action('wp_ajax_nopriv_trailer_report', 'trailer_report');     add_action('wp_ajax_trailer_report', 'trailer_report');          function trailer_report() {         $post = (!empty($_POST)) ? true : false;              if($post) {             $noneError = "";             $inappropriate = "";             $incorrect = "";             $copyright = "";                  if(!isset($_POST['inappropriate']) && !isset($_POST['incorrect']) && !isset($_POST['copyright'])) {                 $noneError = 'Please select one or more reasons for reporting this trailer.';                 $hasError = true;                 $inappropriate = "";                 $incorrect = "";                 $copyright = "";             } else {                 if(isset($_POST['inappropriate'])) {                 $inappropriate = 'Inappropriate Content';                 }                 if(isset($_POST['incorrect'])) {                 $incorrect = 'Incorrect Trailer';                 }                 if(isset($_POST['copyright'])) {                 $copyright = 'Copyright Infringement';                 }             }                  $subject = trim($_POST['subject']);;             $moviename = trim($_POST['dvdname']);;             $movienum = trim($_POST['dvdnum']);;                  if(!isset($hasError)) {                 $emailTo = 'somemail@gmail.com';                 if (!isset($emailTo) || ($emailTo == '') ){                     $emailTo = get_option('admin_email');                 }                 $subject = 'The Trailer for  '.$moviename.' has been reported';                 $body = "Movie Name: $moviename \n\nMovie Standard Number: $movienum \n\nReported for: $inappropriate \n\n$incorrect \n\n$copyright ";                 $headers = 'From: report <email@test.com>' . "\r\n";                      $mail = wp_mail($emailTo, $subject, $body, $headers);                 $emailSent = true;                      if($mail) {                     echo 'OK';                 }             } else {                     echo '
'.$noneError.'
'; // set up error div for jQuery/Ajax             }         }     die();     }      Any help to see where I'm going wrong is greatly appreciated. Thank you.


How to strip thumb from widget

I v made a customization on my theme, and some widget display where only title is shown without thumb.But the thing is i dont know how to remove this thumb so i v made a custom thumb size and in function added size 0,0 but i want to remove it . So the thumb get generated and in category page it could be shown but inside this widget i dont want it there as this has slowed my site. This is a part of that widget with thumb inside

<?php echo $title; ?>

                         <?php $recent = new WP_Query(array( 'cat' => $categories, 'showposts' => $posts_num )); while($recent->have_posts()) : $recent->the_post();?>
                             <?php if (  (function_exists('has_post_thumbnail')) && (has_post_thumbnail())  ) { ?>
                                 <a href="<?php the_permalink(); ?>" rel="bookmark" title="<?php the_title(); ?>"><?php the_post_thumbnail('lists'); ?>
                             <?php } ?>
                                 <a href="<?php the_permalink() ?>" rel="bookmark"><?php the_title(); ?>

                         <?php endwhile; ?>


Front End Image Upload With A Twist

I am using a code that makes posts from upload images to the media library. I would like to let users upload images also. I have been un able to find a plugin or code that lets me do everything i need to. 1: Upload and append to the media gallery. 2: drag and drop multi upload (would prefer default wp media upload drag and drop function). 3: Append user name to post author.


How to allow hidden custom fields to be added from wp-admin/post.php?

I know that using an underscore in front of a custom field name hides it from display on the front-end, e.g. `_custom_field_name`. In my experience, WordPress also prevents one from adding such a custom field on the front end. Before I go spelunking around core, I wanted to ask: Is there an "easy" way to allow `_custom_fields` to be added from wp-admin/post.php? The reason is this: we rely on hidden custom fields, but when troubleshooting production issues in prod it would be useful to be able to inject certain hidden post meta. I'm not a fan of touching the production database by hand. ![what i get](http://i.stack.imgur.com/tD1Ym.png)


Very stubborn wp_register_script / add_action vs remove

I am trying to get rid of a plugin's .js file in the but it's not working. It's being called here {partial code):               class awqsf{            const post_type = 'awqsf';            function __construct(){                // style for front end         add_action( 'wp_enqueue_scripts', array($this,'awsqf_front_styles'), false, '1.0', 'all',1 );                  }            function awsqf_front_styles(){         wp_register_script( 'awqsf-frontjs', plugins_url( 'js/awqsf-front.js', __FILE__ ), array('jquery'), '1.0' );         wp_enqueue_script('awqsf-frontjs');       }          } //end class      I have tried a lot of different versions, wp_deregister_script and remove_action, but can't seem to get rid of it:               //deregister awqsf     function my_deregister_scripts() {       //wp_register_script( 'awqsf-frontjs', plugins_url( 'js/awqsf-front.js', __FILE__ ), array('jquery'), '1.0' ); // the original wp_register_script       wp_deregister_script( 'awqsf-frontjs', 'http://www.spijkerbroek.me/wp-content/plugins/advance-wp-query-search-filter/js/awqsf-front.js', array('jquery'), '1.0' );       wp_deregister_script("wp_enqueue_scripts", 'http://www.spijkerbroek.me/wp-content/plugins/advance-wp-query-search-filter/js/awqsf-front.js', array("awqsf","awsqf_front_styles"), false, '1.0', 'all',1 );           wp_deregister_script( 'awqsf-frontjs', array('http://www.spijkerbroek.me/wp-content/plugins/advance-wp-query-search-filter/js/awqsf-front.js', 'jquery'), false, '1.0', 'all',1 );       wp_deregister_script('awqsf','awqsf-front.js');       wp_deregister_script('awqsf');       //function awsqf_front_styles(){} // the function       //add_action( 'wp_enqueue_scripts', array($this,'awsqf_front_styles'), false, '1.0', 'all',1 );   // the original add_action       remove_action( 'wp_enqueue_scripts', array('http://www.spijkerbroek.me/wp-content/plugins/advance-wp-query-search-filter/js/awqsf-front.js','awsqf_front_styles'), false, '1.0', 'all',1 );       remove_action( 'awqsf', array('http://www.spijkerbroek.me/wp-content/plugins/advance-wp-query-search-filter/js/awqsf-front.js','awsqf_front_styles'), false, '1.0', 'all',1 );       remove_action( 'awqsf', array('http://www.spijkerbroek.me/wp-content/plugins/advance-wp-query-search-filter/js/awqsf-front.js','wp_enqueue_scripts'), false, '1.0', 'all',1 );     }     add_action( 'wp_awqsf_scripts', 'my_deregister_scripts', 1 );      Can somebody get me into the right direction?


Proper Javascript Implementation

Instead of calling a script from a file, I put a number of my javascripts in a template file called codes.php. I then call codes.php in the footer by pasting `<?php include (TEMPLATEPATH . '/codes.php'); ?>` into footer.php Should I continue with this method, or should I be saving each script in its own file, upload it to my directory, and then call the scripts individually (rather than having the entire code pasted in codes.php)? If I go with this second option, should I do away with codes.php altogether or should I put the script tags in codes.php for easier organization and access? Would there be any real drawback to doing this?


Display comments on a comment page without form

I'm using this to allow me to display my comments for posts on category pages:               <?php     $wp_query->is_single = true;     comments_template();     $wp_query->is_single = false;     ?>      However I don't want to display the comment form. Is there a way to display the comments only on a comment page?


Wordpress excerpt not working

I am using the latest WordPress version and when I use `<?php the_excerpt(); ?>` on the index page it doesn't show the post excerpt. I tried putting in the_content() instead and it worked, so I'm assuming there is something wrong. My code:               <?php get_header(); ?>               <?php if (have_posts()) : ?>
     <?php while (have_posts()) : the_post(); ?>                   <div id="post-<?php the_ID(); ?>" <?php post_class(); ?>>              <?php if ( has_post_thumbnail() ) { ?>
<a href="<?php the_permalink() ?>"><?php the_post_thumbnail( 'summary-image' );  ?>

<?php the_category(', ') ?>

                    <?php } ?>

<a href="<?php the_permalink() ?>"><?php the_title(); ?>

<?php the_time(get_option('date_format')); ?>

<?php the_excerpt(); ?>

                     <a class="read-more-button" title="Read More" href="<?php the_permalink() ?>">Read More

                    <?php endwhile; ?>
     <?php else : ?>     <?php endif; ?>          <?php next_posts_link('
View Older Entries
') ?>               <?php get_footer(); ?>      I am using this theme: http://www.eleventhemes.com/gridly-theme/ Thanks


Facebook redirect buton

In this post, Facebook like button that redirects?, I saw a code to redirect after doing a Facebook "like". I pasted in there, but I can't figure out how to put the link I want to redirect to?


If a page does not exist, include a different page?

I'm setting up a website for a client where they want several different sections, like so:               Regular Site (/)       - Section 1 (/section_1/)       - Section 2 (/section_2/)          ...        - Section X      The regular site will have all of the main content, but I want to be able to override certain pages if they exist in the specified section. Let's say the user visits `domain.com/section_1/features`. If a `/section_1/features` page exists, I would like to display that; however, if the page does not exist, I would like it to display `/features` **without** redirecting or changing the URL in the address bar. It should be completely seamless and behind the scenes. I **think** I need to add a function to the `parse_request` hook, something like:               function check_section_page( &$wp ) {         $requested_path = $wp->request;              if ( ! get_page_by_path($requested_path) ) {             $new_requested_path = preg_replace("/^(.*?)\//", "", $requested_path);             // do something here to make it read $new_requested_path         }     }          add_filter("parse_request", "check_section_page");      It runs the function properly, and echoing out $new_requested_path shows that it does have the new required page. I've been fighting with this for about 2 hours and my head's done in. Help?


If the_post_thumbnail(); is this - echo this text

I'm using the_post_thumbnail(); (aka featured image) to show a news source logo. If I use that image, I'd like to output the name of the news source. For example: if the_post_thumbnail is "new-york-times.jpg" echo "New York Times" elseif the_post_thumbnail is "cbs-news.jpg" echo "CBS News" etc... Any help writing this code is greatly appreciated!


wp-admin slow in multisite

Running Wordpress 3.1.2 (newly updated, installed as 3.0 about a year ago) with subdomain multisite & using the Sunrise domain mapping plugin. The frontend is fast, the backend (wp-admin) is very slow on the network admin site (www.example.com/wp-admin) but runs at "normal speed" on one of the subdomain backends (foo.example.com/wp-admin). The server is our own, Ubuntu 10.04 with mod_security (which I've heard can slow things down). Is there anything I can do to speed up the backend or run a trace somehow?


Managing media by folder

I'm looking for a plugin that could help me managing more precisely medias. I'd like to be able to manage folders and sub-folders. I found out the ImageManager plugin but it's kind of outdated (http://soderlind.no/archives/2006/01/03/imagemanager-20/) so if anyone can help ;) PS : working on WP 3.1.1


search query within custom taxonomy term, post title and meta field

I want to create a search that does:   1. Search within my custom taxonomy - custom-tags   2. search the post title   3. search select meta field ?? dont know   4. search with custom post type - easy part I looked wordpress API but couldn't find any useful built in functions, i created a custom query below: there is bug here since it returns duplicate results sometime, maybe left join might be needed here. this query searches for term and title only at moment, but i also want a meta field called cterm searched.               SELECT   wp_posts.*         FROM wp_posts, wp_term_relationships, wp_term_taxonomy, wp_terms         WHERE (wp_terms.name LIKE '%car%'             OR wp_posts.post_title LIKE '%car%')                 AND wp_posts.post_status = 'publish'                 AND wp_posts.post_type = 'posts_vch'             AND wp_posts.ID = wp_term_relationships.object_id             AND wp_term_relationships.term_taxonomy_id = wp_term_taxonomy.term_taxonomy_id             AND wp_term_taxonomy.term_id = wp_terms.term_id  GROUP BY  wp_posts.ID  LIMIT  1 ,50      UPDATE: above updated query, manage to remove duplicate result using `group by` BUT another bug is that it does NIT bring POSTs with term "car". Basically it only show posts that have the word "car" in the title but not in term/tag.


Using a Theme inside a Plugin directory

I am building a mobile friendly plugin and put the theme directory inside the plugin directory. If it's a mobile browser, how can I redirect to the theme in the plugin directory?                 /wp-content/plugins/mobview/theme/      I've managed to use the following redirection:               wp_redirect( plugins_url('/mobview/theme/index.php') );     exit ;      But am kind of lost in the directory redirect inside WordPress structure.


Minimizing scripts & css files that plugins add

I try my best to limit plugin usage and only use ones that are well designed. But I still find that many will load a lot of extra scripts and styles, and few have options to load selectively based on whether the plugin is being used. I have started doing things like deregsitering the plugin scripts and them combining them one file and including it again myself, or using an if statement somewhere in the plugin file to only load it on certain page. But this can be a problem when the plugins are updated. Is there a plugin that provides an easy interface to enqueue/dequeue all registered scripts and styles? If not, is there a better way to do it than what I've been doing?


Auto-fill Custom comment fields

Thank you for reading, I added custom fields to the comment form, and saved the input in the DB, following this tutorial http://wp.smashingmagazine.com/2012/05/08/adding- custom-fields-in-wordpress-comment-form/comment-page-1/#comment-115187 Now i'd like the meta-fields in the comment form to auto-fill after the user has commented once. Just like wordpress does with the Name, E-mail and Url; once you've commented the value stays in the fields. However, wordpress does this with $commenter['comment_author'] and this array doesn't have the data I'm looking for.


wp_editor() in content that was loaded with ajax

I try to use **wp_editor()** in content that was loaded with ajax, but none of the required files and some other configuration script not loaded : The structure of ajax is something like this:               function get_test_page(){        include( TEMPLATEPATH . '/page.php' );        die( main() );     }     add_action( 'wp_ajax_nopriv_get_test_page', 'get_test_page' );     add_action( 'wp_ajax_get_test_page', 'get_test_page' );      page.php :               function main(){         wp_editor('','unique_id');     }      Editor is loaded but needed files is not loaded.   * `http://.../wp-includes/js/tinymce/wp-tinymce.php`   * `http://.../wp-includes/js/tinymce/skins/lightgray/skin.min.css`   * `http://.../wp-admin/load-scripts.php?c=1&load%5B%5D=...mce-view,imgareaselect,image-edit,word-count,editor,quicktags,wplink,thick...`   * `http://.../wp-includes/js/tinymce/langs/{}.js` Some related post but doesn't help me :   * use wordpress wp_editor in dynamic/ajax html   * How to load wp_editor() through AJAX/jQuery   * Load wp_editor via ajax   * help on wp_editor via ajax load


Accessing WPDB Multidimensional JSON Array w/ Javascript

I am having trouble accessing json values return from an ajax call. Here is the call:                   $.ajax({         type: 'POST',         data: 'user_id=' + user.user_id + '&user_login='+ user.user_login,         //dataType: 'json',         url: 'http://###/user-stats.php',         success: function(data){             alert(data);             //alert(data.games_won[0]['winner_id']);             //console.log(data);             if(data) {                 $('#hand-stats-display').html(data);                 //$.mobile.changePage( "#user-home", { transition: "fade"} );             }else{                  $('.messages').html("No stats available at this time... Please try again later.");                 //alert(data);             }              },         error: function(){             //console.log(data);             alert('Ajax Login Request ✗');         }         });      Here is the PHP:               $myrows['hands_won'] = $wpdb->get_results( "SELECT * FROM wp_winners WHERE user_id=" . $user_id );               if ( $myrows )      {         //echo('Rows Exist ✓');         //echo "List of {$meta_key1} posts, sorted by {$meta_key2}";         foreach ( $myrows as $id )          {             $creds[]=$id;             //echo('MyRows: ' . $myrows[id]);         }     }          //echo "Winner ID:" .$myrows[0]->win_id;     //echo "Winner 2 ID:" .$myrows[1]->win_id;                    echo json_encode($creds);      It returns a json object like:               [{"win_id":"1","user_id":"1","game_id":"1"},{"win_id":"2","user_id":"1","game_id":"2"}]      I can not seem to access these with the javascript I am using. Any advice is appreciated.


How to add/change a value of $wpdb property/var?

There is a problem: I want to add a table 'linkmeta' to work like 'postmeta' or 'commentmeta'.. and use functions like add_metadata / update_metadata / delete_metadata! but, in this functions call "_get_meta_table()" to verify the name in db, this code:               function _get_meta_table($type) {         global $wpdb;         $table_name = $type . 'meta';         if ( empty($wpdb->$table_name) )             return false;         return $wpdb->$table_name;     }      so, if doesn't exist the property/var named 'linkmeta' in $wpdb, `_get_meta_table` will return false, then `update_metadata` too will not work, because this piece of code at begin of that:               if ( ! $table = _get_meta_table($meta_type) )         return false;      but, if I can set a property/var of (class) `$wpdb` like `$wpdb->linkmeta` return the correct name of table, in this case (default) wp_linkmeta, all the rest will work NICE! so, there is a way to change wpdb in runtime? if I just put the commands:               $wpdb->tables = array_merge($wpdb->tables, array('linkmeta'));     $wpdb->linkmeta = $wpdb->prefix . 'linkmeta';      at plugin initialize, will it work when function `_get_meta_table` is called??! rgds


plugin development: problem with functions

I have this very basic scheme to build my first plugin, but now I have one problem: when I put a hook to add_action on point 1 works, but i need to get the color from shortcode function, so, when i put the code at point 2 don't works.                       class myclass             {                  public function init()                  {                       global $shortcode_tags;                           add_shortcode( MYSHORTCODE, array( 'myclass', 'shortcode' ) );                                   // * point 1                       return;                       }                       public function shortcode( )                  {                      // want to run add_action here                                  // i need to get the color from shortcode that part is done                                  // question is how i can run add_action from here and pass                                  // the variable to function globalcolor (point 3), then run it in wp_head?                                  // * point 2                  }                        function globalcolor($color)                  {                                  echo '<style>body{color:' .$color . '}</style>' . "\n";                                  // * point 3                  }             }                  add_action( 'init', array( 'myclass', 'init', ) );                           the code to add: add_action( 'wp_head', array( 'myclass', 'globalcolor' ) );      Any ideas? and sorry for my bad english.


Fake mark a menu item as current_page_item/active in Wordpress

I have a custom post type called Books and a page structure like this:               Home     Products & Services     - Services     - Products     -- Books      I am using Wordpress custom Menus for the 1st level navigation (displayed horizontally), and wp_list_pages to print out the subnavigation based on the page selected from the 1st level of navigation (the submenu is displayed vertically). To make things more interesting/worse, I am only displaying Books in the submenu if I am viewing the Products or Books page. Now, I would like to add the active and current_page_item/current_page_ancestor classes to the Products & Services, Products and Books when I am viewing a single Book (custom post type). How should I do it?


Where did the Add New Custom Field go?

In the latest version of WP it's gone. Why?


Creating a custom Admin panel

I'm building a Wordpress Plugin and it has two tables and some data. Right now, for displaying and changing the data, I'm using the wpdb function and manually creating the user interface (mimicking the Default one). However, I see that other plugins have a more consistent style with their tables and the same features (like the bulk button). I'm getting suspicious about Wordpress Taxonomies. I read, but so far, taxonomies seems to be related to posts in a way or the other. My data doesn't relate to posts, it's completely independent. Can I still use Wordpress Taxonomies? Can the taxonomy help me build a consistent interface?


What is causing wp-comments-post.php to redirect to the browser's IP address?

I've got a copy of WordPress running that has recently been moved off shared hosting and onto a VPS that I control. While a testing copy of the same site runs correctly on another vhost on the same instance, on the same IP address, after the time when I moved the public site across, the comments form began to redirect visitors back to their own IP address with a `302 Found` in place of the successful `302 Moved Temporarily`. Running WP 3.4.1, I've tried:   * reinstalling WP from the dashboard, and checked all plugins are up to date   * deactivating all plugins and setting the theme to twenty-eleven   * diffing against the working test installation to check they are the same   * testing from more than one IP, computer and browser all with no effect to the problem. **What is causing WordPress to redirect from the form submission back to the browser's ip address?** Here's a sample request to leave a comment at http://def-proc.co.uk/b/jwybj:               Request URL:./blog/wp-comments-post.php     Request Method:POST     Status Code:302 Found      Form Data               author:My Name     email:email@my.mail.box     url:(empty)     comment:Comment contents.     akismet_comment_nonce:(akismet nonce)     submit:Post Comment     comment_post_ID:110     comment_post_ID:110     comment_parent:0     bb2_screener_:(bb2 nonce) (my ip address)      Response Headers               Connection:Keep-Alive     Content-Encoding:gzip     Content-Length:243     Content-Type:text/html; charset=iso-8859-1     Date:Wed, 01 Aug 2012 17:34:41 GMT     Keep-Alive:timeout=15, max=100     Location:http://(my ip address)/      Server:Apache     Vary:Accept-Encoding


Buddypress Add unserialized Profile Fields in Members Loop

I'm trying to show profile fields with **checkboxes and drop-downs** in the members directory loop. **Example: Next to each member in the directory I want to show the Gender they selected** This code works for text fields:               echo xprofile_get_field_data('Full Name', bp_get_member_user_id());      BUT **how do I echo profile fields for drop-downs or checkboxes** (unserialized data)?


Create Child Taxonomies

Is there a way to use the `register_taxonomy` function to create child taxonomies to a specific parent taxonomy in a hierarchical structure? For example: Let's say I'm creating a theme for selling cars where users can activate it and it automatically creates a hierarchical taxonomy called "Make". Is there any way to have it automatically create a few different vehicle "make" taxonomies, say Toyota, Lexus, etc.?


Where to modify translation files by _e()

I am in a rush right now and can't seem to find the answer i"m looking for. I have a wordpress website that has english and french versions. I see it is using Multi site language switcher to flip between the different sites. WHen i look in the template files, i see the `_e('some text in here')` function which is responsible for rendering english and french text . However, I can't seem to locate the language/localization files. I went into wp-content/language and I see .mo and .po files. The .mo file is not human readable and hte .po file doesn't have the dictionary of words I want to modify. Can someone tell me what I need to do to update the localization files?


Order posts by (hierarchical custom) taxonomy terms and term children

## The scenario   * a custom post type `wiki`   * a (hierarchical) custom taxonomy `topics`   * a page template `archive-wiki.php` ## The situation Posts show up and get ordered by `post_date` (which is the default). The according core query is:               SELECT SQL_CALC_FOUND_ROWS {$wpdb->prefix}posts.ID          FROM {$wpdb->prefix}posts WHERE 1=1          AND {$wpdb->prefix}posts.post_type = 'wiki'          AND ({$wpdb->prefix}posts.post_status = 'publish' OR {$wpdb->prefix}posts.post_status = 'private')      ORDER BY {$wpdb->prefix}posts.post_date      DESC      LIMIT 0, {$setting->posts_per_page}      _Yeah, I'm logged in when grabbing this query - hence status +=`private`._ ## The task Order all posts by the custom hierarchy main terms. Inside the main taxon, assign the posts to the subterms. So the main array only contains the taxonomies main taxons with the actual `wiki`-posts assigned to their corresponding subtaxons. If they're not assigned to a sub taxon or the taxon has no child taxons, then it should simply be added to the main array. ## Where should this happen? Inside the `pre_get_posts` or `posts_pieces` (and similar filters). I don't want to add an additional query for this. Thank you.


404 Error for Custom Post type

I have a function on my theme ("dancefloor" by "Gorilla Themes") that allows me to make a post in a section in my dashboard called Events _(Custom post Type)_. If you schedule the date to anytime in the future it will show up in the Events widget or on the Events Page. That all work fine and Dandy. > But when you click on the link or excerpt, it give a `404` error. Anyone > know why this might be happening? Live Example here.


One comment per user email per post

i have this code to limit the comments per user.               <!-- #only one comment -->     <?php global $current_user,$post;     $args = array('user_id' => $current_user->ID,'post_id' => $post->ID);     $usercomment = get_comments($args);     if(count($usercomment) >= 1){         echo 'Thank you for your comment';     } else {         comment_form();     } ?>      My question is: how can edit this code to check for the author email rather than user id Thank you.


Set $wp_rewrite->non_wp_rules inside a plugin

I am attempting to set non-wordpress rewrites inside of a plugin. My `$wp_rewrite->rules` are getting set properly, but the `$wp_rewrite->non_wp_rules` are not getting set at all when I deactivate/activate my plugin. However, if I set the `flush_rewrite_rules()` to flush in the "init" action instead of on activation of the plugin they work just fine. Here is a watered down version of my code...               class My_Plugin     {              public function __construct()         {             register_activation_hook(__FILE__, array(&$this, 'activate'));             register_deactivation_hook( __FILE__, array(&$this, 'deactivate'))             add_action('generate_rewrite_rules', array(&$this, 'rewrite'));         }              public function rewrite()         {             global $wp_rewrite;             $new_rules = array(                 'something/?$' => 'index.php?custom_page=something',             );             $new_non_wp_rules = array(                 'theme/(.*)' => 'wp-content/themes/$1',             );             $wp_rewrite->rules = $new_rules + $wp_rewrite->rules;             $wp_rewrite->non_wp_rules = $new_non_wp_rules + $wp_rewrite->non_wp_rules;         }              public function activate()         {             flush_rewrite_rules();         }              public function deactivate()         {             flush_rewrite_rules();         }          }


Looking for a simple approach for handling user $_POST data without AJAX?

I'm looking for a simple way for a Wordpress plugin to process `$_POST` data from a **user** submitted form. Back end processing will be performed and then I'll redirect to a new page as appropriate — so during processing there is no UI. Basically, I want to take a form submit such as...                  <form method="post" action="/back-end-processing.php">          <input type="text" name="text" />          <input type="submit" value="submit" />        </form>';      ...and process it like I would with PHP but still be able to use WP's "nonce" protection. Some examples I've seen suggest that I should use `admin-post.php` but I was concerned that it should only be used for actual **admins** and not for general **users**. Another approach suggested...               function checkCheckBox()     {         if($_POST['checkbox'] == 1)         {            return true;         }              return false;     }          add_action('init', 'checkCheckBox');      ...however, this seems like overkill because it will be called for every page while my site visitors will only be posting data to it infrequently.


Custom post type menu missing after 3.0b2 -> 3.1.2 upgrade

I had a theme in 3.0b2 that was registering custom post types and displaying them in the admin menu just fine -- after upgrading to 3.1.2, they no longer appear in the sidebar admin menu (although they do get queried properly from the theme pages for the non-admin portions of the site). `show_ui` is set to `true` and adding `show_in_menu` as true for good measure had no effect. Can anyone help?               function balmer_init() {          //print ("Here");          register_post_type('gig', array(         'label' => __('Gigs'),         'singular_label' => __('Gig'),         'public' => true,         'show_ui' => true,         '_builtin' => true,         '_edit_link' => 'post.php?post=%d',         'capability_type' => 'post',         'hierarchical' => false,         'rewrite' => false,         'query_var' => false,         'supports' => array('title', 'editor',/* 'custom-fields' */),         'register_meta_box_cb' => 'gig_callback',     ));     }          add_action("init","balmer_init");      Thanks!


Hook any php file into the wordpress api

Say I just have a dumb .php file sitting on my WP server and I wanted it to access WP info through the API, how would I go about doing that? For example if I wanted to call                bloginfo('url');      As I have scored myself a downvote (with no explanation) I will expound upon why I am interested in this. Sure I can access WP API from all the built-in pages. But let's say I have a page that has little to do with WP. Seems like a lot of overhead to create say a custom template page and then hook it into an actual post, all so that I can have access to a few WP API calls. I ended up using something like this:               require $_SERVER['DOCUMENT_ROOT'].'/wp-blog-header.php';


Changing appearance of WooCommerce product layout

I'm new to WooCommerce and my products are currently being laid out with a thumbnail, product title, and price. Ideally I would like to have them horizontal, with a small excerpt to the right of the image. Now, can this be done within the WooCommerce interface, or will I have to add functions to the PHP and then style with CSS? I couldn't find anything in the documentation to answer this. Thanks in advance!


Unregister Nav Menu with fallback?

I am trying to create a child theme so theme updates are much easier. I want to remove the parent theme menus and add my own. I know I can modify the header.php file (where these menus exist) and edit the wp_nav_menus directly, but I'm trying to avoid using as many theme files as possible, so I'm trying to accomplish this in my functions.php file. Using unregister_nav_menu I am able to remove the menu from the parent theme location as such:               function RR_remove_parent_theme_menus()     {         unregister_nav_menu( 'top-menu' );         unregister_nav_menu( 'header-menu' );     }     add_action( 'after_setup_theme', 'RR_remove_parent_theme_menus', 20 );      This works great for "top-menu" but "header-menu" is coded in the parent theme with a custom fallback. Is there any way to override a custom (or a default) menu fallback using unregister_nav_menu or something else?


show all custom posts types in home page

Hi i am working on custom post types in wordpress presently we are using below code to display the custom posts, but the thing is the custom post types are keep on increasing,               add_action( 'pre_get_posts', 'add_my_post_types_to_query' );          function add_my_post_types_to_query( $query ) {         if ( is_home() && $query->is_main_query() )             $query->set( 'post_type', array( 'books', 'recipes', 'movie' ) );         return $query;     }      from above query i am calling the posts from books,recipes and movie but due increase of post_types i cant add all the post types in the above query. dose anybody have idea how to call all the posts from all post_types.


When editing images, apply changes to specific image size

The image editor only has these options: **Apply changes to:**   * All image sizes   * Thumbnail   * All sizes except thumbnail I have a custom image size that that I'd like to only apply the changes to. Is there a way to do this?


Sort by site/blog column in Multisite

I use WordPress Multisite and made a plugin that adds columns with some data. My code is based on this WP Engineer article. The key function in WordPress Multisite is `manage_sites_custom_column`. And the problem is that I want to be able to sort the column I created. I tried the code in this Scribu's article but it is based on `manage_posts_custom_column` for single sites.


In the new Theme Customizer API, how to send a value from the front back to the admin panel?

I'm digging a bit into the new Theme Customizer API, in particular into the javascript one, and what I find is delighting. I've managed to add my own custom parameters, and I also have the javascript part to update those parameters live into the preview. However, I would like to go a bit further : I need to place a point on an absolute position over a background image, and then record the position back into the database. Here is a screenshot. ![enter image description here](http://i.stack.imgur.com/9cMTE.jpg) I can move the point thanks to jQuery draggable plugin, but I don't know how to send the resulting position back to the customizer. Here is my code so far : `functions.php`:               add_action( 'customize_register', 'minisites_customize_register' );     function minisites_customize_register($wp_customize){         // gestion du placement des points         class Minisites_Customize_Page_Control extends WP_Customize_Control {                  public function render_content() {                 ?>                                      <?php echo esc_html( $this->label ); ?>                     Points position                     <input <?php $this->link(); ?> value="<?php echo $this->value()?>">                                  <?php             }         }         $wp_customize->add_setting( 'points', array(             'transport' => 'postMessage'         ) );         $wp_customize->add_control( new Minisites_Customize_Page_Control( $wp_customize, 'points', array(             'label'      => __( 'Lier les pages', 'minisites' ),             'section'    => 'background_image',             'settings'   => 'points',         ) ) );          }      `customize-theme.js`:               jQuery( function( $ ) {              var points;         wp.customize( 'points', function( value ) {             points = value;             value.bind( function( newval ) {                 // this code is called when the value change                 console.log('position change', newval);             });         } );              $('.point').draggable({              drag: function(event, ui){                 // update the position value                 point.set(ui.position);             }         });          });      The javascript `points.set()` call **does** update the position value (I get the correct info in the console) but **can't** update the input element located in the theme customizer itself. I had a look at the `api.Value` Class (witch is the class of my `points` variable) in `wp-includes/js/customize-base.js`. What I would need is to get the instance of the corresponding `api.Element`, and call its `update` method. But I cannot figure out from where I can get this.


printf and _n in this example?

what is the last `$count` in this example?               printf( _n(         'You have published %s post.', 'You have published %s posts.',         $count,         'myplugin' ),     $count );      i guess the first one is to fill each %s, so what is the second $count? Thanks


Disable all scripts and styles from NextGEN Gallery?

I use nextgen gallery in a multisite. How can I disable all scripts and styles? These thing are loaded in the code of my site:               <link rel='stylesheet' id='NextGEN-css'  href='http://mysite.com/wp-content/plugins/nextgen-gallery/css/nggallery.css?ver=1.0.0' type='text/css' media='screen' />          <script type='text/javascript' src='http://mysite.com/wp-content/plugins/nextgen-gallery/js/jquery.cycle.all.min.js?ver=2.9995'></script>          <script type='text/javascript' src='http://mysite.com/wp-content/plugins/nextgen-gallery/js/ngg.slideshow.min.js?ver=1.06'></script>          <!-- <meta name="NextGEN" version="1.9.7" /> -->


What capability is required to view posts, scheduled in the future, by someone else?

So, I'm trying to create a number of custom roles within my theme to meet with the custom requirements of the site. The first, and most simple, being 'external viewer' who I want to simply be able to view posts (both built in and custom post-types) that someone else on the content team has created and scheduled for some point in the future. ## Initially I tried this               $viewer_capabilities = array(         'read_private_pages' => true,         'read_private_posts' => true,         'read' => true     );               add_role('external_viewer', 'External Viewer', $viewer_capabilities );      But when logging into `/wp-admin` I just got the 'no permission' message and I couldn't do anything. If I went to one of the scheduled posts, I just got 'not found'. ## So then I tried               $role_object = get_role( 'external_viewer' );     $role_object->add_cap( 'read_private_pages' );     $role_object->add_cap( 'read_private_posts' );     $role_object->add_cap( 'read' );      Which got me a little further. I can login and see the admin dashboard, but if I visit a scheduled post, then I still get 'page not found'. Can anyone see what I'm missing?


Plugin to check for duplicate attachments via XMLRPC

I am trying to create a plugin to prevent duplicate attachments from XMLRPC calls "metaWeblog.newMediaObject". The idea is, before wp_insert_attachment function is called, you generate a unique hash of the file, and check against the database. Each attachment insert will save the unique hash of the file. If there is a match, then don't save the same file and return the guid of the existing file. However, I can't seem to be able to find a hook for wp_insert_attachment. Looking through the function, there are no do_action or do_filter for me to hook onto. Can anyone suggest another route to accomplish this?


Can't echo get_delete_post_link

I am using **custom post_type** and **inside the loop** I echo get_delete_post_link but there is nothing echoing.               <?php      $wpquery = new WP_Query('post_type=myposts');       if( $wpquery->have_posts() ) {          while ($wpquery->have_posts()) : $wpquery->the_post();                  $id = get_the_ID();             //just a test to see can I get post IDs and I get them             echo $id; ?>                  <a href="<?php echo get_delete_post_link($id); ?>">Delete             <?php endwhile; }               wp_reset_query();?>      This is the output               Delete


Unit testing wordpress plugins with plugin options

I'm new with unit testing in Wordpress. I managed to setup the unit testing environment using PHP Unit and Wordpress tests but I am having trouble accessing the plugin options that I've set in the plugin.               class nrw_pg{            private $twitter_id;            public function __construct(){         $options = get_option('nrw_pg_options');         $this->twitter_id = (!empty($options['nrw_pg_options_twitter_id'])) ? $options['nrw_pg_options_twitter_id'] : '';            }            public function get_tweets(){          $result = null;          $protocol = is_SSL() ? 'https://' : 'http://';          $result = wp_remote_get($this->protocol . "api.twitter.com/1/statuses/user_timeline.json?screen_name=". $this->twitter_id."&count=11&exclude_replies=true");               return $result;        }     }          $GLOBALS['nrw_pg'] = new nrw_pg();      It all works smoothly when accessing it from the browser. But on the unit tests it doesn't seem like it has knowledge of the options that I have set.               require_once('D:\web_files\tester\wordpress\wp-content\plugins\nrw_pg\nrw_pg.php');          class Nrw_Pg_Test extends WP_UnitTestCase {         public $plugin_slug = 'nrw_pg';         public $options;              public function setUp() {             parent::setUp();                  $this->nrw_pg = $GLOBALS['nrw_pg'];              }              public function test_get_tweets(){                  $this->assertNotNull($this->nrw_pg->connect());         }          }      Is there anything else that I need to setup aside from the wp-test-config.php and other things mentioned here: http://stackoverflow.com/questions/9138215/unit-testing-wordpress-plugins in order to make this work? It seems like other things are working like testing if specific filters are added. But the options it doesn't seem like they have been initialized. Any ideas?


WPDB Query Question with Category Only

I am trying to pull up posts from only category ID 18 with this query for a plugin I am working on but it will not work. I can not use `query_posts` or `WP_Query` in the place I am using this.               global $wpdb;     $posts = $wpdb->get_results( "SELECT ID, post_title, post_content, post_date         FROM $wpdb->posts         LEFT JOIN $wpdb->term_taxonomy         ON($wpdb->term_relationships.term_taxonomy_id = $wpdb->term_taxonomy.term_taxonomy_id)         WHERE $wpdb->term_taxonomy.term_id = 18         AND $wpdb->term_taxonomy.taxonomy = 'category'         AND post_status = 'publish'         AND post_type = 'post'                    ORDER BY post_date DESC         LIMIT 25" );


How does the Twenty Twelve Navigation Bar work?

I have been pouring through the code trying to find out how the navigation menu is actually built. In my header I see:
Menu
         Skip to content

      I'm mostly trying to figure out where the sub-menu comes from. I need to add a div inside the sub menu for some extra styling.


How to turn off searching from URL and go straight to 404 page

When I put something after my domain name that doesn't exist I am taken to my 404 page, for example:               example.com/sdkjhfdsjk      But if I put something that exists as an image I am taken to the page for that, for example: example.com/imagename How can I turn this off. I only want to be taken to pages or posts that exist. UPDATE: This has been marked as a duplicate but the accepted answer to that does NOT fix this. I added:               remove_action('template_redirect', 'redirect_canonical');      to my themes `functions.php` but the same action happens.


What is making these links open as new windows?

<?php } } ?>                       <?php else : ?>

<img src="<?php echo get_template_directory_uri(); ?>/image/theme/minishadow3.png" alt="">
<a class="team" href="<?php echo get_template_directory_uri(); ?>/image/post/bigimage.png" title="John Smith (General Manager)
Lorem ipsum is simply dummy data text printing"><img src="<?php echo get_template_directory_uri(); ?>/image/post/t1.png" alt="" class="home-team-img">
John Smith

General Menager

<img src="<?php echo get_template_directory_uri(); ?>/image/theme/minishadow3.png" alt="">
<a class="team" href="<?php echo get_template_directory_uri(); ?>/image/post/bigimage.png" title="Marry Anderson (Ass. Manager)
Lorem ipsum is simply dummy data text printing"><img src="<?php echo get_template_directory_uri(); ?>/image/post/t2.png" alt="" class="home-team-img">
Marry Anderson

Ass. Manager

<img src="<?php echo get_template_directory_uri(); ?>/image/theme/minishadow3.png" alt="">
<a class="team" href="<?php echo get_template_directory_uri(); ?>/image/post/bigimage.png" title="Micheal Fisher (Graphicer)
Lorem ipsum is simply dummy data text printing"><img src="<?php echo get_template_directory_uri(); ?>/image/post/t3.png" alt="" class="home-team-img">
Micheal Fisher

Graphicer

<img src="<?php echo get_template_directory_uri(); ?>/image/theme/minishadow3.png" alt="">
<a class="team" href="<?php echo get_template_directory_uri(); ?>/image/post/bigimage.png" title="Alexsandra Smith (Personel Manager)
Lorem ipsum is simply dummy data text printing"><img src="<?php echo get_template_directory_uri(); ?>/image/post/t4.png" alt="" class="home-team-img">
Alexsandra Smith

Personel Manager

<img src="<?php echo get_template_directory_uri(); ?>/image/theme/minishadow3.png" alt="">
<a class="team" href="<?php echo get_template_directory_uri(); ?>/image/post/bigimage.png" title="Matheus Prahk (Code Developer)
Lorem ipsum is simply dummy data text printing"><img src="<?php echo get_template_directory_uri(); ?>/image/post/t5.png" alt="" class="home-team-img">
Matheus Prahk

Code Developer

<img src="<?php echo get_template_directory_uri(); ?>/image/theme/minishadow3.png" alt="">
<a class="team" href="<?php echo get_template_directory_uri(); ?>/image/post/bigimage.png" title="Philips Garden (Online Support)
Lorem ipsum is simply dummy data text printing"><img src="<?php echo get_template_directory_uri(); ?>/image/post/t6.png" alt="" class="home-team-img">
Philips Gorden

Online Support

                     <?php endif; endif; ?>


How to make profile page for each user posting on the blog?

We have out company blog and few employees write on this blog, what I want is when anyone click on the UserName of the user who wrote the post it navigate to this user profile page which we will write there a brief about this user experiences. For example in this blog post: http://encosia.com/jquery-asp-net-web-api-and- json-net-walk-into-a-bar/   If you clicked on the "By Dave Ward;" It will open this user profile page. We need to do the same in our blog, is there a plugin I should install?


Thesis RSS hook?

New to customizing Thesis for WP so things are going slow. I was wondering if there is a hook for removing the rss subscribe on menu li? Trying to put this in footer. Thanks.


passing moree than one value of slugs in taxonomy using variable

array(       'taxonomy' => $taxonomy_array_value,                 'field' => 'slug',       'terms' => array( $term_name )     )      This is my code where `$taxonomy_array_value` and `$term_name` are variables coming from ajax. **First Case :**   `$taxonomy_array_value = Colors` and `$term_name = 'red'` then `WP_Query` is working fine. **Second Case :**   `$taxonomy_array_value = Colors` and `%term_name = 'red','green'` but in this case it's not working. While instead of using variable if I direct pass 'red','green' in 'terms' then it's working fine but not working with variable Don't know why. Here is my code from which I am getting $term_name               $term_name = "'" . implode("','", $term_value_array) . "'";


Show image if author meta (profile fields) exists outside loop

I am trying to show the profile fields (like AIM, Jibber) outside the loop. I managed to do that with               <?php     global $post;     $author_id=$post->post_author;     ?>          <?php     $field='aim';     the_author_meta( $field, $author_id );     ?>      But now, I can't put an image beside it if such a field exists. This works inside the loop, but not outside:               <?php if (get_the_author_meta('aim')) {     echo "
                  "; } ?>      How do I get this image outside the loop and only if the field exists?


How to turn off automatic operation for Nivo Slider?

I am using Nivo Slider plugin to run a slideshow on my site. It automatically runs a slideshow on top of my screen. However I want the user to do this _manually_ (clicking to advance to the next slide). How do I turn off the automatic operation?


How to create a search box that are able to search other website?

Let's say, I have three websites, which are A (wordpress), B(php), website C(mediawiki). Now, I want to create an search box on A that can search from A, B, and C. How can I do this? Is there any plugins that are gonna helpful? Thanks!


How can I put this JavaScript into WordPress?

I've got a client who is using WordPress and WooCommerce. I'm trying to add a button to a file. I can get the button to show up, both in the front end editor, and in the template files. But I can't get it to function, nothing happens on hover or on click. No matter which theme I try. I assume it's the way WordPress handles JavaScript, but I'm not 100% sure. What the button is supposed to do is when clicked on a pop up from myregistry.com appears and the user can then add a product to the registry. I don't know very much JavaScript yet, I have used a little jQuery but mostly in the form of plugin's, with some minor changes here and there. So, how could I get this to work inside of Wordpress? Any help or tips would be great.                   <!-- Start AddToMyRegistry Button Tag -->       `<script id='scriptMyRegistryWebWidgetButtonScript' type='text/javascript'>`       `document.write("<img id='ImgAddToMyRegistryButton' src='http://images.myregistry.com/Images/MyRegistry/WebWidgetImages/netSol/742.jpeg' onmouseover='ImgAddToMyRegistryButton_onmouseover(this);' onmouseout='ImgAddToMyRegistryButton_onmouseout(this);' style='border-width: 0px; cursor: pointer;' onclick='CreateAddToMyRegistryWidget();' />");       function ImgAddToMyRegistryButton_onmouseover(elementParam)       {elementParam.src = 'http://images.myregistry.com/Images/MyRegistry/WebWidgetImages/netSol/742.jpeg';}       function ImgAddToMyRegistryButton_onmouseout(elementParam)       {elementParam.src = 'http://images.myregistry.com/Images/MyRegistry/WebWidgetImages/netSol/742.jpeg';}`       `</script>`       `<!-- End AddToMyRegistry Button Tag -->`


Resize not resizing images with Capitial extension like JPG

I have used thie resize method to resize image and its working fine but only the problem which i am facing right now is that is not resizing image with extension in capital letter like JPG,JPEG,GIP. the same image will be resized if we just change the extension from JPG to jpg the image will be resized. Please let me know how can i fix this.               $image = wp_get_image_editor($targetFile);      if ( ! is_wp_error( $image ) ) {      //$image->rotate( 90 );       $image->resize( 300, 400, false );       $image->save($targetFile);      }


Can you refresh ONLY the wordpress adminbar and not the whole page?

Here is my challenge: I have included an electronic wallet in the admin bar of my wordpress site and what I need to do is to refresh **ONLY** the admin bar so that, upon a purchase, the electronic wallet is updated and reflects the new total from the database with the purchase amount subtracted from it without having to refresh the whole page. I mainly do this to avoid excessive bandwidth usage and the reinitializing of certain plugins I have on the site such as an mp3 player. Does anyone have any ideas? Been trying to write a function for it and call that function when the database is being updated but I haven't been able to figure it out, (pretty new at this). Any suggestions will be greatly appreciated. Thanks in advance!


PHP code to use on next & previouspage links

I'm having an issue with wp_link_pages tag. I want to list the number of pages of each post with 'next' and 'previous' links that are two image arrows. To better understand the problem I'm having, please see this URL: http://next.lab501.ro/smartphone/nokia-n9-meego-to-go/2 At the top of the body you'll see a list of pages of that post. In the left and right side of the pagination there are two green arrows, I want them to function as links to 'nextpagelink' and 'previouspagelink'. I've read the wordpress codex regarding wp_link_pages and 'styling page links' but I still can't figure this out.


allow new users to post an article before they sign up

I am new to wordpress development but I can get it done if I am guided on the right direction. I have allowed subscribers to post articles on my site.Now I am trying to allow them to post BEFORE they sign up. so step 1 : land on site and click submit article step 2 : fill up the form step 3 : are you registered? signin here or sign up and form appears for them to sign up after they hit submit, it submits their article + signs them up anyway to do this ?


navigation link based on custom field

I'm looking for a method to order posts by a custom field so that the navigational links on a single post template would point to the next or previous post in the sequence defined by a number in a custom field. Note: The posts are all in the same category. I can define the list of posts in the category in the order defined by the custom field value but when I view the single post, with a template modified to show only the selected category, the nav links at the bottom of the page are based on chronological sequence. What I need is a way to link to the next/previous post in the same category, where the order is defined by the custom field value. Is there anyway to override the chronological ordering of the posts? Thanks.


get meta value from page query

I need to check each page to see if it has a default template or another template assigned. If it's default, I want to do X if it's not, then I will do Y. Problem I found is that the query is not showing that particular field. I wanted to find                [meta_key] => '_wp_page_template',      [meta_value] => 'default'      that is what I was testing for but it doesn't seem to be working. I did some looking here and found this code                function get_meta_values( $key = '', $type = 'page', $status = 'publish' ) {     global $wpdb;     if( empty( $key ) )         return;     $r = $wpdb->get_col( $wpdb->prepare( "         SELECT DISTINCT pm.meta_value FROM {$wpdb->postmeta} pm         LEFT JOIN {$wpdb->posts} p ON p.ID = pm.post_id         WHERE pm.meta_key = '%s'          AND p.post_status = '%s'          AND p.post_type = '%s'     ", $key, $status, $type ) );     return $r;     }      so then in my custom query using WP_Query, I check like so                $args = array(                 'post_type' => 'page',                 'posts_per_page' => -1,             );                  $page_query = new WP_Query( $args );                  if ( $page_query->have_posts() ) : while ( $page_query->have_posts() ) : $page_query->the_post(); ?>             <?php $template = get_meta_values('_wp_page_template');             if( $template != 'default'){ ?>      //run X here       }      else {      //run Y here       }      the rest of the loop follows below.      Some of the pages should run X and some should run Y but they all seem to be running X. Can you tell me what I am doing wrong? When I do a var_dump of $page_query, I do not see the [meta_key] field in the array. That's why I thought the get_meta_values function would solve it.


Style something only on the home page

I am relatively new to Wordpress, but I'm sure there's a way to do what I'd like to do. I have a container in my template, and on the home page I'd like to specify slightly different padding to this element. My current CSS is as follows:               #main_content .container {     position: relative;     padding: 120px 0;     }      I'd like to bring the padding down to 80px if I'm on the Home page, otherwise keep it that way. Is this something I'd have to do within the template or are there fancy 'WordPress only' CSS tricks that I am currently unaware of? In my limited experience, I think I should be able to specify whether or not the page `is_home` or similar, and select a custom stylesheet in the `header.php` file for the home page. Presumably, with `!important` after my padding change for the CSS. Can I get some direction? The results I'm finding through searching aren't particularly what I'm trying to do.


Taxonomy archive template not working

I have a custom taxonomy (Talks) I create for custom taxonomy `taxonomy-talks.php` its working on my localhost. When I upload FTP still call `archive.php` or `taxonomy.php`. It must call `taxonomy-talks.php`but not working. How can I fix it? My Taxonomy Code:               register_taxonomy('Talks',array (       0 => 'videolar',     ),array( 'hierarchical' => true,               'label' => 'talks',              'show_ui' => true,              'query_var' => true,              'rewrite' => array('slug' => 'talks')) );


Creating a plugin that will add options. Where should the options menu pages go?

I am creating a plugin for a restaurant theme that will provide a few options to add the restaurant hours of operation. Currently, I use a custom post type to control the restaurant hours but have since realized this is a bad practice because if the theme changes that info will be lost. I would like to separate them via a plugin and uses options instead of a custom post type. Is there a standard practice for where the options menu pages should be placed? Theme customizer page? Plugin settings? Custom page? New page under the Settings section? **Update** Planning to use the existing wordpress APIs so I am not worried about the storage of the data.


Author.php display profile for all types of users

I'm using wp-usersonline plugin with user links, when you click for subscribers it goes to a not found page but works fine for authors, im thinking is there a way to redirect subscribers to a profile page and change the link into http://domain.com/member/profile=ID. I found some scripts that will redirect to specific url but i dont know what to do next?               function new_author_base() {         global $wp_rewrite;         $author_slug = 'profile';         $wp_rewrite->author_base = $author_slug;     }     add_action( 'init', 'new_author_base' );


Add shortcode within the_content()

I'm trying to add a shortcode within the text of the_content(). It is possible to add it to the beginning or the end however I cannot figure out how I would get it to show after say 200 characters. Here's the shortcode that I need added: [related-posts] I've tried this but this isnt suitable for me because it replaces every paragaraph with a shortcode.


Costum walker with sub menu item count

I have a menu like:               -Item1     --Sub1     --Sub2     --Sub3     --Sub4     --Sub5     --Sub6     -Item2     -Item3      and want to do some costum stuff after x subitems, so I have to determine when x is reached. I tried to define a variable in my costum class and then increment it in end_el():               class Walker_Nav_Menu_Costum extends Walker_Nav_Menu {              var $x = 0;              function end_el( &$output, $item, $depth = 0, $args = array() ) {                  if ($depth == 1)             {                 $x++;             }                  $output .= "<!-- x:".$x."-->";                  $output .= "</li>\n";         }     }      but unfortunately its always 1 for every element :-/ How would one do this correctly?


How to make condition, based on custom fields value?

So what i would like to do is order in some CSS depending on the value of a custom field. The code below just says that if there is ANY value, do X, else do nothing...               <?php $pageNumbered=get_post_meta($post->ID, 'page-number', true); ?>         <?php if ( $pageNumbered ) : ?>             <div class="page-number left">                 <?php echo get_post_meta($post->ID, "page-number", true); ?>             </div>                           <?php else : ?>              <?php endif; ?>      ...what i want to do is say if the value is X do Y, if it is Z do XY etc etc... Thanks guys!


Category and children post count

I've a situation where I cannot get correct post count from category... and I've tried everything but customizing wp_list_categories with walker. So I've category hierarchy:               cat1      cat2 (total 8)       cat3 (total 5)       cat4 (total 3)      All posts are under cat2 and cat3-cat4. I'm displaying cat1 and want to show post count. If I use following function:               function wp_get_postcount($id) {       //return count of post in category child of ID 15       $count = 0;       $taxonomy = 'category';       $args = array('child_of' => $id);       $tax_terms = get_terms($taxonomy,$args);       foreach ($tax_terms as $tax_term) {         $count +=$tax_term->count;       }       return $count;     }      I get total count of 16. Which is double the real amount, obviously counting twice. Before this I tried:               $children_cats = get_categories(array(             'hide_empty'    => 0,             'taxonomy'      => 'category',     ));      And used foreach on array and echoing out count. But it would return 0, obviously because parent cat has no posts selected under it... wp_list_categories actually displays correct value. But I wasn't able to extend it with walked so I would get my complicated html:
                                 <a class="subcatimg" href="<?php echo $cat_link; ?>"><?php if (function_exists('get_cat_icon_lite')) echo get_cat_icon_lite( $child->cat_ID );?><?php _e('Show All','medishop'); ?>
<a href="<?php echo $cat_link; ?>"><?php echo $child->name; ?>

<?php echo wp_get_postcount($child->cat_ID); ?> <?php _e('products in this category','medishop'); ?>

      I'm really out of options. Any advice?


Error sending array of inputs

Hello I am getting a Error of the Wordpress includes, this error appears when I post the multiple values of a taxonomy               <form role="search" method="post" id="searchform" action="<?php echo home_url( '/' ); ?>">          <select name="books[]" multiple>       <option value="a">a</option>       <option value="b">b</option>     </select>     <input type="submit" id="searchsubmit" value="Search" />     </form>      **Warning** : strpos() expects parameter 1 to be string, array given in **www.domain.com\wordpress\wp-includes\query.php** on line **1718**      **Warning** : preg_split() expects parameter 2 to be string, array given in **www.domain.com\wordpress\wp-includes\query.php** on line **1719**      **Warning** : Invalid argument supplied for foreach() in **www.domain.com\wordpress\wp-includes\query.php** on line **1720**                   foreach ( $GLOBALS['wp_taxonomies'] as $taxonomy => $t ) {             if ( 'post_tag' == $taxonomy )                 continue;   // Handled further down in the $q['tag'] block                  if ( $t->query_var && !empty( $q[$t->query_var] ) ) {                 $tax_query_defaults = array(                     'taxonomy' => $taxonomy,                     'field' => 'slug',                 );                      if ( isset( $t->rewrite['hierarchical'] ) && $t->rewrite['hierarchical'] ) {                     $q[$t->query_var] = wp_basename( $q[$t->query_var] );                 }                      $term = $q[$t->query_var];                      if ( strpos($term, '+') !== false ) {                     $terms = preg_split( '/[+]+/', $term );                     foreach ( $terms as $term ) {                         $tax_query[] = array_merge( $tax_query_defaults, array(                             'terms' => array( $term )                         ) );                     }                 } else {                     $tax_query[] = array_merge( $tax_query_defaults, array(                         'terms' => preg_split( '/[,]+/', $term )                     ) );                 }             }         }      The error does not appear when I post it to searchresults.php or when I use when I use a single value or a none taxonomy name;               <select name="books">     <select name="NoneTaxonomyName[]" multiple>      does someone know how to resolve this?


How to get class from widget area

So... I registered my widget areas with this code:                   register_sidebar( array(         'name' => __( 'Posts Widget Area', 'ikos' ),         'id' => 'primary-widget-area',         'class'         => 'post-w',                 'description' => __( 'Shown only in Blog Posts, Archives, Categories, etc.', 'ikos' ),         'before_widget' => '
',         'after_widget' => '
',         'before_title' => '
',         'after_title' => '
',     ) );      Note that I added a class. I want to "grab" the class (dynamically) and use the same code for all sidebars...something like: `<div id="sidebar" class="` **HERE THE CODE THAT GRABS THE CLASS**`" role="complementary">` But I don't know how to code that tiny thing. Help please :) **EDIT** I am using this code to "wrap" my sidebars in functions.php               // Before Sidebar - do_action('st_before_sidebar')          // call up the action     if ( !function_exists( 'before_sidebar' ) ) {          function before_sidebar($columns) {     if (empty($columns)) {     // Set the default     $columns = 'five';     } else {     // Check the function for a returned variable     $columns = $columns;     }          // Apply the markup     echo '
';     }     } //endif     // create our hook     add_action( 'ikos_before_sidebar', 'before_sidebar');                      // After Sidebar     if ( !function_exists( 'after_sidebar' ) ) {     function after_sidebar() {     // Additional Content could be added here        echo '
';     }     } //endif     add_action( 'ikos_after_sidebar', 'after_sidebar');        **EDIT 2** In pages I just call the sidebars `get_sidebar('page');` and inside the sidebar-page.php I call the before and after action written in functions. I need to add a dynamic variable for the classes...is there a way to do so?


How do you center the main menu in CSS?

Do any of you know of a way to center the main menu on my company's site? I have been trying all day and am frazzled! I've tried editing the stylesheet but nothing has fixed it. I've tried throwing `white-space: nowrap` around in the CSS but it had no effect regardless of where I put it. Ahh! We're using the Meta-Morphosis theme if that is any help. I tried creating a link but I can't use our IP address link with the link tool in the post.               http://74.220.219.109/~dentalsp/      Please help! I am so frustrated. I really appreciate it!


How to support extra color options for shortcodes?

I'm creating a WordPress theme and it's almost complete. I've created few shortcodes for some of the elements, including buttons with different color options like blue, green, red etc. What I want now is to allow users to be able to provide their own color hex value if they don't like the provided color options, like this for example:               [button color="#123423"]Button Text[/button].       Now I also know how I would get the value in the backend, but I just can't figure out how I will provide support for this in my CSS. For instance, I've got something like this:               .button-blue{         background: blue;     }     .button-green{         background: green;     }      Now how can insert the user provided button color for that specific button?


installed Wordpress but can't upgrade or add plugins due to webdav https?

Uploaded wordpress and themes via webdav https but can't seem to add plugins or upgrade Wordpress. I'm presuming the is a webdav security feature? Is there any way around it?


Problems with rewrite rule

I realy cant to figure this out. What i want to do, is this URI http://www.hotels- lithuania.net/index.php?page=76&type=hotels&id=1 transform to http://www.hotels-lithuania.net/item/hotels/1. Actualy i have read tons of pages, what i come to is this:               add_action( 'init', 'wpa5413_init' );     function wpa5413_init()     {         add_rewrite_rule(             'item/([^/]+)/([^/]+)?',             'index.php?page=76&type=$matches[1]&id=$matches[2]',             'top' );     }     add_filter( 'query_vars', 'wpa5413_query_vars' );     function wpa5413_query_vars( $query_vars )     {         $query_vars[] = 'type';         $query_vars[] = 'id';         return $query_vars;     }      If I enter hotels-lithuania.net/item/hotels/1 to my browser it cuts to hotels- lithuania.net/item/ and ofc no items displayed. Screen from rewrite analyzer plugin: i.stack.imgur.com/AgNoq.png Sorry for bad hyperlinks, but i am new here and can't post ir proper EDIT: I dont know why, but i had guid in my db with value localhost/hotel/? **page_id=76** So my final rewrite_rule looks like this:               add_action( 'init', 'wpa5413_init' );     function wpa5413_init()     {         add_rewrite_rule(             'item/([^/]+)/([^/]+)?',             'index.php?page_id=76&itemType=$matches[1]&itemId=$matches[2]',             'top' );     }     add_filter( 'query_vars', 'wpa5413_query_vars' );     function wpa5413_query_vars( $query_vars )     {         $query_vars[] = 'itemType';         $query_vars[] = 'itemId';         return $query_vars;     }      And using these variables with:               global $wp;     $type = $wp->query_vars['itemType'];     $id = $wp->query_vars['itemId'];


Change maxlength of link_description in dashbord link section?

Im using wordpress together with qtranslate and it works on pages and post but not in menus, widgets etc. So i created jquery scripts to solve those issues. The problem is that the field "link_description" in wordpress link section is limited to 30. Using two languages or more, 30 characters is not enough. Is it possible to change or even remove this property without modifying any core files?


Trying to setup a dev subdomain, but url loads as /dev/ instead

I created a subdomain (dev.mysite.com) and I duplicated my live site into this subdomain. However, when I go to dev.mysite.com, it loads mysite.com/dev instead. I changed siteurl and home in wp_options to dev.mysite.com, removed the entire .htaccess, deleted W3 Total Cache, and it still does it. When I just put a test index.html file, the subdomain loads correctly. It's only after I add the Wordpress files that it does this. Am I missing something? What would cause this?


Slug Formatting : Acceptable Characters?

I have done a lot of googling on this so I sincerely apologize if there is a codex entry for this but for the life of me I can not find a hard and fast rule about what characters are acceptable in a "slug" ( any slug really, but more specifically for a custom post type in this instance). Presently we have a situation where we have a few custom post types with a slug structure like (pseudo) : `some_Context_Thats_Not_A_Category_slug/sub_context_thats_not_a_category_slug/` + the post title The segment in `grey` is the "slug" in it's entirety. In practice this would look like say : `hamburgers/cheeseburgers` as the post type slug Is the forward slash use allowed / safe in this scenario? Criteria for an answer to be accepted: "yes" or "no" to the question posed and a link to where I can find contemporary WP slug rulesets. Thanks in advance!


How to use current_post to open a new unordered list every five posts

How can I add a break dynamically after 5 posts have been display to create a list of post titles?

                 <?php                     $args = array( 'post_type' => 'custom-post-type' );                     $query = new WP_Query( $args );                            if ( have_posts() ) : while ( $query ->have_posts() ) : $query ->the_post();                       ?>
<?php the_title(); ?>
                          <?php $query_count = $query ->current_post + 1; ?>                     <?php if ( $query_count % 5 == 0): ?>

                        <?php endif; ?>                      <?php endwhile; endif; wp_reset_postdata(); ?>

      At the moment first 10 posts are displayed correctly with the remaining posts not being displayed. There is a empty third div element following the first 2 divs but no posts. I can't see what I've missed. Thanks for any feedback.


To create a theme or use an existing one?

Thanks for stopping by. So I have been asked to build an intranet for a company's 500+ staff to use. I've weighed up the options and decided to run with Wordpress for it. I started to build using this theme "https://github.com/helpful/helpful- intranet", which is working quite well. However, I find seeing as I have never designed a theme for my self I am spending a lot of time working it out. Would I be better off starting from scratch completely and building my own theme or would this just be too much of an undertaking for a person new to web dev and Wordpress? Or, maybe I should look at using a child theme? I have two months to complete the project. Also, what are some good resources to quickly learn how to develop on Wordpress? My current skill level:   Good - HTML & CSS   OK/beginner - PHP, JavaScript & jQuery


Markdown everywhere?

I just read this blog post which explains that Markdown support has been added to all Wordpress.com blogs as a feature. I administer my own WordPress installation and am currently running (as far as I know) the latest version of WordPress, 3.8.X, I believe. Is Markdown support built into WordPress standalone? I'm in the midst of migration so it's not so easy to check. Will I be able to write, edit, and allow my users to comment using Markdown fairly seamlessly? Being able to compose posts in Markdown will greatly encourage me to start writing more :)


Default category link for a custom category is a broken link

I'm developing a Multisute plugin that is supposed to setup sites using a specific template, including setting up several static pages and menu items, as well as a "Blog" category for blog posts. The category is created fine, and has one post in it, and I've figured out how to setup the menu link to the blog category using the `page_for_posts` option. However, WordPress creates default links to each category in the sidebar of the blog under "Categories". And the link it creates there is broken. It links to `/category/blog`, but when you click on the link, you get a 404 - "Well, this is embarassing...". The same link shows up in the footer of the default 404 template, and is still broken (obviously). I don't know why this link doesn't work, but I've figured out that if I visit the permalink settings page (or simply run `flush_rewrite_rules();`) from the created site, it works. So I've run that from the plugin's setup script, using switch_to_blog, but for some reason, since the plugin script runs on the main site, it doesn't work. I still get a 404 for that URL until after I run it from the created site (or visit the permalink structures page on the created site). Here's the debug script I've created that works if I visit it from the created site, but not from the main site:               //Filename: wp-admin/debug.php          require_once('./admin.php');          global $wp_rewrite;     switch_to_blog(84); //this is the created blog in question     $wp_rewrite->init(); //JUST to make sure it's initialized for the correct blog     $wp_rewrite->flush_rules();     restore_current_blog();     $wp_rewrite->init(); //To make sure it's set back to where it should be.      So apparently there's a difference between running it on the main site, and on the created site. I don't know how rewrite rules work with wordpress multisite... so I don't know how to find what is changing in one case but not in another. The rules returned from `get_option(rewrite_rules)` for blog 84 are almost identical in either case, so I feel like there must be another step happening to refresh some rewrite cache or something when I run it from the created site (blog 84), that is NOT happening when I run it from the main site. Any ideas? Does inserting a custom category on a newly created site work for you? How can I find out what is changing to make it work when I run flush_rewrite_rules from the created site? Thanks!


Why activate_plugin is not working in register_activation_hook

I am trying to activate second plugin automatically while activating first plugin.               register_activation_hook(__FILE__, 'example_activation' );     function example_activation() {             include_once(ABSPATH .'/wp-admin/includes/plugin.php');             activate_plugin('hello.php');     }      Its not working inside register_activation_hook.. Its working if i use it directly like:               include_once(ABSPATH .'/wp-admin/includes/plugin.php');     activate_plugin('hello.php');      How can i fix it? Thanks for help ## Solution: I am using this for myself now:               // When this plugin activate, activate another plugin too.     register_activation_hook(__FILE__, function(){         $dependent = 'hello.php';         if( is_plugin_inactive($dependent) ){             add_action('update_option_active_plugins', function($dependent){                 /* for some reason,                  activate_plugin($dependent);                     is not working */                 activate_plugin('hello.php');             });         }     });           // When this plugin deactivate, deactivate another plugin too.     register_deactivation_hook(__FILE__, function(){         $dependent = 'hello.php';         if( is_plugin_active($dependent) ){             add_action('update_option_active_plugins', function($dependent){                 deactivate_plugins('hello.php');             });         }     });


removing wordpress generated code from the head section?

Specifically, I'm talking about the following which gets added automatically: 1) `<script type='text/javascript' src='http://mysite.com/wp- includes/js/l10n.js?ver=20101110'></script>` 2) `<script type="text/javascript"> //<![CDATA[ var _wpcf7 = { cached: 1 }; //]]> </script>` 3) `<link rel="stylesheet" href="http://disqus.com/stylesheets/theme/disqus.css?v=2.0" type="text/css" media="screen" />` 4)               <style type='text/css'>      #wpadminbar .quicklinks li#wp-admin-bar-stats {height:28px}     #wpadminbar .quicklinks li#wp-admin-bar-stats a {height:28px;padding:0}     #wpadminbar .quicklinks li#wp-admin-bar-stats a img {padding:4px 11px}     </style>      Not sure about #1, I know #2 is generated by the Contact Form 7 plugin, #3 is Disqus, and #4 is from the new admin bar in 3.1 and although I added `show_admin_bar( false );` to my functions file, the styles still show up in my head section. Anyway to get rid of all or at least some of these?


category filter doesn't work in WPML

I translate the categories to another language, but in the main page, the two language categories are all displayed. How can I filter another language? My WPML version is 2.4.1. I found all the categories are displayed on my theme, is there any way I can get the correspondence between the different language categories, so I can filter it.


Add Custom Filter to Admin User list

What is the correct way to add a custom filter (a dropdown box in this case) to the admin user list (wp-admin/users.php)? There are no filters or actions that I see to hook into that would allow me to output a select box. I know I can inject it via javascript, but I'm hoping there's a way to do it on the PHP side. I am planning on using the results of that filter int as outlined here: How to search all user meta from users.php in the admin


WP Database Error (Windows Server 2008 & SQL Server)

I have a WP site up and running for my wife and she attempted to install a text widget that linked to her Twitter account (she says HTML was taken from Twitter.com). I am not sure exactly what she did or what was going on, but now she gets the following error when going to /wp-admin of the site:               WordPress database error Array for query INSERT INTO `wp_options` (`option_name`,      `option_value`, `autoload`) VALUES ('widget_text', 'a:2:{i:2;a:0:{}     s:12:"_multiwidget";i:1;}', 'yes') ON DUPLICATE KEY UPDATE `option_name` = VALUES\     (`option_name`), `option_value` = VALUES(`option_value`), `autoload` = VALUES     (`autoload`)--SERIALIZED made by require_once, require_once, require_once,      require_once, do_action, call_user_func_array, wp_widgets_init, do_action,      call_user_func_array, WP_Widget_Factory->_register_widgets, WP_Widget->_register,      WP_Widget->get_settings, wp_convert_widget_settings, update_option, add_option       I have no idea what this even means. I am running WP on a Windows Server 2008 installation with SQL Server 2008. If you need more information, I will be glad to supply it. I really am not sure how to recover her site from this. Thanks! Edit: This site has been running fine for a month now and just now blew up after adding the text widget and adding the Twitter HTML. Edit 2: I found the offending JavaScript in the wp_options (widget_text) and removed it but am still receiving the same error listing on the admin page.


Using shared SSL for login/admin

I want to use SSL for login/admin. However, since I'm using a shared server, my web host only provides a shared SSL. That means instead of `https://www.regular-domain.com` I have to go to `https://servername.webhostname.com/~myusername/`, which throws Wordpress off since it expects everything to be under the regular domain.