Querying meta values within an array

Okay so I'm using the relationship field from Advanced Custom Fields against a custom post type. The relationship lists countries, when these are saved they are within a serialised array:               [country] => Array         (             [0] => a:2:{i:0;s:2:"19";i:1;s:2:"72";}         )          [_country] => Array         (             [0] => field_5049ccf3aac29         )      I want to query the custom post type by a single country from within this serialised array, but it's not in a very good format for me to do so. In SQL I'd be tempted to do a `LIKE` but that's neither ideal or available via `WP_Query` Any ideas on how I can achieve this? I guess I could do a bit of custom SQL to return all post IDs for this CPT where the country has the country ID I'm after, I'm just hoping I'm missing a very obvious / cleaner solution. **Edit 1** So I've got it working using the following code, but it's not ideal:                   <?php                  $query = new WP_Query(                 array(                     'post_type'     => 'some_post_type',                     'meta_query'    => array(                         array(                             'key'       => 'country',                             'compare'   => 'LIKE',                             'value'     => '"' . get_the_ID() . '"'                         )                     )                 )             );              ?>      This approach I mentioned before backed up by this similar question, again, not ideal but if anyone knows of a better solution I'm all ears.


which is the function that removes accented vowels?

Which is the function WP uses to convert words like "voilà" and "novità" to "voila" and "novita" in category slug? Can I recall it in my theme?


Split the_title

Is there a way to just split `the_title` into two different lines without a custom field? The titles in my blog are like small header above the maintitle. The Problem is, that at the moment I am using a custom field in the title - but google and disqus only use "original" title - without a custom field. So my question - couldn't I just split `the_title` e.g. into TitlePart One: (header) TitlePart Two: Mainline. Or can I use some code to make the custom field I am using for the title bring to the "original" title?


Making someone a WordPress administrator using PhpMyAdmin

After database problems on my provider side, I had to reset my admin user password. But then this user was not an admin anymore. In PhpMyAdmin I see that it has a user_status value of 0. How can I make this user an amin in WP dashboard ?


Assign default widgets to all sites in a multisite network

I created a widget for sidebar and footer in wordpress multiuser site. I want to make the widgets assigned in MAIN WIDGET AREA and SECONDARY WIDGET AREA by default when new site's created. Is there anyway to do it ? I am using wordpress 3.7.1 I tried this method, but didn't works, is it syntax problem calling that function ?


custom post type with group

I am using **Advanced Custom Fields**. Now I want to group with matching title for example I am getting this output in my code:               Red     03:39     I Knew You Were Trouble Lyrics Coming Soon…          The Hunger Games (Songs from District 12 and Beyond)     04:00     Safe & Sound (feat. The Civil Wars) Lyrics Coming Soon…          Ronan     04:25     Ronan Lyrics Coming Soon…          Red     04:55     State of Grace Lyrics Coming Soon…      but I want to display like this way:               Red     03:39     I Knew You Were Trouble Lyrics Coming Soon…          Red     04:55     State of Grace Lyrics Coming Soon…          The Hunger Games (Songs from District 12 and Beyond)     04:00     Safe & Sound (feat. The Civil Wars) Lyrics Coming Soon…          Ronan     04:25     Ronan Lyrics Coming Soon…      My Code:               <?php                 $title_post = array( 'post_type' => 'song' );                 $title = new WP_Query( $title_post );             ?>             <?php while ( $title->have_posts() ) : $title->the_post(); ?>                      <?php                      $posts_length = get_field('length');                     $posts_lyrics = get_field('lyrics');                     $posts = get_field('album_name');                          if( $posts ): ?>
                             <?php foreach( $posts as $post): // variable must be called $post (IMPORTANT) ?>                                 <?php setup_postdata($post); ?>

<?php the_title(); ?>

<?php echo $posts_length; ?>

<?php echo $posts_lyrics; ?>

                             <?php endforeach; ?>
                         <?php wp_reset_postdata(); // IMPORTANT - reset the $post object so the rest of the page works correctly ?>                     <?php endif; ?>                  <?php endwhile; ?>      Any ideas or suggestions? Thanks.


WPMU site in subdirectory: When I clone a site with NS Cloner Pro plugin, how do I remove the subdirectory from the URL?

I have a WPMU site in a subdirectory /new/. So my main URL is `example.com/new`. I have been able to use `.htaccess` and copy the `index.php` file into the domain to achieve just `example.com` for my main site. However... I have the 'NS Cloner Pro' plugin which clones WPMU sites in one click (great plugin!) but every clone still has the /new/ subdirectory. So what I want is `example.com/clone-site-1/` but what I'm getting is `example.com/new/clone- site-1`. I've tried using www.interconnectit.com "search-and-replace" script to remove /new/ but what happened was I was getting both `example.com/clone-site-1/` AND `example.com/new/clone-site-1` which tells me something went wrong. So how do I create just `example.com/clone-site-1/` WITHOUT `example.com/new/clone-site-1`?


wp_editor loses data, perhaps an html_entity_decode problem?

I have a custom meta box that I created with WP Alchemy. It has two wp_editor fields. These fields are behaving very strangely. If I just type simple text into them, they work just fine. But if I use text with formatting (bold, italics, lots of paragraph breaks, that sort of thing), it will initially save the text just fine. I save it, I see it there, I look at the site and I see it, and then I go to edit the post again, and the text is gone. I have the same problem whether I use WP Alchemy to create the meta box or not. Here is the code for the relevant field of the metabox:               <?php         $content = html_entity_decode($metabox->get_the_value('reviews'));          $id = $metabox->get_the_name('reviews');         $settings = array();              wp_editor( $content, $id, $settings );     ?>        I think the problem is somehow related to html_entity_decode. If I leave that out, it seems to save the data just fine, but of course it then shows HTML, which I don't want. Is there some alternative to html_entity_decode? Is there something else I can do to prevent my data from being erased? I have created dozens of meta boxes with wp_editor, and I have never seen this behavior. (And I have deactivated all of the plugins on my site to make sure it isn't a plugin conflict.)


How to get category paginated URL from post ID?

I have a category template which uses WP `next_posts_link` and `previous_posts_link` functions. They return category paginated URLs in form:   `http://example.com/category-name/page/3/` **Given a post ID, how can a get a category paginated URL like the above functions return?** I can provide the exact category ID as some posts will be in multiple categories. Use case: NextPrevious Post Link Plus! is a versatile WP plugin which can return a list of posts from specified categories. It is designed for use on single posts and returns single post URLS. I need to convert the direct URLs the plugin returns to category paginated URLs to achieve a specific effect i.e. keep user navigation in category view. For the solution, I can provide any info normally available from a post object (ID, desired category ID, etc.).


Using an if statement in the theme customizer page

I am slowly but surely chipping away at my first wordpress theme. I tried to make all of the aesthetics have different options, but well categorized so it is not overwhelming. So in my theme customizer page I have different checkboxes that could distinguish different options for a certain components style. For instance I could have two checkboxes to distinguish what button type the user wants. So my question is: How can I automatically uncheck one checkbox if the another in it's group is checked? I figure this will prevent me from having different options for the same element on the page checked and potentially messing something up. I figure if statements are probably the only way to go but I am unsure how to add them since I didn't create the page, it is all done using the theme customizer API. I am starting to think I should of used an options page instead, even though it is supposed to be a thing of the past and doesn't provide live previews, but it seems like it would add more flexibility.


How to stop unwanted splits in excerpts when using shortcodes for sliders or players

Am using this code in functions.php: Issue with enabling formatting in excerpts in Wordpress to allow shortcodes, javascript and formatting in the excerpt - works great, thanks. However, I am also using a slider (slideshow satellite), which breaks if I set my excerpt length too low (the slideshow size is obviously related to its content). Does anyone know a way to keep the excerpt length low but when a post has a player/slider called by shortcode, make sure it finishes the embedded code, no matter how long it is? Thanks functions.php:               function better_trim_excerpt($text)     {     $raw_excerpt = $text;     if ( '' == $text ) {         $text = get_the_content('');         //$text = strip_shortcodes( $text );         $text = apply_filters('the_content', $text);         $text = str_replace(']]>', ']]>', $text);                   // Enable formatting in excerpts - Add HTML tags that you want to be parsed in excerpts, default is 55         //$text = strip_tags($text, '');              // Set custom excerpt length - number of words to be shown in excerpts         $excerpt_length = apply_filters('excerpt_length', 900);              // Modify excerpt more string at the end from [...] to ...         $excerpt_more = apply_filters('excerpt_more', ' ' . '...');              $words = preg_split("/[\n\r\t ]+/", $text, $excerpt_length + 1, PREG_SPLIT_NO_EMPTY);         if ( count($words) > $excerpt_length ) {             array_pop($words);             $text = implode(' ', $words);                                 // IMPORTANT! Prevents tags cutoff by excerpt (i.e. unclosed tags) from breaking formatting             $text = force_balance_tags( $text );                  $text = $text . $excerpt_more;         } else {             $text = implode(' ', $words);         }     }     return apply_filters('wp_trim_excerpt', $text, $raw_excerpt);     }          // Remove the native excerpt function, and replace it with our improved function     remove_filter('get_the_excerpt', 'wp_trim_excerpt');     add_filter('get_the_excerpt', 'better_trim_excerpt');      Slideshow satellite default.php:               <?php     global $satellite_init_ok;     if (!empty($slides)) :          $style = $this->get_option('styles');     $images = $this->get_option('Images');     $imagesbox = $images['imagesbox'];     $pagelink = $images['pagelink'];     $textloc = $this->get_option('textlocation');     $responsive = $this->get_option('responsive');     $respExtra = (isset($respExtra)) ? $respExtra : 0;     $align = $this->get_option('align');     if (!$frompost) {         $this->Gallery->loadData($slides[0]->section);         $sidetext = $this -> Gallery -> capLocation($this->Gallery->data->capposition,$slides[0]->section);     }     ?>               <?php if ($frompost) : ?>                       <div class="orbit-default                 <?php echo($this->get_option('thumbnails_temp') == 'Y') ? ' default-thumbs' : ''; ?>                 <?php echo($align) ? ' satl-align-' . $align : ''; ?>                 <?php echo($responsive) ? ' resp' : ''; ?>              ">             <div id="featured<?php echo $satellite_init_ok; ?>">                  <?php foreach ($slides as $slider) :                     $thumbnail_link = wp_get_attachment_image_src($slider->ID, 'thumbnail', false);                     $attachment_link = get_attachment_link($slider->ID);                          $class= ($images['position'] == "S") ? "stretchCenter" : "absoluteCenter";                          echo "
ID}'                              data-thumb='{$thumbnail_link[0]}'>";                          $this->render('display-image',                        array('frompost'  =>  true,                             'slider'    => $slider), true, 'orbit');?>
                      <?php $this -> render('display-caption',                          array(  'frompost'   => true,                                  'slider'     => $slider,                                  'fontsize'   => null,                                 'style'      => $style,                                 'i'          => null                                 ), true, 'orbit');?>                  <?php endforeach; ?>

         <?php $this -> render('jsinit', array('gallery'=>false,'frompost' => true,'respExtra' => 0), true, 'orbit');?>                   <?php else : ?>           <div class="orbit-default         <?php echo($this->get_option('thumbnails_temp') == 'Y') ? ' default-thumbs' : ''; ?>                 <?php echo($sidetext) ? ' text-' . $sidetext : ''; ?>                 <?php echo($align) ? ' satl-align-' . $align : ''; ?>                 <?php echo($responsive) ? ' resp' : ''; ?>              ">             <div id="featured<?php echo $satellite_init_ok; ?>">                  <?php $i = 0; ?>                 <?php foreach ($slides as $slider) : ?>                          <?php                      $class= ($images['position'] == "S") ? "stretchCenter" : "absoluteCenter";                      echo "
Gallery->data->id}{$slider->id}' class='sorbit-wide ".$class."'                      data-caption='#custom{$satellite_init_ok}-$i'                     data-thumb='{$this->Html->image_url($this->Html->thumbname($slider->image))}'>";                          $this->render('display-image',                        array('frompost'  =>false,                             'slider'    => $slider), true, 'orbit');?>
             <?php             if ($sidetext != ( "Disabled" )) :                 if ($slider->textlocation != "N") :                     ?>                         <?php $this -> render('display-caption',                                array(  'frompost'   => false,                                        'slider'     => $slider,                                        'fontsize'   => $this->Gallery->data->font,                                       'style'      => $style,                                       'i'          => $i                                       ), true, 'orbit');?>                          <?php else : ?>                         <span class="sattext-none" id='custom<?php echo ($satellite_init_ok . '-' . $i); ?>'>                                          <?php                 endif;             endif;             $i = $i + 1;         endforeach;         ?>

         <?php $this -> render('jsinit', array('gallery'=>$slides[0]->section,'frompost' => false, 'respExtra' => $respExtra), true, 'orbit');?>     <?php     endif;     /*     * ****** PRO ONLY ************* */     if (SATL_PRO && $this->get_option('keyboard') == 'Y') {         require SATL_PLUGIN_DIR . '/pro/keyboard.html';     }          endif;     ?>


Using mysql to replace img src?

I tried to use the Enable Media Replace Plugin to replace some images on my site with updated versions. There is an option to update all instances where the file is used on the site, but this only applies to the original image. WordPress automatically generates several different sizes of each image and renames them with `-img-size.jpg`. These resized images' names are not being updated by the plugin, so anywhere that they are used (like, everywhere) is now a broken image. I looked at the post HTML and everything looks like:                                   Clicking on the broken image will take you to the updated image, but the image is broken in the post. For example, here's a post I replaced images on. Is there a MySQL command I can use that will turn **oldfilename** -300x168.jpg into **newfilename** -300x168.jpg in the img src tag for all instances? Doing it manually would take forever and I know NOTHING about jquery/javascript. It seems like I should be able to use `replace()` but I'm just not sure how to word it to work for all my images.


How can I let templates choose which stylesheets are enqueued?

My theme's `functions.php` hooks into `wp_enqueue_scripts` to register a couple of stylesheets that are used by various site pages. Here's a simplified version of my configuration:               add_action("wp_enqueue_scripts", function() {                // This stylesheet is used on *every* page         wp_register_style("sitewide", get_template_directory_uri() . "/assets/sitewide.css");         wp_enqueue_style("sitewide");              // These stylesheets are used by *some* pages         wp_register_style("pagetype1", get_template_directory_uri() . "/assets/pagetype1.css", array("sitewide"));         wp_register_style("pagetype2", get_template_directory_uri() . "/assets/pagetype2.css", array("sitewide"));     });      Every tutorial I've found so far enqueues every stylesheet from the callback itself, but I don't want to do this. I assume that this would cause _all_ my stylesheets to be included on every page, which is not what I want. I only want to enqueue `pagetype1.css` if the underlying template for a certain page uses it. Let's say that I want my front page to use the page type 1 stylesheet. My intuition would be to call `wp_enqueue_style("pagetype1");` in `front_page.php` right before including the header, which contains the `wp_head()` call. This doesn't do anything. The sitewide CSS on the other hand was included like I expected. What am I doing wrong? I know that there is a workaround out there, but I'd prefer that `front- page.php` retains control over which additional stylesheets are loaded. * * * **Edit** : This is what I ended up with after some discussion with _toscho_. I added this to `functions.php`:               // Enqueues a stylesheet handle or an array of stylesheet handles.     function mytheme_enqueueStyle($handles) {         if (is_array($handles)) {             add_action("wp_enqueue_scripts", function() use ($handles) {                 foreach ($handles as $handle) {                     wp_enqueue_style($handle);                 }             });         } else if (is_string($handles)) {             add_action("wp_enqueue_scripts", function() use ($handles) {                 wp_enqueue_style($handles);             });         } else {             wp_die("Unsupported parameter type.");         }     }      Then I called `mytheme_enqueueStyle("pagetype1")` from `front-page.php` to enqueue the stylesheet. This way of doing things ended up being incompatible with WP Minify, though.


wordpress.org codebase

Is the codebase that runs wordpress.org publicly available? Specifically, I'm interested in the part that parses the plugins SVN repository to determine the current and past versions of plugins. I know that I have to look at the tags for each plugin but there are complexities around which tag is marked as the _Stable tag_ in the `readme.txt`.


How to display posts via custom taxonomy terms using checkboxes?

I would like to have a form with checkboxes. Each checkbox would be a term of my taxonomy "cities". The idea is that if a user select any of the checkboxes, it should show all posts that are **NOT** in marked terms. If I had this code:               $args['tax_query'] = array(         array(             'taxonomy' => 'cities',             'terms' => array('Boston', 'Chicago'),             'field' => 'slug',             'operator' => 'NOT IN',         ),     );     query_posts($args);      How can I pass to the terms array the checkboxes value? I mean, to change:               'terms' => array('Boston', 'Chicago'),      to:               'terms' => array(VALUE CHECKBOX 1, VALUE CHECKBOX 2),      Thanks.


Display post date as 04/26/2013

I want to modify the date display of the post entries from current format: April 26, 2013 to this: 04/26/2013 Where in the code can I make this change? Thank you in advance!


WooCommerce: VAT on grouped products

I'm new to WooCommerce and I have the problem that grouped products always show the default VAT because I can't change the tax setting on the grouped products. The simple products combined by the grouped one have the reduced rate. So I probably have to change the output in my (sub-)theme to the VAT of the first connected simple product, right? How can I do that? ** Edit ** I have no problem with the shop calculating the VAT wrong. I have a problem with displaying the tax on grouped products. It shows the default rate with the grouped product even if all connected simple products have a reduced rate. And since I have to show the rate on the product page in germany I have to change that.


Is a direct or import approach safer for migration into WordPress?

We're in the process of migrating a site from an existing CMS system into WordPress. The existing CMS system has no direct integration tools with WordPress. I'm looking into the option of creating my own script/application that will migrate the content between the two systems. Would it be better to migrate directly into the database (inserting the rows myself) or to generate a WXR file (or multiple) and let the WordPress import module handle things for me?


Plugin for Android Marketplace downloads?

Is anyone aware of any way to show statistics on your WP blog to show android market place downloads? For example, I create an application and host it on the android market place, it gets downloaded/installed 10 times. Is there any plugin I can use to display these figures/links etc on the sidebar in WP?


Mixing variables into an array when inserting values

I have a function that inserts a load of values into a database. Not a problem but I have a condition that changes the mysql statement. The problem is is the way wordpress constructs the statement, below is what I've tried...               public function sqlInsertTicket($event, $customer, $ticket){              $reference = 0;              if ($customer['gender']=="F"){             $table = "f_ti";             $sql ='"ft_num"=>"'.$ticket['number'].'","booking_id"=>"'.$ticket['booking'].'"';         }         if ($customer['gender']=="M"){             $table = "m_ti";             $sql ='"ticket_num"=>"'.$ticket['number'].'","mbooking_id"=>"'.$ticket['booking'].'"';         }         $this->edb->insert(                     $table,                     array(                             $sql,                             'event_id'                  =>  $event['id'],                             'original_ev'               =>  $event['id'],                             'age'                       =>  $customer['age']                         )                 );         return $this->edb->insert_id;     }      I've removed a lot of the values but you can see what I'm trying to do. The $sql variable is what changes. I could write the whole thing out twice but, I've got lots of these to do and it would save a lot of time in the long run. Wordpress is basically treating the $sql as 0 for the column name and doing crazy things with the values. Thanks Joe


Custom Form Redirects to Post after Submit

First things first. I´m no PHP pro, but my boss wants me to do this, so if I made a major mistake, don´t facepalm too hard :) So I have this custom built form on this site: http://meilenstein-online.com/ But I can´t test the form, because when I hit submit without filling anything in, it redirects me to the first post, which I then deleted, and now the site is empty after submitting. When I fill out the form and hit submit, I get a 404. What I´ve done and tried:   * Homepage is the page you see (which should prevent the redirect)   * I didn´t use "name" in the form   * action is `<?php the_permalink(); ?>`   * used "#" in form action (results in an empty page)   * usedt "" in form action (results in an empty page) You can find the form here: http://codepad.org/VIAO9RvD Please not that I used a tutorial to build the form, since my PHP-Knowledge isn´t good enough, to build a form from scratch all by myself. Unfortunately I can´t post the link to the tutorial, but you see the code in the link above. Thanks in advance!


How can I prevent non-existing wordpress pages from getting redirected to home page

We have a site whose blog url looks like www.domain-name.com/blog. The blog archive pages have urls like www.domain-name.com/blog/page/1, www.domain- name.com/blog/page/2 etc... These are displayed properly. However, when I type a url such as www.domain-name.com/page/1 or www.domain-name.com/page/2, which are non-existent urls, I get redirected to the blog home page instead of getting a 404. I do not want the 404 suppression to happen. What can I do to get a 404 for non-existent wordpress pages? I have the same issue with a querystring url that looks like www.domain- name.com/blog/?xyz. Although no such page exists, wordpress suppresses the 404 error and displays the blog home page. How can I circumvent this default behaviour of Wordpress and make it display the 404 page for such urls? Thanks!


Custom WP_Query with no posts to output

I have created a custom WP_Query as seen below. The query works well except for when $favorites is empty. When $favorites is empty, the query still outputs posts, which I don´t want. It could seem like it defaults back to the standard WP_Query to output all published posts. Anyone knows what´s going on?               $favorites = wpfp_get_users_favorites($user = '');     $favorites_query = new WP_Query(array('post__in' => $favorites));          while ($favorites_query->have_posts() ) : $favorites_query->the_post();      Thanks!


An action that runs after each post in the loop on index/archive page?

Is there an Action/a Filter that runs just after each post/post excerpt is displayed on these 2 pages? I use `the_content` and `get_the_excerpt` currently, but `the_content` causes a conflict with some other plugin (hence executing my function twice so the content is displayed twice) and setting the priority isn't working! Note: I've tried `the_post`, but it runs before each post in the loop on these 2 pages. **Update:** My plugin adds a custom markup with icons after the post content using: `the_content`\- for single post/page and as some themes use `the_content('Read More')` on index/archive pages `get_the_excerpt` \- for index/archive pages The plugin Advanced Excerpt adds some options for post excerpts, and allows the user to set the excerpt length from the settings. When the post length is less than the set excerpt length (via AEs settings), my markup is doubled! When I comment out `the_content` from my code, the conflict goes off, but without `the_content` how would I make my plugin work on single page/posts and also with some themes which use `the_content('Read More')` on index/archive pages? I guess it happens because AE calls `the_content` instead of `the_excerpt` when the post length is less than the set excerpt length, hence resulting in a double call. I tried setting the priority of my filter function high, so that it runs after AE's filter function, but no luck! Hence trying a workaround! I hope this clears the question!


Exclude the parent custom post-type posts only

Not sure if this is possible without some form of hard-coding but I have a custom post-type called 'city'. Within the 'city' post-type I have some parent post (e.g. England, America and China) and some child posts (London, Washington DC and Beijing). I have a query that displays all of the posts under 'city'. But for this particular query I'd like to actually ignore ANY parent posts (ie. England, America and China) and only display child posts (London, Washington and Beijing). Here is the way I am coding my query:               <?php $city = new WP_Query(array('post_type' => 'city', 'orderby' => 'name', 'order' => 'ASC', 'posts_per_page' => -1 )); ?>                                 <?php while ($city->have_posts() ) : $city->the_post(); ?>                                     <?php the_title(); ?>                                 <?php endwhile; ?>      So is this possible? I would have thought that doing the opposite is more of a popular question (displaying only the parents and excluding the children) but I'm hoping that my problem is possible! Thanks


Google not index my Custom 404 page ?why?

I have a movie site. When i create First Look of that movie there also created further links related to that movie in the end of the Post using meta tags. For Example Movie HD Videos Movie Mp3 Songs Movie Trailer And, in future whenever i create same links with which created in the end of every Post but google is not indexing that pages even Header response is 200 but google dont indexing my temporary created links. How To Solve this issue? Even Page Title Description keyword everything is given in that page but still Google don't index that page relating to that movie but still google not indexing those pages mostly... but i think normally Google index every link on that page what problem can be possible ?


How to display custom twitter posts with the twitter plugin?

Using the twitter plugin, so you can have your twitter posts loaded into the sidebar of your wordpress blog, is there any way of filtering the posts? For example, I will post technical stuff I'm interested in on twitter, I want that to show up on my blog, but I may also post non-related items, how can I filter these out so they dont show on the blog? Simple answer would be to have two separate twitter accounts, but then I'd lose followers etc


Links to an exisiting Page are now redirecting to a draft page?

I have a page that has been working fine for a while now. However I'm looking to replace it in the not to distant future. (testing conversions) I though the correct process for this would be to create a draft of the new page ready to swap. Then once I'm ready to change. Unpublish the exisiting page. Rename the URL/slug to something like/page1old then publish the new page with the old pages slug/url. However somehow in attempting to set this up, something weird has happened and I'm getting a autoredirection occurring. All links pointing to the old page are now redirecting to the draft page on my live site? I'm hovering over the links and the URL is right www.mysite.com/page1 however when I click on the link it redirects to www.mysite.com/page2 Why has it autoredirected? How is it possible to redirect to a draft page that has not be published? Very bizarre?


Taxonomy Drill-Down / Plugin Help - hierarchical queries within plugin?

I hope this question doesn't make me look too stupid! I am using a plugin called 'Query Multiple Taxonomies' -- it's a fantastic plugin and is written extraordinarily well. http://wordpress.org/plugins/query-multiple-taxonomies/ It does _just_ about everything that I need it to do save one small thing. I've been trying to figure out how to accomplish this last bit for a while now, and I decided that it was time to ask for some help. You can view the section I'm working on here: http://tunagaming.dyndns.org/?section=tutorials The drill-down works very well. This is how it is currently set up:   * First page shows platforms.   * Second page shows genres   * Third page shows sub-genres. This is how I want it to work, except that each of those are custom taxonomies, and I would like to eliminate 'sub-genres' completely in favor of a hierarchical 'genres' taxonomy. So ultimately, I would like for the drill-down to work like this:   * First page shows platforms.   * Second page shows ONLY parent terms in the taxonomy 'genres'   * Third page shows children of selected parent. All of this is being called in an archive.php file. Here is the code for reference:               <?php if (is_multitax( array('section', 'platforms', 'genre') ) ){          the_widget('Taxonomy_Drill_Down_Widget', array(         'title' => '',         'mode' => 'lists',         'taxonomies' => array('subgenre')     ));?>

Query Results
         <?php if ( have_posts() ) while ( have_posts() ) : the_post(); ?>
<a title="<?php the_title();?>" href="<?php the_permalink();?>">
             <?php echo get_the_post_thumbnail($page->ID, 'thumbnail'); ?>
<?php the_title();?>
             <?php the_excerpt(); ?>

         <?php endwhile; ?>
          <?php      }     elseif (is_multitax( array('section', 'platforms') ) ) {          the_widget('Taxonomy_Drill_Down_Widget', array(         'title' => '',         'mode' => 'lists',         'taxonomies' => array('genre')     ));     ?>

Query Results
         <?php if ( have_posts() ) while ( have_posts() ) : the_post(); ?>
<a title="<?php the_title();?>" href="<?php the_permalink();?>">
             <?php echo get_the_post_thumbnail($page->ID, 'thumbnail'); ?>
<?php the_title();?>
             <?php the_excerpt(); ?>

         <?php endwhile; ?>
     <?php     }      else {     the_widget('Taxonomy_Drill_Down_Widget', array(         'title' => '',         'mode' => 'lists',         'taxonomies' => array('platforms') // list of taxonomy names     ));     ?>

Latest Entries
         <?php if ( have_posts() ) while ( have_posts() ) : the_post(); ?>
<a title="<?php the_title();?>" href="<?php the_permalink();?>">
             <?php echo get_the_post_thumbnail($page->ID, 'thumbnail'); ?>
<?php the_title();?>
             <?php the_excerpt(); ?>

         <?php endwhile; ?>
     <?php } ?>      I would love some help in figuring this out, or even some fresh ideas on how to achieve this drill-down. I'm not asking for anyone to code it for me, but it is just a bit over my head. I'm okay with PHP -- not great. So a nudge in the right direction would also be very helpful! Thanks in advance. EDIT: For what it's worth, I believe the answer lies in the plugin's walker.php file. I could be wrong, but here's the code I've been studying this morning:               function display_element( $element, &$children_elements, $max_depth, $depth=0, $args, &$output ) {                  if ( !$element )                 return;                  $id_field = $this->db_fields['id'];                  $id = $element->$id_field;                  $child_output = '';                  // descend only when the depth is right and there are childrens for this element             if ( ($max_depth == 0 || $max_depth > $depth+1 ) && isset( $children_elements[$id]) ) {                      foreach ( $children_elements[ $id ] as $child ) {                     $this->display_element( $child, $children_elements, $max_depth, $depth + 1, $args, $child_output );                 }                      unset( $children_elements[ $id ] );             }                  $this->single_el( $output, $element, $depth, $child_output );         }              function single_el( &$output, $term, $depth, $child_output ) {             $data = $this->specific_data( $term, $depth );                  $data = array_merge( $data, array(                 'term-name' => $term->name,                 'is-selected' => in_array( $term->slug, $this->selected_terms ) ? array(true) : false,                 'depth' => $depth,             ) );                  if ( !empty( $child_output ) ) {                 $data['children']['child-list'] = $child_output;             }                  $full_data = new QMT_Data_Container( $this->taxonomy, $term, $data );                  $output .= Taxonomy_Drill_Down_Widget::mustache_render( $this->walker_type . '-item.html', $full_data );         }              abstract function specific_data( $term, $depth );     }


How to Mirror WordPress database from Remote server to Local server

Before I embark on this tutorial from the WordPress Codex on mirroring a WordPress database from a remote server to a local one. I'd like to get some feedback from SE users who have successfully achieved this, or who have followed the same tutorial. Here are my questions:   1. What methods have you guys used to mirror/sync your databases?   2. What kind of MySQL software do you use (or think is the most reliable), in terms of importing/exporting MySQL dumps   3. Is there a risk of data loss during the transfer?


Added input box and button with jQuery to the Add New Post page. Clicking/pressing them always reload the page

I am adding a simple pair of input box + button dynamically to the Add New Post page, using jQuery. This is the code in my js file:               (function($) {         $(document).ready(function() {                  var fdppInput = document.createElement('input');             fdppInput.type = "text";             fdppInput.id = "fdpp-input";                  var fdppButton = document.createElement('button');             fdppButton.innerHTML = 'Grab Data!';             fdppButton.id = "fdpp-button"                  document.getElementById('titlediv').appendChild(fdppInput);                 document.getElementById('titlediv').appendChild(fdppButton);                  });              $('#fdpp-button').click(function(){             alert($('#fdppInput').val());                      return false;         });     })(jQuery);      The problem is, whenever I:   1. write something to the input box then press enter, or   2. write something to the input box, then click the button The entire page will refresh (and apparently saved the post), instead of alerting the value of the input box as I intended. How do I make it so that the page don't reload when I do 1 and 2 above? **Update:** What I'm trying to do is that upon clicking the dynamically created button, I want to put the value in the dynamically created input box into Add New Post page's post title input box. All without WordPress automatically saving the post first. There should be no page refresh. How do I do this?


Include a file before current template file

I would like to include two files before and after current template. I am using template_redirect to do this, But when I call `get_current_template()` inside `template_redirect` it returns nothing. is there a way to solve this ?? **here is my code:**               // current template file     add_filter( 'template_include', 'var_template_include', 1000 );     function var_template_include( $t ){         $GLOBALS['current_theme_template'] = basename($t);         return $t;     }          function get_current_template() {         if( !isset( $GLOBALS['current_theme_template'] ) )             return false;         if( $echo )             echo $GLOBALS['current_theme_template'];         else             return $GLOBALS['current_theme_template'];     }          // use template redirect to include file     add_action('template_redirect', 'ra_template_block');     function ra_template_block() {             include_once THEME_DIR.'/blockstop.php';         get_template_part(get_current_template());               include_once THEME_DIR.'/blocks.php';         exit;     }      **Way I am doing this** I want to set page layout from a file. I need to include below tags every time in my template file:   * `get_header()`   * `get_footer()`   * `get_sidebar()`   * `get_template_part('right')`   * `get_template_part('left')` So if I can set them from a specific file, then I dont need to include them in every template file.


Multisite Media Library Item Share

I have a wordpress multisite setup. I have a certain user group, artists, which are represented on every blog of the site network. This is done by using custom post types. So every user profile is updating a custom post, artist portfolio, on every blog. On their user profile artist can also upload mp3s, to introduce themselves. These should be available on every artist portfolio on every blog. But I'm having a hard time sharing the mp3 between blogs. My idea was to add the mp3s to the media library of the main page. Then create custom attachments to the artist portfolio post on every blog linking back to the guid of the original file. But wordpress will only access files within the individual sites upload directory and won't play the mp3 of the main site. Does anybody have an idea, how to solve this?   * I thought about copying the file into the individual upload directory for every blog. But this will create redundant copies, which aren't really needed.   * Or maybe there is a clever way to conditionally filter the upload_dir when wordpress is accessing these mp3s?   * Or is there a way to allow wordpress to access the upload dir from another blogs? Thank you so much in advance! edit: I don't want to sync the media libraries in general, or just use one. The blogs are very different and the mp3s are the only common posts.


Category not being selected

I'm trying to build multiple loops for different parts of my page but I can't isolate a category. I just get to see every post the category is ignored. Below my code, any suggestions would be greatly appreciated as I'm somewhat at a loss what I'm doing wrong. Thanks!
         <?php         $first_query = new WP_Query('cat=Postblok');         while($first_query->have_posts()) : $first_query->the_post(); ?>

<?php the_title(); ?>

             <?php the_content(); ?>

<img src="<?php bloginfo("template_url"); ?>/images/mockup.jpg">

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


Explanation of WP_Query

Why am I able to use WP_Query methods without using an object of this class? Sometimes I see examples that are using the object:               // The Query     $the_query = new WP_Query( $args );          // The Loop         while ( $the_query->have_posts() ) {         $the_query->the_post();         echo '<li>' . get_the_title() . '</li>';     }      But sometimes I don't use it. I just use the_post(), etc without using a WP_Query object.


Is there a template tag I can use to link to the archive page corresponding to the month that a post was published on?

For example, if the post was published on may 5th 2011, then clicking on "May 5th, 2011" would show all posts published in May 2011. How can that be done?


Correct phph syntax to add an image in wp functions.php

as i am a newb here, please help me to get this solved. i am trying to add a function in wordprress functions.php where i am trying to display an image relevant to my theme folder here is my code which is not working, it only shows the file name but without the correct path.               add_filter (somefilter_code_here);     function mycustom_func($mycustom_field ) {     $capimg =  bloginfo('template_url').'/imagename.jpg';      echo $capimg; // for  testing and it does work     $mycustom_field .= '
';     //$comment_field .= '';     $mycustom_field .= '';       $mycustom_field .= "
";     return $comment_field;     }       i need an exact php line which can retrieve image from path and display it right now image is not displayed, it show only file name and the value of $capimage is shown separately


Display WordPress Search

I am trying to display the current WordPress search term on single.php, index.php, and category.php...basically when someone searches for something I'd like WordPress to remember what the last search term was and display it anywhere on my site, is that possible? The function `get_search_query` only works on search.php Thanks,   Josh


Filter unique custom field value based on custom taxonomy category or other custom field

Is there an easy way to obtain a list of uniqye custom fields value from a specified taxonomy value? For example, I have many categories under taxonomy "products". Every product has some custom fields, for example: "color", that I use to build a tag with a list of available product colors. When i select a product category (f. ex. "Cars"), I wish to filter out the colors that are NOT included in the selected category. In other words, if NO car is brown, "Brown" (though it is a value that is present in other product categories) should not be listed. The same thing should happen when I select another custom field value (f. ex., "year" on "2010". If no product of year 2010 is "red", "red" should be filtered out). Any suggestions?


It is possible to get a list of post types asociated to a taxonomy?

I use More Plugin (More Types, More Fields and More Taxonomy) to create custom taxonomies, post types and fields. I've created a select control filled with taxonomies (looping through $wp_taxonomies). What I need is to show a list of post types associated with currently selected taxonomies (I will do this by using jQuery) and I didn't figure out how to get such a list of post types. Thanks!


Output list from each line of metabox (shortcode)

Hey I have a textarea in my metabox and I display the info using a shortcode. I want to output the data from that metabox as a list (each line is a list item). I used the code from here but changed it a little, because it gave me a parse/syntax error. I need the arrays to be inside a specific div and p class, and without the explode and the code they display well (writing the html tags inside the metabox - which I don't want to do, I want just the lines of text to result the list) My code for the shortcode is:               add_shortcode('cv', 'vp_cv');     function vp_cv($atts, $content=null) {     extract(shortcode_atts(array(         'number' => 6     ), $atts));         $content = filter_shortcode($content);     global $post;     $output .= '
';     $query = new WP_Query('post_type=resume&posts_per_page=' . $number . '&cat=' . $categories);     while($query->have_posts() ) : $query->the_post();         $title = get_the_title();         $projects = get_post_meta($post->ID, 'resume_projects', true);      if($projects){         $projects = explode("\n", $projects);}              ?>
              <?php for($i = 0;              $i<sizeof($project);              $i++){ ?>
 <?php echo $project[$i]; ?>
                 <?php } ?>
      The output is:               <?php          $output .= '
';          $output .= '
' . $title . '
';         $output .= '
'  . $projects . '

';            endwhile;         $output .= '

';     return $output;     }      The title displays ok but the $projects gives me literally "Array". Any thoughts?


Wordpress MU 2.9.2 to 3.0.5 changes to category.php

In the latest version of WP I see the category.php page is now using edit- tags.php. The version Im running seems to have an issue with the search feature on this page whereas the new version doesnt. When searching for categories, the results show the category search AND its heirarchy i.e. - categoryname together in the same list. Short of doing a major overhaul and upgrade as one does need to check compatibility, what was changed in the new version that I could update in the old version of my source? example: I have 5 categorys, 3 parents, 2 children. They all have the word cat in their name. If I search for the word 'cat' I not only get the 5 results, but ALSO another three results with - category name for each of the children again. This is not the case in 3.0.5


Sorting meta_value as integer doesn't work

This plugin uses the below chunk of code to print the top 10 highscores. But this doesn't get the list of top 10 scores sorted by `meta_value` in my WP install               $scoreboard = new WP_User_Query( array(         'number'       => $top,         'exclude'      => array( $exclude ),         'orderby'      => 'meta_value',         'order'        => 'DESC',         'meta_key'     => 'wp2048_score',         'meta_value'   => '0',         'meta_compare' => '>',     ) );      what could be wrong? I tried using meta_value_num too for orderby but still won't work. Am on wordpress 3.9.1


Any Good Wordpress Client Like Live Writer To Create Static Pages

I want to publish static pages on Wordpress quickly. Live Writer is a very good client for formatting and publishing blog posts. But I couldn't find a way to use it for publishing static pages. Is there any way to publish static pages on Wordpress quickly with an easy to use client?


Error: Can´t access facebook comment plugin admin page

The plugin i'm talking about is facebook-comments-plugin The problem is i can´t access admin page: /wp-admin/options- general.php?page=fbcomments **This error is happening:** PHP Warning: DOMDocument::load() [domdocument.load]: URL file-access is disabled in the server configuration in E:\home\intothebac\Web\wp- content\plugins\facebook-comments-plugin\class-admin.php on line 194 PHP Warning: DOMDocument::load(http://www.facebook.com/translations/FacebookLocales.xml) [domdocument.load]: failed to open stream: no suitable wrapper could be found in E:\home\intothebac\Web\wp-content\plugins\facebook-comments-plugin\class- admin.php on line 194 PHP Warning: DOMDocument::load() [domdocument.load]: I/O warning : failed to load external entity "http://www.facebook.com/translations/FacebookLocales.xml" in E:\home\intothebac\Web\wp-content\plugins\facebook-comments-plugin\class- admin.php on line 194


Catergory args causing loop not to show

this has taken up most of my afternoon, but i just cannot get it to work properly. The issue is when i try to add a catergory argument to my custom loop, whether it is an include or exclude. When i add the argument it simply breaks the loop, i will have a working loop displaying fine, then i add a catergory arg, save, and f5 and voila i have a loop that doesnt display anything. I have used both query_posts and WP_Query and am still having the issue, and it's not a simple case of me providing an invalid cat id number. Hopefully somebody can point out where i went wrong. Below is my loop, if you need the entire template page let me know.               <?php           $tshirt_query = new WP_Query ('post_type=tshirt&posts_per_page=30');     while($tshirt_query->have_posts()) : $tshirt_query->the_post(); ?>
         <a href="<?php the_permalink() ?>" alt="<?php the_title(); ?>"><?php   the_post_thumbnail( array(234,234,true) ); ?>

             <?php             $thetitle = $post->post_title;              $getlength = strlen($thetitle);             $thelength = 23;             echo substr($thetitle, 0, $thelength);             if ($getlength > $thelength) echo "...";             ?>

      Just as additional info - I am using a custom post type (tshirt) and all off my custom posts are tagged in each of my four custom taxonomies (vendor, size, genre, color). So essentialy every post will have atleast one tag from each of the taxonomies. I hope someone can help, and in the mean time a big thanks! Mike


Change the date and time in wordpress

Is there a way to change the date and time in WordPress, not the timezone, but the date and time all together, like make it 03-21-85 11:11 PM. I want all dates and times to be changed, not just to one post or page, but to the whole WordPress site it's self.


How can I see the error generated by plugin activation?

I'm developing a plugin and upon activation, I get the following error: > The plugin generated xxx characters of unexpected output during activation How can I see what `unexpected output` is generated? I have turned on debugging, but it doesn't help:               define('WP_DEBUG', true);     if (WP_DEBUG) {       define('WP_DEBUG_LOG', true);       define('WP_DEBUG_DISPLAY', true);       @ini_set('display_errors', 1);     }      **Update**   FYI - I have checked that there are no spaces before and after `<?php ?>`. I've done some digging around and tested various solutions, but I'm still stuck.


I would like to change the sticky posts label "Featured" to something else

On the posts that we label "sticky" the word "featured" appears. How can I change that to "new"? David


All images on one line for each post

Having trouble getting around the issue where my client wants all of the images for each post to be on one line. This can be done in the editor, but they are not very tech savvy -- just wants to be able to type a blurb, and then add a series of photos, and have them all sit on a single line. Is there a wordpress php file or a hook/override I can use to make it so all the tags containing images float left and add a clear:both at the end of this? I noticed that there's selectable format's for the post -- would it be here that I would do this? Also -- I saw a doc showing how the format works and it looks like it just changes the structure of the title & content. How can I edit the structure of the actual post content since that's where the images exist?


How to remove addthis from my default template

One of biggest mistakes which I committed is that once I installed AddThis plugin and now it appears at the bottom of each page. I removed all the traces of plugin, changed the theme but all in vain. It appears at the bottom above footer in all the pages where I use default template. Please help. ![enter image description here](http://i.stack.imgur.com/E6lJ4.png)


Set post title from two meta fields

In a custom post type I have post titles disabled, however in the list of posts and in the slug it just shows the title as "auto-draft". I want to automatically take two pieces of post-meta and make then the title and the slug. I thought this would work, but I can't make it happen:               function set_event_title( $data , $postarr ) {       if($data['post_type'] == 'events') {         $event_date = get_post_meta($post_id,'event_datetime',true);         $event_venue = get_post_meta($post_id, 'venue_name' , true);         $event_title = $event_venue . ' - ' . $event_date;         $post_slug = sanitize_title_with_dashes ($event_title,'','save');         $post_slugsan = sanitize_title($post_slug);              $data['post_title'] = $post_title;         $data['post_name'] = $post_slugsan;       }       return $data;     }          add_filter( 'wp_insert_post_data' , 'set_event_title' , '99', 2 );      Anyone know how I might get it to do its thing correctly?


The loop: more posts than I want to fit on one page

I am working on using the wordpress loop to call posts from my wordpress blog into my website. I have my loop set up to grab the 10 most recent posts under the portfolio category and display them on my portfolio page. The problem is that I have 20 items I want to display, but I don't want to have to deal with the load times of 20 images. I've thought about making multiple portfolio pages in dreamweaver, and have each one grab a different set of ten posts, but that's defeating the purpose of using wordpress to make it faster for me to update the page. Is there any way I can have it set up so that when I hit 'next' the page refreshes with the next set of ten posts, and when I hit 'back' the page refreshes with the first ten posts? I have seen webpages that are like www.example.com/portfolio.php?paged=2 Here is my header that calls the loop               define('WP_USE_THEMES', false);     require('./wp/wp-load.php');     query_posts('category_name=portfolio&posts_per_page=10');      and here is where the loop gets placed on the page               <?php while (have_posts()): the_post(); ?>     <?php the_content(); ?>     <?php endwhile; ?>      Any suggestions will be greatly appreciated.


Add 2 Taxonomies to Custom Post

I have created a custom post type "beers" and added a custom taxonomy "distributor" as a category (see below)               register_taxonomy("distributor", array("beers"), array(                         "hierarchical" => true,                          "label" => "Distributors",                          "singular_label" => "Distributors",                          "rewrite" => array(                           'slug' => 'filter',                           'hierarchical' => true                       )                   )        How can I add an additional taxonomy to this? Maybe in form of a tag so a post can be filtered filtered even further.


How to create additional full text RSS feeds

At the risk of sounding completely ridiculous, i'm posting this question here as the nature of my query doesn't seem to help me much from google. My wordpress default rss feeds makes use of post excerpt this feed is accessed via www.mydomain.com/feed I have a requirement to make another RSS feed that is full text. How can create an additional RSS feed (that is private/given to only trusted parties).. preferably using a function but a plugin (as a last resort)?


How can I hide the dashboard widgets using install.php

I have created my own install.php file in the wp-content folder and I am using it as a drop in to customise my install of Wordpress. Currently I am using the following to hide (NOT) remove the welcome panel when Wordpress installs               update_user_meta( $user_id, 'show_welcome_panel', '0' );      Now I can remove the other dashboard widgets such as Activity, At A Glance etc. by editing the functions.php but using the same snippet I cannot hide the widgets from the dashboard. The remove snippet also does not remove the dashboard widgets when used within the install.php


HTTPS Warning and Certificate Error when Updating Network

Is there a workaround for this error? > Warning! Problem updating https://[host]/[blabla]. Your server may not be > able to connect to sites running on it.   >  Error message: Peer certificate cannot be authenticated with known CA > certificates Is there a way to disable it just for the upgrade? I don't see a point for peer authentication just for the updates, unless I'm getting this wrong.


Disabling wp_tag_cloud() outputting inline CSS

Is there a way to disable Wordpress wp_tag_cloud() from outputting inline CSS?


problem with the loop

Hello I am working with my own template, and also using the post-to-post plugin, I am doing the following,
                     <?php                     global $post;                     global $related;                     ?>                     <?php query_posts('post_type=client'); ?>                     <?php $the_query = new WP_Query( array('post_type' => 'casestudy', 'connected' => $post->ID)); ?>                     <?php $content = $post->post_content; $link = $post->guid; $id = $post->ID; ?>                     <?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>                         <?php $client = get_post_custom($post->ID); ?>
                             <img src="<?php echo $client['upload_image2'][0]; ?>" alt="<?php the_title(); ?>"/>                         <?php while ($the_query->have_posts()) : $the_query->the_post(); ?>                             <?php die("!"); ?>                             <?php $related = get_post_custom($post->ID); ?>                                 <?php if(is_array($related)) : ?>                                     <a href="<?php the_permalink(); ?>" class="case_study"><?php echo $content; ?>                                 <?php endif; ?>                              <?php endwhile; ?>
                     <?php endwhile; endif; ?>                     <?php wp_reset_postdata(); ?>
      However, I do not get into the second while, even though if I print_r $query_post it returns data. However If I then repeat the code again, it all works as I would expect, i.e the code goes into the second while loop, can anyone tell me why this would be happening?


Custom Role does not have access to dashboard

I was just adding a custom role by using the add_role() function. Here is the code below:               add_role('user', 'User', array('read'));      I figured this would give the same level of access as the subscribers role. Technically I want them to be the same but I don't want to use the subscribers as a role for certain users because there will be different access between the two. However, although, from what I read on the wordpress codex site, the subscribers has only one capability and that is to 'read' it has access to the dashboard and can edit their own profile. My custom role cannot. I get the following message when going to the admin panel. _You do not have sufficient permissions to access this page._ Why is that? Hoe do get the right permissions to do this? Thanks, Joe


Remove adjacent_posts_rel_link under 3.2?

I'm trying to remove the adjacent_posts_rel_link links under WP3.2, i.e. remove these from wp_head:               <link rel='prev' title='blah blah' href='http://...' />     <link rel='next' title='blah blah' href='http://...' />      and this function used to work under 3.1:               function remove_header_info() {     remove_action('wp_head', 'adjacent_posts_rel_link', 10, 0);     }          add_action('init', 'remove_header_info');      But doesn't under 3.2. Anyone know or know how to find the new action to remove the links? **Edit 7/15/11:** the change is `adjacent_posts_rel_link_wp_head`


Subpage template

I've had a look around already but couldn't find an answer to this. Is there a way to create a template that applies to all pages that have a parent? something like sub-page.php without having to manually select it from the page attributes?


Hard-coded Audio Player

Continuing work today on my free theme and I'm trying to make it kick some butt. I would like to embed an audio player into the theme. Not a plugin, an embedded player. The functionality of http://wpaudioplayer.com/standalone/ kicks some serious boo-tay. However, that player is a bit ugly. I do like the Woo Tumblog audio player (anybody know if I can implement this... people may make commercial themes off this theme so it needs to be legal?). If there's a great looking player option out there that's distributable in commercial themes, simple, and well-designed let me know. I assume I can just replace the .swf file in WP Audio Player... right? May the force be with you.


Automatically wrap post image in div

_In regards to image attachments inserted into a post_ , I would like to wrap the **img** tag inside a **div** tag for specific design purpose. Is there a way to do this **automatically** after attaching the image file, like through _hooks/filters_ maybe? Thanks in advanced!!


WordPress Custom Query to get Most Commented Posts in the Past 7 Days

I'm trying to do a query on wpdb to get the posts commented on most in the past week... Any ideas what I'm doing wrong?               $querystr = "SELECT comment_count, ID, post_title             FROM $wpdb->posts wposts, $wpdb->comments wcomments             WHERE wposts.ID = wcomments.comment_post_ID             AND wcomments.comment_date >= CURDATE() - 7              GROUP BY wposts.ID             ORDER BY comment_count DESC             LIMIT 0 ,  10      ";           $pageposts = $wpdb->get_results($querystr);      Thanks in advance. **EDIT** Query changed to something that _sort of_ works I'm still not getting the date range right... it is returning the posts that are most commented on of all time, and not only the posts that have been commented on in the past week.


Add title, post content, and category like add_post_meta and update_post_meta

How can I update/add a new title, post content, and category to a post with hard PHP code similar to add_post_meta(), update_post_meta()?


Custom Post Types: Custom columns with Title submenu?

When viewing non-custom Posts, you get the likes of this submenu: ![submenu](http://i.stack.imgur.com/MDUzC.png) I'm not using a title - I'm using custom columns with two fields concatenated: ![my species profiles](http://i.stack.imgur.com/4N86p.png) Is there any quick and easy way of adding the submenu to my custom post columns? Possibly by actually using the 'title' field on my custom post creation page - without having the title input box, as it's unnecessary for my users to see/edit.


Make wp_dropdown_categories into a variable that persists until changed?

User selects category1 from wp_dropdown_categories, if user clicks on tag2 any point after, they only see posts from category1 with tag2, not all posts with tag2. Is there a way to store the chosen category as a variable and use that to filter all content, until that variable is changed or removed?


Moving a wordpress.org website to another domain name?

I currently have a wordpress.org website on a server with a specific domain name. I would like to move it all to a server with another domain name as I have changed my company name. What is the best way of doing this without losing the links (Both internal links and external links going towards the site)? Many thanks in advance


Theoretical Multi-Server WordPress Setup with Shared Users

The organization I work for would benefit if we could take the existing WordPress installations that are located on several (~5) different servers and be able to use a universal database with the users table only. The individual servers would use a database for the remaining content. The idea is this. Have a "main" server with all of the user's data (some 300+ users) which whom a network admin can give/edit permissions to these users on each of the other servers. This way, when a user logs in to one WordPress installation on one server, the user could visit another WordPress server and still be logged in with various permissions on the various servers. This would be a 1:1 relationship for WordPress Network to Server. How would cookies or sessions need to be utilized in order to allow this? Would an outside API login system need to be used in order to accomplish this? Or could this be done within the WordPress core files?


How to add admin bar and admin menu or submenu notification bubbles?

What would you recommend to use as far as manipulating the admin bar goes? I was thinking to just add a new admin bar node, and with CSS set a background image for the icon. Then in the node, just output the count. ![enter image description here](http://i.stack.imgur.com/ciR79.png) I have no idea how to add bubble notifications on the admin menus or admin submenus though. Any advice?


get_the_author_meta not working when sending emails

I can't seem to get "get_the_author_meta" working when sending welcome emails to users. I want to customize the content based on custom user meta. I can pull it in just fine on the front end, but I can't seem to get this code to work when sending emails. Note the $client_report_id and $am_company_logo is what isn't working. The below code is in a custom plugin file. If I use that code in a theme file I can pull get_the_author_meta() just fine. What am I doing wrong with this code?               <?php          if ( !function_exists('wp_new_user_notification') ) {             function wp_new_user_notification( $user_id, $plaintext_pass = '' ) {                 $user = new WP_User($user_id);                      $user_login = stripslashes($user->user_login);                 $user_email = stripslashes($user->user_email);                 $user_first = stripslashes($user->user_firstname);                 $user_last = stripslashes($user->user_lastname);                 $user_full = $user_first . ' ' . $user_last;                      $user_role = $user->roles[0];                 $client_report_id = get_the_author_meta( 'am_client_report_id', $user_id );                 $am_company_logo = get_the_author_meta( 'am_company_logo', $client_report_id );                       if($user_first == '') {                     $user_name = $user_login;                 } else {                     $user_name = $user_full;                 }                      $email_subject = "Welcome to SITE NAME ".$user_name."!";                      ob_start();                          if($user_role == 'client') {                         include( ABSPATH . 'wp-content/plugins/email_system/welcome/client.php' );                     } else {                         include( ABSPATH . 'wp-content/plugins/email_system/welcome/user.php' );                     }                      $message = ob_get_contents();                 ob_end_clean();                      wp_mail($user_email, $email_subject, $message);             }         }     ?>


Access wordpress pages using a self signed shared ssl

I am trying to access a wordpress page to use in a Facebook tab. I have a self signed ssl installed and I only get a server 404 error page. I am using the wordpress https plugin, but I am not having any luck. I set the individual page here to force https https://mypastaspot.com/facebook/ I've tried getting to the page via ip `https://192.254.194.11/~mypastas/facebook/` If i browse to `https://192.254.194.11/~mypastas` the site sort of loads, but is missing styles and throws a wordpress 404. Any ideas on how to do this?


WordPress Query wp-terms SLOW

I've got a very large database in WordPress with lots of products in WooCommerce along with quite a bit of taxonomies. When querying the products on the front end it takes 1 minute or more. Here is the query from mysql slow query log:               # Query_time: 66.741373  Lock_time: 0.000068 Rows_sent: 0  Rows_examined: 0     use wordpress;     SET timestamp=1352321640;     SELECT t.term_id,        tt.parent,        tt.count,        tm.*     FROM wp_terms AS t     INNER JOIN wp_term_taxonomy AS tt ON t.term_id = tt.term_id     LEFT JOIN wp_woocommerce_termmeta AS tm ON (t.term_id = tm.woocommerce_term_id                                             AND tm.meta_key = 'order_pa_colorist')     WHERE tt.taxonomy IN ('pa_colorist')     ORDER BY CAST(tm.meta_value AS SIGNED) ASC, t.name ASC;      When I use the 'top' command while I'm loading one of the pages below it says mysql is using 99.9% of the CPU The link that is having the issue is: http://ec2-54-243-161-225.compute-1.amazonaws.com/shop/dark-horse/ Any product on this page. Any solution on speeding up this query? I don't mind to modify core WordPress files.


need to add add user names to the post for later retrieval or removal

I'm working on an unique feature, that requires that I add usernames to specific post. In detail, user clicks button and if he is logged in his wp username is saved somewhere together with the post. User can click and remove himself from the list. There can be many users under single post like 200+. I believe I have two options:   * 1) Create `meta_key` value pair and use 1 per user.   * 2) Create 1 `meta_key` with array value that contains all users.   * 3) I was thinking to maybe use comments system, as for that specific `post_type` I don't have comments at all. So I could just attach myself to that system, and instead of saving all comment data I would just store the `username`. What do you think? Is there a better way?


How to let users change site language?

I translated all my theme strings and saved in .po and .mo files. I tested the implementation and it works fine, however I'm not sure how to let users choose their own language. Are there any built-in functions to do this? How do I do it?


Menu of pages with an image

I'm getting really desperate and I need your help, I really tried and research and I couldn't find anything yet. I'm new at wordpress.. and I have this question, I hope you can help me... I want to create a navigation menu just like this: ![enter image description here](http://i.stack.imgur.com/tG7z6.png) I already used the class Walker_Nav_Menu and adapted the code to show the menu how I wanted, but this is not what wordpress is about, because the user would have to put the images manually in the right directory and with the right name. This is the code I use: * * *               class My_Walker extends Walker_Nav_Menu {          function start_el(&$output, $item, $depth, $args) {         global $wp_query;         $indent = ( $depth ) ? str_repeat("\t", $depth) : '';              $class_names = $value = '';              $classes = empty($item->classes) ? array() : (array) $item->classes;              $class_names = join(' ', apply_filters('nav_menu_css_class', array_filter($classes), $item));         $class_names = ' class="' . esc_attr($class_names) . '"';              $output .= $indent . '
ID . '"' . $value . $class_names . '>';              $attributes = !empty($item->attr_title) ? ' title="' . esc_attr($item->attr_title) . '"' : '';         $attributes .=!empty($item->target) ? ' target="' . esc_attr($item->target) . '"' : '';         $attributes .=!empty($item->xfn) ? ' rel="' . esc_attr($item->xfn) . '"' : '';         $attributes .=!empty($item->url) ? ' href="' . esc_attr($item->url) . '"' : '';              $item_output = $args->before;         $item_output .= '';              $item_output .= '
 title) . '.png" />
';         $item_output .= '
' . $item->title . '
';         $item_output .= '
' . $item->description . '
';         $item_output .= '
 Ver más
';         $item_output .= '';              $item_output .= $args->after;              $output .= apply_filters('walker_nav_menu_start_el', $item_output, $item, $depth, $args);          }          }      * * * Anyone know about a plugin or code to do this? Please.


Different coloured navigation links in Twenty Eleven themes

I'm working on a website for a friend with small changes. She's running Twenty Eleven theme an she wants to make each link's bottom border (that I'll be putting in soon) a different colour. However with the CSS I'll be putting in, I only know how to make all of them a singular colour like this - https://dl.dropboxusercontent.com/u/85495001/nav.jpg Is there a plugin or some extra code I can put into the navigation code of this theme to allow for this effect?


How to disable a wp filter in a certain admin panel page

One of my filters is breaking a plugin that enables featured images for categories. Here's its code:               function html5_insert_image($html, $id, $caption, $title, $align, $url, $size, $alt) {     if (!$caption) {         $src  = wp_get_attachment_image_src( $id, $size, false );              $html5 = "
";         if ($url) { $html5 .= ''; }         $html5 .= '';         if ($url) { $html5 .= ''; }         $html5 .= "
";         return $html5;     } else {         return $html;     }        }     add_filter( 'image_send_to_editor', 'html5_insert_image', 10, 9 );      Is there an easy way to disable this filter entirely when the user is on the category management page in the admin panel?


clean wp_options table unused rows

In my Wordpress Blog site i have installed too much plugin and remove also many plugins. In database table "wp_options" size increases approx 13MB and there are many rows which are unused at this time. So I want to remove these unused rows from "wp_options" table and optimized this table as much as low size. But HOW?


Adding a "Report the post" button/form?

I have a user-generated-content website with WP. I would like to allow the readers to notify me of posts that should be taken down. I need to:   1. add a button to the end of each posts, that when clicked, will send the reader to another form, while taking with it the url from which it came   2. I need a form that will hold several dropdown options to choose from, and a "send this report" ability (coupled with some CAPTCHA) I would appreciate any idea/ plugin on how to do this. (this older question didn't solve the problem for me, at my current level of understanding)


Show posts from one category with thumbnail and description on latest

Is there a widget for WordPress to show posts from one category with a thumbnail and description for latest post? WIDGET LIKE: Top news section of WWW.GOAL.com. ![enter image description here](http://i.stack.imgur.com/HKX4V.jpg)


How to use the new wp_read_video_metadata function

I see in WordPress 3.6 that you can read metadata from video and audio files. I have read through the codex (http://codex.wordpress.org/Function_Reference/wp_read_video_metadata), and even tried to implement getting the bitrate on a video, but with no results. Does anyone know the answers to the following questions:   1. Can this function be used to read the metadata on my videos hosted on Amazon S3, basically can this function be used for external video and audio?   2. Can I call this in a page template? I ask because the error I received when I tried the default example from the codex was that the function wp_read_video_metadata was not found. Which indicates the file wp-admin/includes/media.php is not being included on a standard page template.   3. Finally, does anyone have a working example of getting audio or video metadata using these new functions? Any help would be great. Thanks!


Using arbitrary paths in page urls

I have been looking all over the place and maybe I'm just searching the wrong terminology but I need to be able to allow an end user (completely non- technical) to add an arbitrary path to the url structure of a WordPress page. Essentially I need a simple way to allow the end user to create a page titled `blah` and put it in the path `/something/here/blah`. I tried to use a plugin that allowed category association with a page but it didn't setup the permalink route with the category/subcategory structure like I expected. I have seen a number of posts about adding code to insert rewrites, etc but I need these paths to be able to be created at the whim of a non-technical user. I do not have ton of experience with WordPress but I'm a veteran PHP developer so I'm willing to write a plugin (or extend one) but I just need a bit of direction on how best to approach this problem within the WordPress architecture.


if admin is logged in

I use this function to detect if administrator is logged in wordpress               <?php     define('WP_USE_THEMES', false);     require('./wp-blog-header.php');          global $current_user;     get_currentuserinfo();     $user_info= get_userdata( $current_user->ID );     $lvl=$user_info->user_level;               if ($lvl == '8' || $lvl == '9' || $lvl == '10')          {          echo 'You are admin';          }     ?>      doesnt there exist the easier way?


Download stuff after filling fields?

is there a way to restrict a download, but if you fill your details get the file? I need to create a database with the names, mails, companies and phones for the people that want to download a detailed CV, so I want them to fill all the details and afterwards they can download. And also be able to see the data filled... Thanks!


How to keep my custom theme changes after updating genesis child theme

I am using a Genesis child theme that I would like to make some custom changes to it, but would like to be able to update it when a new version comes out without loosing my edits. I am familiar with the parent-child practice, but since my theme is already a child of genesis what is the best way to approach that? First, I tried to make a parent-child-child theme, but not only some of the markup is different, but I also lost all my widgets sections from the parent- child theme.   -created a new directory with a style.css and have this code:               /*     Theme Name: parent-child-child     Template: genesis     */     @import url("../parent-child/style.css");)         Next, I copied all files(functions.php, Template files, other...I only kept the style.css from my first try) from my parent-child theme to my parent- child-child theme and it worked, but I am worried that the code from functions.php is going to be loaded twice and therefor slow down my website or even break it down at some point. What would be the right way of dealing with this problem?   Thanks,   Radi


register_post_type sort order by title by default

If I add a custom post type (example code below), in the admin page for the new custom post type the posts are sorted by ID by default. Is there a way to set the default sort order to the post title instead (only for this new custom post type)?                   $labels = array(         'name' => 'States',         'singular_name' => 'State',         'add_new' => __( 'Add State' ),         'add_new_item' => __( 'Add New State' ),         'edit_item' => __( 'Edit State' ),         'new_item' => __( 'New State'),         'view' => __( 'View State'),         'view_item' => __( 'View State'),         'search_items' => __( 'Search States'),         'not_found' => __( 'No States found' ),         'not_found_in_trash' => __( 'No States found in trash' ),         'parent' => __( 'Parent State')     );          $args = array('public' => true,                    'show_ui' => true,                   'show_in_nav_menus' => true,                   'show_in_menu' => true,                   'labels' => $labels,                   'supports' => array( 'title','editor')                   );     register_post_type( 'states', $args );


Script Code in Text Widget Does NOT Show

I have a self hosted Wordpress 3.7 and using the Twenty Thirteen theme. I have placed a text widget on the sidebar and put a simple code from Amazon inside it:                     Amazon.com Widgets      However, when you load the site, it doesn't show up. I was under the impression that any arbitrary text or html would also include `<SCRIPT>` code as well and yet it seems to not be the case. Does anyone knows what's wrong or how to fix this? **Additional UPDATE:** It turns out that the code above shows up in Firefox and IE with a slight delay but it does render. However, it will NOT render on Chrome at all, no matter what. Any idea why it seems/appears on the surface at least to be browser specific? What would cause that difference in behavior? **DEBUGGING RESULTS:** It is found that indeed it **IS** a Wordpress BUG that is causing the code to break. Using _@toscho_ recommended plugin Magic Widgets has resolved the issue making the code display without issue. I will be in touch with the WP developers Ryan and Andrew to figure out what is causing the issue and resolve the bug in the next release to avoid future issues of the same nature.


Why do I get undefined function export_wp()?

I'm trying to create a function in `functions.php` or a plugin to generate an export via a cronjob, similar to how Chris_O did this question. However it seems that I can't call `export_wp()`, I keep getting:               Fatal error: Call to undefined function export_wp() in wherever-I-call-it-from.php on line 686      Can someone tell me how to call that function?


Separate jQuery for Individual Comments?

So far I have designed this function to display rating stars on the front end below every comment:               add_filter( 'comment_text', 'additional_fields' );         function additional_fields ($below) {       global $comment;         if(!get_comment_meta( get_comment_ID(), 'rating', true ) ) {           $ratsec = '<form action="'.get_permalink().'" method="get" class="comment-form-rating">';         $ratsec .= '

1

2

3

4

5

';             $ratsec .= '<input type="hidden" name="p" value="'.get_the_ID().'"/>';         $ratsec .= '<input type="text" value="" name="rating['.$comment->comment_ID.']" id="rate22" class="fruit-name"/>';             $ratsec .= ''. __('Rating') . '';           $ratsec .= '<input type="submit" value="submit" />';       $ratsec .= '</form>';       $below = $below .$ratsec;       return $below;     }     else     $ratsec = "";     $below = $below .$ratsec;       return $below;     }      and use this jQuery script:                     Now when I am adding a hovering action in it to make star yellow it is yellowing all the star's of all the comments plus when I am click on any star its value is updated to all the fields below comment. What I want here is make it work individually for every comment? like if I press 2 star for comment id 33 it should only change the color and the value of comment id 33 field. not all the comments.


How to write txt file?

I have 2 functions about the wp_remote_get. I wanna write all data ( functions output ) into the txt file ? How to ? **the functions;**               // facebook     function hayransayisi(){              $fb_id = '206938902665808';              $count = get_transient('fan_count');         if ($count !== false) return $count;              $count = 0;              $data = wp_remote_get('http://api.facebook.com/restserver.php?method=facebook.fql.query&query=SELECT%20fan_count%20FROM%20page%20WHERE%20page_id='.$fb_id.'');        if (is_wp_error($data)) {              return 'yok öylesi!!!';        }else{              $count = strip_tags($data[body]);        }     set_transient('fan_count', $count, 60*60*24); // 24 hour cache     return $count;     }       The twitter function ;               // Twitter     function rarst_twitter_user( $username, $field, $display = false ) {     $interval = 3600;     $cache = get_option('rarst_twitter_user');     $url = 'http://api.twitter.com/1/users/show.json?screen_name='.urlencode($username);          if ( false == $cache )     $cache = array();          if ( !isset( $cache[$username][$field] ) ) {     $cache[$username][$field] = NULL;     $cache[$username]['lastcheck'] = 0;     }          if( $cache[$username]['lastcheck'] < (time()-$interval) ) {          static $memorycache;          if ( isset($memorycache[$username]) ) {     $data = $memorycache[$username];     }     else {     $result = wp_remote_retrieve_body(wp_remote_request($url));     $data = json_decode( $result );     if ( is_object($data) )     $memorycache[$username] = $data;     }          if ( is_object($data) ) {     foreach ($cache[$username] as $key => $value)     if( isset($data->$key) )     $cache[$username][$key] = $data->$key;          $cache[$username]['lastcheck'] = time();     }     else {     $cache[$username]['lastcheck'] = time()+60;     }          update_option( 'rarst_twitter_user', $cache );     }          if ( false != $display )     echo $cache[$username][$field];     return $cache[$username][$field];     }      anyone help ? thanks.


Child themes, over riding in the parents theme

I understand the following about functions.php: > Unlike style.css, the functions.php of a child theme does not override its > counterpart from the parent. Instead, it is loaded in addition to the > parent’s functions.php. **(Specifically, it is loaded right before the > parent’s file.)** The problem with this logic is that things, in my framework, are loaded via action hooks in some cases. so for example you can turn off the admin options in child themes by `remove_action()` How ever with the logic presented above, That action that loads the admin options is not technically loaded until after the child themes functions.php. So the action is never created nor is it's associated function technically added. so has_action() will always return false in a child theme. (or at least it is for me in this instance). What do I need? I need the parent themes functions.php to load FIRST before the child themes. or at least to be first loaded object. Some people have suggested to do require parent theme function before doing anything in a child themes functions.php. is this the right way to handle this situation? where you need the parent themes functions.php to load before the child?


FB Comments box post to wall?

I have a blog that I have a FB comment box. When I post the blog Its also sent a blurb about the blog to the fan page and then database the post id with the post. But is it possible that when a user posts a comment in the FB comment box I can also have that post as a comment to the actual post on the fan page?


How to get post id of first child of the same post type?

Is there a function that will let me get the post id of the first child (of the same post type, not attachment)? I could always just run a loop via wp_query but that seems like overkill. :/ The goal here is to build a function that displays the first attached image. ~~My function goes through the post_thumbnail and the attached images of the parent post fine, but stops working when the only images reside in child posts.~~ **Edit: Here is my current working function. It works, but its not pretty. How can I clean it up?**               /****************************************/     /* Grab first image of a post     /****************************************/       function surfbird_grab_album_image() {         global $post, $posts;              $albumtitle =  get_the_title();              if(has_post_thumbnail()) :             return the_post_thumbnail('small');              else :                  //Grab image if parent post has one             $args = array(                 'order'          => 'ASC',                 'orderby'        => 'menu_order',                 'post_type'      => 'attachment',                 'post_parent'    => $post->ID,                 'post_mime_type' => 'image',                 'numberposts'    => 1,             );                  $attachments = get_posts($args);             if ($attachments) :                 foreach ($attachments as $attachment) {                     echo wp_get_attachment_image($attachment->ID, 'small', false, false);                     echo apply_filters( 'the_title', $albumtitle );                 }             else :                      //Search the child posts and grab the first image we find                  $albumgroups = get_posts( array( 'post_type' => 'album', 'post_parent' => get_the_ID(), 'orderby' => 'menu_order', 'numberposts' => -1 ) );                 foreach( $albumgroups as $post ) :  setup_postdata($post);                       $postID = $post->ID;                 $args = array(                     'numberposts' => 1,                     'order'=> 'ASC',                     'post_mime_type' => 'image',                     'post_parent' => $postID,                     'post_status' => null,                     'post_type' => 'attachment'                 );                      $attachments = get_children( $args );                      if ($attachments) {                     foreach($attachments as $attachment) {                         return wp_get_attachment_image($attachment->ID, 'small', false, false);                     }                 }             endforeach;             wp_reset_query();                     endif;              endif;     wp_reset_postdata();     }


How to load Widget javascript + css files only if used?

I'd like to keep the javascript and css styles used by my widget inside their own files (and not add them to the theme). But i can't seem to get wordpress to add them when the widget is actually used on a sidebar. I've tried this: inside the Class declaration, i've added 2 functions               class EssentielleRubriquesPosts extends WP_Widget {          function addFrontendCss(){         wp_enqueue_style('erw-frontend-css', ESSENTIELLE_RUBRIQUE_WIDGET_PLUGIN_PATH . 'css/EssentielleRubriqueWidget-frontend.css');     }     function addFrontendJavascript(){         wp_register_script('jq-hoverintent', PLUGIN_PATH . 'js/jquery.hoverintent.js', array('jquery'), '1.0',true);         wp_enqueue_script('jq-hoverintent');         wp_enqueue_script('jq-tools', PLUGIN_PATH . 'js/jquery.tools.js', array('jquery'),'1.0',true);         wp_enqueue_script('erw-frontend-js', PLUGIN_PATH . 'js/widget-frontend.js', array('jquery', 'jq-hoverintent', 'jq-tools'),'1.0',true);          }      and inside the widget() function:               function widget($args, $instance) {             add_action( 'wp_print_scripts', 'addFrontendJavascript' );             add_action( 'wp_print_styles', 'addFrontendCss' );     }      But that doesn't do anything...


replace wp-login.php login forms via a hook & use custom forms with wp-login form validation

I am customizing all the wp-login.php forms, i.e., login, lost password, register, etc. I have a working model but when I decoded to toss in the default error messages on my custom forms I thought there must be a better way to make custom forms and still use wp-login.php to do all the heavy lifting and why write custom form validation when wp-login.php does it well enough? I am building this as a plugin. This is my working solution: 1) Each form (login,lost pass, etc.) is a separate .php file. I the file the form is wrapped by a get_header() and get_footer() 2) The action for each form is wp-login.php. So when my custom form is submitted wp-login.php does the form validation. 3) So that post valadation does not return the default response (form from wp- admin.php) I have added a wp_redirect() function that forwards my my custom forms. Like I said this works but now I want to use the default error messages in my custom forms and can not figure out how to get the errors messages to show in my custom form pages. Possible Solutions: 1) wo-login.php uses a switch to select which form to show based on the form validation. Is there a way I can hook into that and have my form called instead? The I can use wp-login.php to do everything. 2) Do I need to include a global variable for the error messages on my pages? 3) I kind of tried copying wp-login.php and stripped out the body, head and functions that I don't need. I kinda works but not really. FYI....I do not want to use Theme My Login as a solution.


Theme doesn't support shortcodes

How can I add shortcode functionality to a WordPress theme that doesn't support shortcodes?


Better WP Security plugin blocking calls using file_get_contents() method

So I recently updated my Better WP Security plugin (and may have changed some of the settings, don't remember exactly) and now I'm having a problem where it's blocking the legitimate requests one of my custom plugins uses. I send a request to my website using the file_get_contents() method in order to determine whether a certain URL exists or not. When Better WP Security is enabled, this method is incorrect. When I disable the plugin however, the method works correctly. Any ideas what setting in Better WP Security plugin is blocking this so I don't have to disable the entire plugin?


Problem with "conditional tag": if empty

I've been trying for a while now to make it so that there is nothing shown if there are no Related Posts. Currently the headline and the container (of course empty) are displayed. Like I said I tried a lot and I came to the conclusion that it might be too difficult if not impossible to get rid of everything as the code is quite complicated:
Related Posts

                  <?php                  $backup = $post;                 $tags = wp_get_post_tags($post->ID);                 if ($tags) {                     $tag_ids = array();                     foreach($tags as $individual_tag) $tag_ids[] = $individual_tag->term_id;                          $args=array(                         'tag__in' => $tag_ids,                         'post__not_in' => array($post->ID),                         'showposts'=>4, // Number of related posts that will be shown.                                                                                'caller_get_posts'=>1                     );                     $my_query = new wp_query($args);                     if( $my_query->have_posts() ) {                         while ($my_query->have_posts()) {                                                                                $my_query->the_post();             ?>
<a href="<?php the_permalink() ?>" rel="bookmark"><?php the_post_thumbnail(array(120,80)); ?>
<a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>"><?php the_title(); ?>

                  <?php                         }                         echo '';                     }                 }                 $post = $backup;                 wp_reset_query();             ?>

             ......

                     Instead, I want to leave the headline and container, but make it so that the container is not empty. For that I want to use an "if" or "elseif" tag Something like that:
Sorry, but there are no related posts for this particular entry.
      I just cannot seem to figure out how to implement it correctly. It would be great if somebody with a bit knowledge of conditional tags could help me figure it out. Thanks a lot! :)


How can I programmatically create "child" pages on theme activation?

I know how to create pages automatically when a theme is activated, but I need help to figure out how to also programmatically create child pages at the same time. For example:               - Page 1       - Page 1.1       - Page 1.2     - Page 2       - Page 2.1       - Page 2.2       - Page 2.3     - Page 3       - Page 3.1     - Page 4       - Page 4.1       - Page 4.2      And here is my function for automatic page creation (top level only).               if (isset($_GET['activated']) && is_admin()){         add_action('init', 'create_initial_pages');     }          function create_initial_pages() {         $pages = array(             'page1' => 'Page 1',             'page2' => 'Page 2',             'page3' => 'Page 3',             'page4' => 'Page 4'         );         foreach($pages as $key => $value) {             $id = get_page_by_title($value);             $page = array(                 'post_type'   => 'page',                 'post_title'  => $value,                 'post_name'   => $key,                 'post_status' => 'publish',                 'post_author' => 1,                 'post_parent' => ''             );             if (!isset($id)) wp_insert_post($page);         };     }      Does anyone know how to extend this function to also create child pages (if they don't already exist) when the theme is activated?


Scheduled event won't fire

I'm trying to set up individual, one-time schedule events in a plugin. No matter what I do, I can't seem to get the events to fire. I'm using the Cron View plugin to see what's in queue, and the events are added and remove themselves totally on schedule. I never, however, receive the email I've set to send in the action's target function (simply in order to test the event, there will be more in there later). I have tested the function outside of scheduled events, it does work. Here's some code:               GLOBAL $new_workshop_id;     $new_workshop_id = $wpdb->insert_id;          function send_reminders() {      GLOBAL $new_workshop_id;      wp_mail('my@emailaddress.tld', 'Automatic ID: '.$new_workshop_id, 'here it is!');     }          if (!wp_next_scheduled('send_reminder_emails_'.$new_workshop_id)) {      wp_schedule_single_event( time()+30, 'send_reminder_emails_'.$new_workshop_id );     }          do_action( 'send_reminder_emails_'.$new_workshop_id );     add_action( 'send_reminder_emails_'.$new_workshop_id, 'send_reminders' );      One thing I'm suspicious is the placement of do_acton and the function itself, `send_reminders()`. The above code is within some if statements checking for POST vars, so it's possible that the function can't be accessed by the CRON job - so where should I put the function? I've tried right at the top of the plugin file. From what I've read, do_action should call the function and execute it wherever you have put do_action, but I guess I need to know where to put `send_reminders()` in the first place so that it's accessible, by either the cron job or do_action. Thanks in advance for any input!