How to paginate a list of tags

I have a page that displays a list of all tags of my blog. Iuse this code which works fine:               <?php     $poststocount=get_tags($args);     echo '
Alphabetic Index of All '
';     ?>          <?php     $taxonomy = 'post_tag';     $tax_terms = get_terms($taxonomy);     ?>
     <?php     foreach ($tax_terms as $tax_term) {     echo '
' . 'name ) . '" ' . '>' . $tax_term->name.'
';     }     ?>
      Question: how can I paginate this lidt (say 40 per page). What would the code to accompish that, preferably with an option to "see all tags". Thanks.


foreach loop pagination for taxonomy blog category

I have a wordpress website running in which I have a blogs page where I display all the blogcategories using the following code               <?php                      $taxonomy = 'blogcategory';                 $tax_terms = get_terms($taxonomy);     ?>                  <?php                 foreach ($tax_terms as $tax_term) {                     $cat_image = z_taxonomy_image_url($tax_term->term_id);                          echo '
';                     if (!empty($cat_image)): ?>                     <a href="<?php echo esc_attr(get_term_link($tax_term, $taxonomy)); ?>">                         <img style="float: left; margin-right: 10px;" src="<?php echo z_taxonomy_image_url($tax_term->term_id); ?>" />                                         <?php endif;                        echo '
name ) . '" ' . '>' . $tax_term->name.'

'.$tax_term->description.'

';                 }          ?>      This is working properly. It lists all the blogcategory. My problem is I am not able to do a pagination, so that I have not more than 10 blog categories listed on the single page. Hope I made it clear. I am new to wordpress. Any help would be highly appreciated.


WP_list_table unhideable columns

So I have managed to setup a custom WP_list_table in my theme as per the tutorial here. I really love the fact that you can make the columns hide-able, and I have manage to implement that. What I would like to know is how to make individual columns so that it is impossible to hide them.


Page to show custom posts and one category

I want to show all my custom posts and category `ID=15` in a page. I managed to call my custom posts as follows:               $type = 'my_custom_posts';         $args=array(           'post_type' => $type,           'post_status' => 'publish',           'posts_per_page' => 5);      How do I get to call, besides `my_custom_posts`, category `ID=15`, which is only for normal posts?


Get taxonomy on publish

I'm not seeing exactly what I'm looking for, so forgive the potential repetitive question. On publish_post, I'd like to check the current post's taxonomies and do something with them. However, the publish_x hook seems to happen before the taxonomies have been set. Does anyone have a solution to grab this information?


Add code to header based on category for specific posts?

![enter image description here](http://i.stack.imgur.com/UhErM.png) Hello all! I'm trying to add as you'll see in the image attached a small huffington post icon and accompanying text to some posts on my blog. I'd like to set up a category "Huffington Post" and when this category was checked for a new post, it would add the "As Published on.." text and Huff Post icon to the post. I don't want this code on every post just the posts that are denoted by this category. Any help is much appreciated! Cheers!!!


disable email notification for specific page

I would like to make the page with id = 2 that do not get notification mail that the message was written because I have on this page of me made to automatically approve comments. so i dont need notification mail


strip_tag not working in header.php

Used code I found on css tricks to remove the li tags from wp_nav_menu.               $menu_parameters = array(     'container'       => false,     'echo'            => false,     'items_wrap'      => '%3$s',     'depth'           => 0,     );          <?php echo strip_tags(wp_nav_menu( $menu_parameters ), '<a>' ); ?>      I placed $menu_parameters in functions.php and called it in my index file and everything was working great until I separated my index files into their appropriate php files. After I moved the strip_tag function into the header.php and then called it using get_header, the nav now falls back to the wp default. Any ideas?


Sanitising post content for use in an email

I'm sending the content of a custom post type in a plaintext email (it's to send competition entries to a panel of judges), so I need to make sure that `$post->post_content` is correctly sanitised first. Is there a filter I can use for this, or if not, what sanitisation do I need to do? Update: I've just found `wp_strip_all_tags` in `wp-includes/formatting.php`, is this what I need?


Wordpress admin not working with domain name

I had wordpress site on LAMP server without domain name mapping. I am able to access site with IP `http://192.237.169.17` without any issue. `http://192.237.169.17` pointing to sub-domain folder on server But now after mapping domain name I am able to access front end but admin showing blank page with domain name, but with IP both working. Checked view source it's showing some iframe with reference to IP. I have also tried to update all links in database with domain name but still same issue. Also, tried with dedug true but showing no error message, in error log as well. domain name is deals.anilabsinc.com working with both ip and domain name deals.anilabsinc.com/wp-admin not working but working with IP `http://192.237.169.17/wp-admin` I think, I am new to wordpress so am not able to figure out this issue. still looking for it. Please help me to solve this issue. Let me know if any other detail is required.


Get a submitted value from front end post form for single template

I'm using Wordpress Form Manager to allow users to post from the front end and I need to place values for the post in different spots in a single post template. The code they offered doesn't return anything in or outside the loop. For instance I need to put the url of the file upload into a script to play a song. The tutorial says use this function but it doesnt return anything. Anyone have any experience with it?               <?php fm_summary_get_item_value('song-mp3'); ?>      Update: Still stressing over this. I tried something I found in a thread that somebody said allowed them to turn a value into a custom field but it doesn't seem to work the way I have it.                function my_custom_field($postID) {     $my_custom_field_value_var = fm_summary_get_item_value('song-mp3');     $my_get_lastID = wp_get_recent_posts('1');     $my_thePostID = $my_get_lastID['0']['ID'];     add_post_meta($my_thePostID, 'song_mp3', $my_custom_field_value_var, true);     }     add_action('fm_form_submission', 'my_custom_field');


Switching themes without losing widgets?

The other day, I switched from 2010 default them to Semiologic, then back. When back to the 2010, all my appearance/widgets had gone back to the default. Does this often happen? What is the best practice? Should I always do a database backup before trying new themes, then restore if I don't like it? Or is there something simple I might have missed?


Filter content by custom field and category

Im trying to filter an Wordpress request with 2 parameters.   1. by a custom field (REGION) there are 6 regions    2. by categorie, there are n-categories with 1 value per post. As result i would like to have all posts with by example region 1 and categorie 5(if region 1 AND categorie 5 is true for this post). It workes not optimal.... but the main problem I have is: I would like to get an html <select> with any categories in region 1. it should look like this:               region1,       5       3       8      but it looks like:               region1,       5       5       5       3       8       3       8       8      Here are the problemarea of my code:               $selectsql = "                  SELECT                  wterms.*                      FROM $wpdb->posts wposts                         INNER JOIN $wpdb->term_relationships AS tr ON (wposts.ID = tr.object_id)                         INNER JOIN $wpdb->term_taxonomy AS tt ON (tr.term_taxonomy_id = tt.term_taxonomy_id)                         INNER JOIN $wpdb->terms wterms ON (tt.term_id = wterms.term_id)                         INNER JOIN $wpdb->postmeta wpostmeta ON (wposts.ID = wpostmeta.post_id)                      WHERE wposts.post_status = 'publish'                     AND tt.taxonomy = 'th5'                     AND wpostmeta.meta_key= '_sprachgruppen'                 GROUP BY tt.taxonomy                  ";                       $select_output = $wpdb->get_results($selectsql,OBJECT);      And here are the complete code, I am using by now. I hope, someone can understand my problem an can help me.               <?php       global $wpdb;      global $post;            if(isset($_POST[gruppe])){      $sprachgruppe = $_POST['gruppe'];      }           if(isset($_POST[gruppe]) && isset($_POST[sprache])){      $sprache = $_POST['sprache'];      }           ?>      <form action="<?php //$_SERVER['PHP_SELF']; ?>" method="post" class="liedsuche" accept-charset="utf-8">     Liedsuche:          <select name="gruppe" id="sprGr">             <option value="0" <?php if($_POST[gruppe]==0){echo"selected=\"selected\"";} ?>  >Alle Sprachgruppen</option>             <option value="1"  <?php if($_POST[gruppe]==1){echo"selected=\"selected\"";} ?>  >I LATEIN UND ROMANISCHE SPRACHEN</option>             <option value="2"  <?php if($_POST[gruppe]==2){echo"selected=\"selected\"";} ?>  >II GERMANISCHE SPRACHEN</option>             <option value="3"  <?php if($_POST[gruppe]==3){echo"selected=\"selected\"";} ?>  >III  BALTISCHE SPRACHEN</option>             <option value="4"  <?php if($_POST[gruppe]==4){echo"selected=\"selected\"";} ?>  >IV SLAWISCHE SPRACHEN</option>             <option value="5"  <?php if($_POST[gruppe]==5){echo"selected=\"selected\"";} ?>  >V KELTISCHE SPRACHEN</option>             <option value="6"  <?php if($_POST[gruppe]==6){echo"selected=\"selected\"";} ?>  >VI VEREINZELTE INDOGERMANISCHE SPRACHEN</     option>              </select>                              <select name="sprache">             <option value="0">Alle Sprachen</option>                  <?php             $selectsql = "                  SELECT                  wterms.*                      FROM $wpdb->posts wposts                         INNER JOIN $wpdb->term_relationships AS tr ON (wposts.ID = tr.object_id)                         INNER JOIN $wpdb->term_taxonomy AS tt ON (tr.term_taxonomy_id = tt.term_taxonomy_id)                         INNER JOIN $wpdb->terms wterms ON (tt.term_id = wterms.term_id)                         INNER JOIN $wpdb->postmeta wpostmeta ON (wposts.ID = wpostmeta.post_id)                      WHERE wposts.post_status = 'publish'                     AND tt.taxonomy = 'th5'                     AND wpostmeta.meta_key= '_sprachgruppen'                 GROUP BY tt.taxonomy                  ";             $select_output = $wpdb->get_results($selectsql,OBJECT);           if ($select_output){          foreach ($select_output as $post){             setup_postdata($post);           if(isset($_POST[gruppe])){             $option .= '<option value="'.$post->term_id.'"';             $option .= ' >';             $option .= $post->name;             $option .= '</option>';      }           echo $option;              }                }else{              echo "leider leer";           }                   ?>         </select>         <input type="submit" name="auswahl" value="Auswahl">

      </form>                     <?php      if ($_POST[sprache]!=='0') {  // if language is selected           $querystr = "          SELECT            wposts.*,         wterms.*              FROM $wpdb->posts wposts                 LEFT JOIN $wpdb->term_relationships AS tr ON (wposts.ID = tr.object_id)                 LEFT JOIN $wpdb->term_taxonomy AS tt ON (tr.term_taxonomy_id = tt.term_taxonomy_id)                 LEFT JOIN $wpdb->terms wterms ON (tt.term_id = wterms.term_id)                 LEFT JOIN $wpdb->postmeta wpostmeta ON (wposts.ID = wpostmeta.post_id)              WHERE wposts.post_status = 'publish'             AND tt.taxonomy IN ('th4', 'th5')             AND tt.term_id IN ($sprache)             AND wpostmeta.meta_key= '_sprachgruppen'             AND wpostmeta.meta_value= $sprachgruppe         GROUP BY wposts.ID          ";                  }else if($_POST[sprache]=='0'){      $querystr = "          SELECT            wposts.*,         wterms.*              FROM $wpdb->posts wposts                 LEFT JOIN $wpdb->term_relationships AS tr ON (wposts.ID = tr.object_id)                 LEFT JOIN $wpdb->term_taxonomy AS tt ON (tr.term_taxonomy_id = tt.term_taxonomy_id)                 LEFT JOIN $wpdb->terms wterms ON (tt.term_id = wterms.term_id)                 LEFT JOIN $wpdb->postmeta wpostmeta ON (wposts.ID = wpostmeta.post_id)              WHERE wposts.post_status = 'publish'             AND tt.taxonomy IN ('th4', 'th5')             AND wpostmeta.meta_key= '_sprachgruppen'             AND wpostmeta.meta_value= $sprachgruppe              GROUP BY wposts.ID          ";             }                  $postids = $wpdb->get_results($querystr,OBJECT);           if ($postids){               $tab= "
";         foreach ($postids as $post){             setup_postdata($post);                  // ermittelt das aktuellste attachment(PDF) der Seite             $attachment_id = $wpdb->get_var("SELECT ID FROM $wpdb->posts WHERE post_parent = '$post->ID' AND post_status = 'inherit' AND      post_type='attachment' ORDER BY post_date DESC LIMIT 1");                       $tab .= "
";             $tab .= "";             $tab .= $post->post_title;             $tab .= "	";             $tab .= "PDF Download $sprachgruppe";             $tab .= "	";             $tab .= "
\n";              }              $tab .= "
";           echo $tab;                }else{              echo "leider leer";           }                      ?>


How can I use a sliced image As banner?

I am giving a try to something i have never done before. I am trying to slice a psd file and want to use it as a banner. But the problem is, as you may already know that, wordpress only allow one image as banner, so how can I use sliced psd as banner? If coding is needed, can you give me some hints, so that I can make a try over it.


How to make the post summary taller?

right now our posts on the landing page are only showing 2 lines of the content. How can I get the posts to show 5 lines of the content each?


Why is "/page/2/" not working?

Finally got pagination to work with the below code, but now the pagination links to /videos/page/2/, which doesn't exist. How do I get page 2 to work?               <?php     $temp = $wp_query;     $wp_query= null;     $wp_query = new WP_Query();     $wp_query->query('post_type=videos&showposts=1'.'&paged='.$paged);          while ($wp_query->have_posts()) : $wp_query->the_post();       //display stuff     endwhile;                     php  wp_pagenavi();      ?>


php include returns 1 as output with other outputs

I have this code               $return = include(TEMPLATEPATH . '/apex.php' );          $html .= $return;      I using the above code to get a php for from a plugin from theme dir. but it returns 1 with the other wanted outputs. how to solve this I have seen the other question on stackoverflow but those hasn't work thanks in advance


wordpress taxonomy in regular posts

I have a custom post type and taxonomy so the user can post in a specific areas in the theme. User (admin) can add categories easily. But the categories that has been added through my taxonomy don't show up in wordpress regular posts category option. I do not have any problem with displaying those posts on theme. My problem is to showing those custom categories in regular post's category option. Is there a way to make ; a custom category created by taxonomy to be shown in **wordpress regular post's category section**?


Replace do_action() with a normal submit form in comments.php

In my comments.php I have this code:                <input name="submit" type="submit" id="submit" tabindex="5" value="Submit" />      <?php comment_id_fields(); ?>      <?php do_action('comment_form', $post->ID); ?>      Is there a way to replace this code whit a simple submit form? and not use: do_action() ?


Redirect user to a custom url after submitting the comment

After someone submits a comment this line of codes redirects him to the post (i believe). Can I modify the code in order to redirect him to a custom URL? do_action('comment_form', $post->ID) Ty for the answer, UPDATE: my comments.php               <form>        .......       <input name="submit" type="submit" id="submit" tabindex="5" value="Submit" />       <input type="hidden" name="my_redirect_to" value="http://www.google.com"; />       <?php comment_id_fields(); ?>       <?php do_action('comment_form', $post->ID); ?>       </form>      my functions.php               add_action('comment_post_redirect', 'redirect_to_thank_page'); // Redirect to thank you post after comment        function redirect_to_thank_page() {            if ( isset( $_POST['my_redirect_to'] ) )             return $_POST['my_redirect_to'];         }      The code does not work, it's not redirecting to google.com for example. Any ideas why? Ty


Display custom field if it exists and has a specific value

I am trying to display the post title if the custom field exists and has a value of apple...               <?php if ( isset ( get_post_meta($post->ID, 'mycustomvalue', true ) ) ) && if ( get_post_meta($post->ID, 'mycustomvalue', true ) == 'apple' ) : ?>          <?php the_title(); ?>      I am getting a white screen, anyone spot where I am going wrong?


How to set a default meta value for custom field

I have setup a custom meta_key for attachments. Since it is a radio button with Yes/No options, and the default value is always Yes, I need that this default value is saved into the db when the attachment is created. Right now the problem is that when I upload an image, the Edit Media page shows me that the value for this meta_key is "Yes", but it is actually not saved in the database until I click "Save All Changes" or "Update Media". Since these attachments can be added both by manually uploading files and automatically by importing an RSS feed, I need the default value to be created at the moment the attachment is created in the db. UPDATE: To explain the issue in more detail, this is the code I am using in the template to find the attachments. I don't know if I can modify this to also query the attachments when the _show_attach is null?               $attached_photos = get_children(array(             'post_parent'    => get_the_ID(),             'post_type'      => 'attachment',             'numberposts'    => -1, // show all             'post_status'    => null,             'post_mime_type' => 'image',             'order' => 'ASC',             'orderby' => 'menu_order',             'meta_key' => '_show_attach',             'meta_value' => 'false',             'meta_compare' => '!='         ));


use query_posts to return a post OR a page by ID

I'm building a custom homepage for a client where they want to have a few changeable boxes to link to specific pages, or posts, within the site. I've added custom fields to the homepage so that they need only enter the page/post ID, and then it will display the proper post or page. And I'd like it to be flexible enough that they can do a post or page. Right now, my code for the box is               <?php query_posts('p='.$topright); ?>     <?php while (have_posts()) : the_post(); ?>          {title and featured image}     <?php endwhile; ?>      where $topright is a variable already defined. (I've tested the variable with an echo and it is returning the proper ID number.) Unfortunately, WordPress seems to require that I use p=ID if it is a post, and page_id=ID if it is a page. So, if I designate the ID for a post, it is working fine, but not if I desingate the ID for a page. Is there an alternative syntax I could use? Or, it there a conditional of some kind that might look a the ID and recognize if it is a post or a page so I could run the query with an IF ELSE?


Generate page title tag from the content of H1

Is there any way of generating the title tag of a page from the content of an H1 tag on my wordpress page? I've got some dynamically generated content pulled in via an external XML feed and and at the moment, as the page isn't physically generated via the wordpress admin system and is just using a template, the page title is just staying the same regardless of the content. However, I was just wondering whether it would be possible in php, to grab the content of an H1 on a page and generate the title tag from that? Any tips / advice would be greatly appreciated :) Thanks


Target admin page body via CSS class

Within admin pages can one target specific pages based on their body class, as in the front end? For example I created a custom post type and would like to target its add and edit pages for some CSS tweaks. How do I go about that?


Why Editor reformats my code

I'm using TinyMCE Advanced and SyntaxHighliter plugins on my WordPress install. Why does the editor change my inserted code, from:               [php]     <?php     /**     echo('code');     /**/     [/php]      to:               [php]     <!--?php <br ?-->/**     echo('code');     /**/     [/php]


custom permlink .htaccess file 404 Not Found error

i read alot of atricles taking about this but i could fix my problem yet .. i want to make the permlink custom > /%category%/%postname% and i searched for the .htaccess in the wordpress files and i couldn't find it so i created one and added this code               # BEGIN WordPress     <IfModule mod_rewrite.c>     RewriteEngine On     RewriteBase /sitename/     RewriteRule ^index\.php$ - [L]     RewriteCond %{REQUEST_FILENAME} !-f     RewriteCond %{REQUEST_FILENAME} !-d     RewriteRule . /sitename/index.php [L]     </IfModule>     # END WordPress      in the RewriteBase this name is the name of the folder of wordpress in my hosting , when i open my site the permlink changed as i want but when i open the page it gives me an error 404 Not Found error by the way i tried to choose the twentytwelve but its not working also , i added the .haccess file in the file mythemes in mytemplate is that the right place ??


Use mysql_query instead of $wpdb query

I have a custom table inside my wordpress database called test. What if i query this table using mysql_query() instead of using for example $wpdb->get_results() Will this affect my performance? Ty very much:)


check current_theme_supports in admin_menu hook

I'm adding a menu and sub-menus via the `admin_menu` hook in my functions.php. One of the sub-menus I want to add is `menus`. I want to make sure that the theme supports menus before I do that, so I tried using the `current_theme_supports` function, but it returns false, apparently because `$_wp_theme_features` is still null at this stage. What should I do? Do you think I really need this check, if I'm anyway in my functions.php? And if I do - should I use a later hook to create my menus? Or any other solution?


How to embed page content in a blog post

I've built an HTML table that is posted on a page in my site, and I'd like to use that same content inside a blog post (something of an announcement of the table's publication). The table is likely to get updated from time to time, so I'd like to have a single source for maintenance purposes. Is there a way I can do a one-off embedding of the table's source into the blog post, so that it is always updated when the page is updated? This isn't expected to happen often, so I don't want to put a lot of elbow grease into making this work. Thanks in advance! EDIT SO I made a really short shortcode solution using http://wordpress.org/extend/plugins/shortcode-exec-php/               extract(shortcode_atts(array('arg' => 'default'), $atts));     $id = 2328;     $post = get_post( $id );     return apply_filters('the_content', $post->post_content );      Thanks to everyone who helped. I don't have rep to upvote answers, but i will when I get more points.


Change behavior depending on content length

I have a large amount of posts and some only have one sentence. This means for some posts all the content can be read in an archive without needing to go to the posts single page. For these posts I want to disable the_permalink in the post's title. Is there a way I can detect if the excerpt length limit was reached? Then I can use something like               <a href="<?=($if_has_more_link ? the_permalink() : '#' )?>" ><? the_title(); ?>


How to use the settings API to set multidimensional arrays

I'm writing a course information plugin. Most course info is related to to a post (a custom post type of 'course'), so I have put the majority of info in the postmeta table. But some info isn't related to any of the posts - venue information for example. I'm using the options table to store that info. I've added a set of options pages, and am using the settings API to edit basic information. The problem is that some of the info is dynamic and more complicated: I have a venue page where I need to support adding new venues, and editing them. Each venue has a title, 3 address lines and a postcode. An example of the array of venues is:               array(         1 => array(                     'venue_title' = 'Edge Hill University, Ormskirk',                     'address_1'   = '20 Edge Lane',                     'address_2'   = 'Ormskirk',                     'address_3'   = 'Lancashire',                     'postcode'    = 'L12 6EA'              ),         2 => array(                     'venue_title' = 'Edge Hill University, Aintree',                     'address_1'   = '12 Aintree Close',                     'address_2'   = 'Aintree',                     'address_3'   = 'Liverpool',                     'postcode'    = 'L48 6PQ'              ),         3 => array ( ...etc other venues)          );      So to make any changes I use text fields. These get handled by the settings api. The name attribute and content are set dynamically from a $_GET variable.               <input type="text" name="venues[<?php echo $venue_id; ?>][venue_title]" value="<?php echo $venues[$venue_id]['venue_title']; ?>" />      which would output as               <input type="text" name="venues[2][venue_title]" value="<?php echo $venues[2]['venue_title']; ?>" />      I only have one set of these fields registered with the settings api, which is where i think the problem is, as when I change one, it removes all the other ones and just inserts the new one. So in my mind the code above should update just the $venues[2][venue_title], but it overwrites all venues. I think because there is only one set of fields registered it will only update as if there is one set of fields. Does anyone know a simple way to make this work? Thanks


Using Page/Post Slug In Link / URL

Hope this is easy! Need to figure out (if possible) how to input my page's SLUG into a web url as a placeholder. For example: http://www.samplewebsite.com/search.ashx?t=current I need to replace "current" with my page's SLUG making it dependent on the current page's SLUG For Slugs.... test1, test2, test3, test4, test5 Output... http://www.samplewebsite.com/search.ashx?t=test1 - for each test1 "slug" Is this possible?


is theme network enabled?

So I have been looking for something that allows me to get an array of themes that are network enabled (set in the Network Admin > Themes) There is the field called "allowedthemes" in the wp_options table however, this function is slightly different. It only contains themes that are enabled for that given networked blog as oppose to a global enable... if that makes sense? So it's scope is limited to one blog ID instead of all blogs (this info is set in the Network Admin > Sites > (clicking edit button of desired blog) > Themes). Anyways, if anyone has any solutions it would be much appreciated :) Thanks!


Add a field to just ONE page

I discovered the 'More Fields' plugin which allows an editor to control which fields appear on which types of items in WordPress. Problem is, I would like to control which pages appear on just ONE page. Example of this: - About page has WYSIWYG editor & Image - Contact page has multiple text fields From the looks of it, you have to create new page types, but each of them show up in a separate section in the sidebar. I would like everything to appear under my pages tab. Any help would be great.


Editing Help Section

I was trying to find the contextual help section for all the admin pages so I could add some additional text. The main pages I need to hit are the "Pages" page and the "Widgets" page but I'm not sure where to find the files for these. Anybody know file names where I can find the contextual help?


Recent activity query WordPress

Does anyone know how I can get a list of posts based on their recent activity? Activity such as a new comment, an edit, a new post, et cetera. Some Q&A wordpress themes seem to be using this but I have no clue on how to generate such a query myself... Please, it's very important.


Get password when user registers and save it sha1 into database

im working on a website where the users can connect with iphone to some functions of it by using a sha1 encrypted password. In other words the plain password of wordpress encrypted in sha1. In the past i did the silly thing of editing the core files of wordpress to get the password when the user register and save that password in sha1 on the wp_users table. Of course my client updated wordpress and all the functions were lost. Yeah im stupid, im not sure what i was thinking that day. There is any way to hook to the register function to get the password , encrypt it in sha1 format and storeit in the database from the functions.php file of my theme? Any ideas?


How to save Uploaded image in custom option panel?

I'm trying to add a custom option panel to a new template following a tutorial found on NetTuts. I saved all the code for the option panel inside a file called optionpanel.php (LoL) and everything is working but now I would like to add an Upload/Image button so I'll be able to change images inside a slideshow straight from Wordpress Media Library instead of connecting via FTP each time. So here is the problem, how to achieve this? This is what I've got up to now, I can see the Media Upload box and I can upload the image and the image is stored inside the media library but when I click on save in my option panel and try to echo the function it gives me nothing and after saving the form where there was the link to the image became empty once again! I know that my English is ugly anyway please be polite and, if, you can, try to explain it to me like if you are talking to your 3 years old son! I googled a lot (maybe too much!!!) and I've read: http://www.sitepoint.com/wordpress-options-panel/ http://www.webmaster-source.com/2010/01/08/using-the-wordpress-uploader-in- your-plugin-or-theme/ http://www.theenglishguy.co.uk/2010/01/24/multiple-media-uploads-in-wordpress- functions-php/ http://stackoverflow.com/questions/2388697/wordpress-2-9-theme-options-admin- page-with-image-upload http://www.wptavern.com/forum/themes-templates/1346-creating-upload-function- options-page.html#post13306 http://sicdigital.com/2010/07/create-custom-post-type-for-image-upload- wordpress3/ http://www.tanzilo.com/2009/01/15/wordpress-adding-a-custom-option-box-and- developing-file-upload-plugin/ http://wordpress.org/support/topic/file-upload-with-custom-post-type?replies=8 https://github.com/JeffreyWay/WordPress-Theme-Options-Page/blob/master/admin- menu.php http://stuntsnippets.com/wordpress-custom-theme-options/ http://www.sitepoint.com/wordpress-options-panel/ And much more!!!! So here is my code:               <?php          $themename = "Centenario Pascoliano";     $shortname = "cp";          $categories = get_categories('hide_empty=1&orderby=name');     $wp_cats = array();     foreach ($categories as $category_list ) {            $wp_cats[$category_list->cat_ID] = $category_list->cat_name;     }     array_unshift($wp_cats, "Choose a category");           $options = array (          array( "name" => $themename." Opzioni",         "type" => "title"),               array( "name" => "Generale",         "type" => "section"),     array( "type" => "open"),          array( "name" => "Colour Scheme",         "desc" => "Select the colour scheme for the theme",         "id" => $shortname."_color_scheme",         "type" => "select",         "options" => array("blue", "red", "green"),         "std" => "blue"),          array( "name" => "URL Locandina",         "desc" => "Inserisci il link alla locandina",         "id" => $shortname."_locandinah",         "type" => "text",         "std" => "/wp-content/themes/centenario/images/locandinacentenario.png"),          array( "name" => "Product Image Upload",           "desc" => "Upload product image",           "id" => $shortname."_upload_one",           "type" => "upload",           "std" => ""),                 array( "type" => "close"),     array( "name" => "Homepage",         "type" => "section"),     array( "type" => "open"),          array( "name" => "Homepage header image",         "desc" => "Enter the link to an image used for the homepage header.",         "id" => $shortname."_header_img",         "type" => "text",         "std" => ""),          array( "name" => "Prima categoria da mostrare",         "desc" => "Scegli la prima categoria da mostrare in HomePage",         "id" => $shortname."_feat_cat",         "type" => "select",         "options" => $wp_cats,         "std" => "Scegli la prima categoria"),          array( "name" => "Seconda categoria da mostrare",         "desc" => "Scegli la seconda categoria da mostrare in HomePage",         "id" => $shortname."_feat_cat2",         "type" => "select",         "options" => $wp_cats,         "std" => "Scegli la seconda categoria"),          array( "type" => "close"),     array( "name" => "Footer",         "type" => "section"),     array( "type" => "open"),          array( "name" => "Footer copyright text",         "desc" => "Enter text used in the right side of the footer. It can be HTML",         "id" => $shortname."_footer_text",         "type" => "text",         "std" => ""),          array( "name" => "Google Analytics Code",         "desc" => "You can paste your Google Analytics or other tracking code in this box.             This will be automatically added to the footer.",         "id" => $shortname."_ga_code",         "type" => "textarea",         "std" => ""),             array( "name" => "Custom Favicon",         "desc" => "A favicon is a 16x16 pixel icon that represents your site; paste the URL     to a .ico image that you want to use as the image",         "id" => $shortname."_favicon",         "type" => "text",         "std" => get_bloginfo('url') ."/favicon.ico"),            array( "name" => "Feedburner URL",         "desc" => "Feedburner is a Google service that takes care of your RSS feed. Paste     your Feedburner URL here to let readers see it in your website",         "id" => $shortname."_feedburner",         "type" => "text",         "std" => get_bloginfo('rss2_url')),               array( "type" => "close")          );               function mytheme_add_admin() {          global $themename, $shortname, $options;          if ( $_GET['page'] == basename(__FILE__) ) {          if ( 'save' == $_REQUEST['action'] ) {              foreach ($options as $value) {         update_option( $value['id'], $_REQUEST[ $value['id'] ] ); }          foreach ($options as $value) {            if( $value['type'] == 'upload' )          {              $upload = wp_handle_upload( $_FILES[ $value['id'] ] );              if( isset( $upload['url'] ) )              {                  update_option( $value['id'], $upload['url'] );              }          }                  elseif( isset( $_REQUEST[ $value['id'] ] ) )              {                  update_option( $value['id'], $_REQUEST[ $value['id'] ]  );              }              }          header("Location: admin.php?page=optionpanel.php&saved=true");     die;          }          else if( 'reset' == $_REQUEST['action'] ) {          foreach ($options as $value) {         delete_option( $value['id'] ); }          header("Location: admin.php?page=optionpanel.php&reset=true");     die;          }     }          add_menu_page($themename, $themename, 'administrator', basename(__FILE__),     'mytheme_admin');     }          function mytheme_add_init() {          $file_dir=get_bloginfo('template_directory');     wp_enqueue_style("functions", $file_dir."/functions/functions.css", false, "1.0",     "all");     wp_enqueue_script("rm_script", $file_dir."/functions/rm_script.js", false, "1.0");          }     function mytheme_admin() {          global $themename, $shortname, $options;     $i=0;          if ( $_REQUEST['saved'] ) echo '

        '.$themename.' settings saved.

';     if ( $_REQUEST['reset'] ) echo '

    '.$themename.' settings reset.

';          ?>

<?php echo $themename; ?> Settings

     <form method="post" enctype="multipart/form-data" >       <?php foreach ($options as $value) {     switch ( $value['type'] ) {          case "open":     ?>          <?php break;          case "close":     ?>

               <?php break;          case "title":     ?>
To easily use the <?php echo $themename;?> theme, you can use the menu below.
               <?php break;          case 'text':     ?>
         <label for="<?php echo $value['id']; ?>"><?php echo $value['name']; ?>         <input name="<?php echo $value['id']; ?>" id="<?php echo $value['id']; ?>" type="<?    php echo $value['type']; ?>" value="<?php if ( get_settings( $value['id'] ) != "") { echo     stripslashes(get_settings( $value['id'])  ); } else { echo $value['std']; } ?>" />      <?php echo $value['desc']; ?>

     <?php     break;          case 'textarea':     ?>
         <label for="<?php echo $value['id']; ?>"><?php echo $value['name']; ?>         <textarea name="<?php echo $value['id']; ?>" type="<?php echo $value['type']; ?>"     cols="" rows=""><?php if ( get_settings( $value['id'] ) != "") { echo     stripslashes(get_settings( $value['id']) ); } else { echo $value['std']; } ?></textarea>      <?php echo $value['desc']; ?>

          <?php     break;          case 'select':     ?>
         <label for="<?php echo $value['id']; ?>"><?php echo $value['name']; ?>          <select name="<?php echo $value['id']; ?>" id="<?php echo $value['id']; ?>">     <?php foreach ($value['options'] as $option) { ?>             <option <?php if (get_settings( $value['id'] ) == $option) { echo     'selected="selected"'; } ?>><?php echo $option; ?></option><?php } ?>     </select>              <?php echo $value['desc']; ?>

     <?php     break;          case "checkbox":     ?>
         <label for="<?php echo $value['id']; ?>"><?php echo $value['name']; ?>          <?php if(get_option($value['id'])){ $checked = "checked=\"checked\""; }else{ $checked =     "";} ?>     <input type="checkbox" name="<?php echo $value['id']; ?>" id="<?php echo $value['id'];     ?>" value="true" <?php echo $checked; ?> />                   <?php echo $value['desc']; ?>

     <?php break;      case "section":          $i++;          ?>

<img src="<?php bloginfo('template_directory')?    >/functions/images/trans.png" class="inactive" alt="""><?php echo $value['name']; ?>
        <input name="save<?php echo $i; ?>" type="submit" value="Save changes"     />

               <?php break;     case "upload";?>

     Upload Image	          <input id="upload_image" type="text" size="36" name="upload_image" value="" />     <input id="upload_image_button" type="button" value="Upload Image" />
Enter an URL or upload an image for the banner.

          <?php break;     }     }     ?>          <input type="hidden" name="action" value="save" />     </form>     <form method="post">
     <input name="reset" type="submit" value="Reset" />     <input type="hidden" name="action" value="reset" />
     </form>
Icons: WooFunction

                <?php     }         ?>         <?php         function my_admin_scripts() {     wp_enqueue_script('media-upload');     wp_enqueue_script('thickbox');     wp_register_script('my-upload', get_bloginfo('template_url') .     '/functions/maisdesignscript.js', array('jquery','media-upload','thickbox'));     wp_enqueue_script('my-upload');     }     function my_admin_styles() {     wp_enqueue_style('thickbox');     }     if (isset($_GET['page']) && $_GET['page'] == 'optionpanel.php') {     add_action('admin_print_scripts', 'my_admin_scripts');     add_action('admin_print_styles', 'my_admin_styles');}     add_action('admin_init', 'mytheme_add_init');     add_action('admin_menu', 'mytheme_add_admin');     ?>


Custom Register Link on Backend Form

I want a similar solution like this one for my login form on the backend of my WordPress installation: Forgot Password URL Filter What I want to do instead of returning a custom forgot password url, I want to return a custom register link (all of this is on the login form at `/wp- login.php`). Basically I'm trying to white label WordPress completely, and I've got front end forms for creating and editing posts, registering, logging in, profile editing, and post management all in the front end. However, when someone attempts to login and that attempt is failed, they're redirected to `/wp-login.php`. Ideally I could throw an error on my site and have it redirect to my front-end login page (is there a filter for that?), but worse case-scenario, I've rebranded my backend form so wordpress doesn't look like an issue (aside from the url being `http://www.site.com/wp-login.php`, but that's not a huge deal) What I want to know is if there's a filter so I can return a custom register link on the backend, and if possible even a custom login link back there too. I've learned that there is a lostpassword_url filter, but as far as I know there isn't a register_url filter that I can use to change that. Any help? **UPDATE** http://core.trac.wordpress.org/browser/tags/3.2.1/wp-login.php#L418 This is what I want to hook into with a filter to change.


Dynamically Load Styles and Scripts from Theme Functions.php

I am attempting to dynamically load stylesheets and scripts based on the template name. So if I have a template named `page-signup.php` then it will load the corresponding stylesheet `page-signup.css` and `page-signup.js` if they exist for that page from a specific directory in my theme folder. Here is what I have so far in functions.php of my theme. It does not currently load any styles or scripts when the css and js files are present in the proper directory:               /**      * Auto loads scripts and styles based on the page name if they exist.      */     function mytheme_bootstrap_page_resources() {         if( is_page_template() ) {             $page_template = basename( get_page_template(), '.php' );             $css_file_path = get_template_directory() . "/css/pages/$page_template.css";             $js_file_path = get_template_directory() . "/js/pages/$page_template.js";             $css_file_uri = get_template_directory_uri() . "/css/pages/$page_template.css";             $js_file_uri = get_template_directory_uri() . "/js/pages/$page_template.js";                  if(file_exists($css_file_path)){                 wp_enqueue_style($page_template, $css_file_uri);             }                  if(file_exists($js_file_path)){                 wp_enqueue_script($page_template, $js_file_uri);             }         }     }     add_action('wp_enqueue_scripts', 'mytheme_bootstrap_page_resources');


Query function not executed between <div> element

I'm wondering why the following code is not executed between the element it's put in. I know sort of how to fix, but I'm not sure if that's the best solution. My code: **First function**               function myfunction1($args = array()) {              var_dump($args);              $output = null;              $output .= '
';         $output .= myfunction2( $args );         $output .= '
';              return $output;               }      **And the second function (myfunction2)**               function myfunction2($args) {                  $options = $args;          /* get post types */         $default_post_types = explode(' ',$options['post_type']);             if ($default_post_types[0] == 'any') {                $default_post_types = 'any';            }              /* default args */         $args = array(                 'post_type'         => $default_post_types         );              $query = new WP_Query( $args );                        if ($query->have_posts()) :                       require_once dpf_path . 'frontstyle/dpf-front.php';              else :                   require_once dpf_path . 'frontstyle/dpf-cantfind.php';              endif;          }      In the dpf-front.php file are some html elements. The posts that are called in function1 are not between the `<div id="mydivelement"></div>` element. How to do this properly? Thanks! When I echo the div element it works somehow. Why is that?


Can I list a custom post type within another custom post type in the admin area?

I'm hoping someone can steer me in the right direction. I have a custom post type called 'locations'. I have another custom post type called 'testimonials'. What I'd really like to do is be able to associate a 'testimonial' with a 'location'. So I was trying to figure out if I could some how list those locations within the testimonial post page in the admin area. Almost like a meta box. I haven't been able to find anything like this anywhere. Any and all help is appreciated!


404 errors in log showing urls with 'GET', plus and numerical code

My wordpress logs show 404 errors to URLs having the following pattern:               http://example.com/path/++GET+http:/example/+0,48595,73506+-      Web searches do not return answers because of the _plus_ and _minus_ symbols. Note that the second _http_ is followed by a single slash. Accessing my site with a corrected URL (where I use a double slash after the second http) returns a 404. My logs show fifty errors each day from different IP addresses, where each IP address tries the same file three times. I am curious to know what type of exploit this may be. It seems to have something to do with the GET request method. Ideas?


How to prevent wordpress from autoformatting my posts once and for all?

I am using ifttt to sync my wordpress blog with my blogger site, and there is a problem of auto-formatting on wordpress's side. It likes inserting `<br>` everywhere when exporting posts. For example, a list on wordpress looks like this: ![enter image description here](http://i.stack.imgur.com/g4Ae2.jpg) After syncing, the list looks like this on blogger: ![enter image description here](http://i.stack.imgur.com/3O8OP.jpg) Leaving the syncing scenario aside, Wordpress does this to its own posts, too. I had to disable the `wpautop` function in `wp-include/formatting.php` to prevent it from inserting those annoying `<br>` tags. But I don't know which function to disable in the current case. **If possible I would like to disable all forms of autoformatting once and for all, because I always use html for markup and there is no need for WP to reformat for me at all.**


List posts from Custom Post type with hierarchy?

I have a custom post type that is set to have hierarchy. I'm trying to create a list of posts in that post type that display's that hierarchy using nested unordered lists. I have this post structure: Post -child post -- child of child post -- child of child post And I want to be able to create a list of posts (which i guess are behaving more like pages since they have hierarchy), that reflects this structure using unordered lists, like so:

Post

child post

child of child post

chld of child post

      What's the best way to do this (if there is one) so that I don't have to go back into the code whenever I add new parent pages?


WordPress Theme is not Responsive to Updates

I have a WordPress theme that's installed and has been running fine for a while. I recently needed to update the theme itself, and I did so using the built-in theme editor. Upon reloading the site, the theme changes are not presented in the markup. Removing the index.php file from the theme or changing it's name results in a blank page as expected, but removing all contents of the theme's index.php does not have a similar effect. In fact, the WordPress installation continues as if I had not made index.php blank. I have no caching plugins installed, Varnish is not present, memcached is not in use at all, and neither is APC. I attempted upgrading all the plugins and WordPress itself. The raw-html plugin I have installed failed to update with a fatal error about an include on line 16, but that include was not present. The update worked fine when I renamed the plugin filename though (from raw_html.php to raw_html1.php).


get_avatar won't show uploaded avatar, only default gravatar

I'm using the Simple Local Avatars plugin so my bbPress forumgoers can upload their own avatars. Now, when a user logs in, I want his/her avatar to display next to the relevant links (i.e. logout, edit profile, etc.). I tried the call below but it only keeps showing the default mystery man gravatar. `<?php echo get_avatar( $current_user->user_login, 48 ); ?>` Is there something I overlooked? How can I get the user's uploaded avatar to show up?


Show the most recent post for an author on the author page

I have 6 authors in my blog page. I have profile for each of the authors. I want to show the posts of the authors dynamically under their own profile. I tried the following but it showed all posts. with this code it is showing the posts in all profiles not specific profiles. What changes should i make?               $current_author = get_query_var('author');     $author_posts=  get_posts( 'author='.$current_author->id.'&posts_per_page=1&order=DESC&orderby=post_date' );     if($author_posts){       echo '
';       foreach ($author_posts as $author_post)  {         echo '
ID).'">'.$author_post- >post_title.'
';       }       echo '
';     }      I use the following function to show the Image and description about the author               function ajaxified_function()      {      $post = get_post($_POST['post_id']);     $feat_image = get_the_post_thumbnail($post->ID);     $desc_values = get_post_custom_values("description",$post->ID);         if( is_array( $desc_values ) )         {             foreach($desc_values as $key => $value );         }     echo '
'.$feat_image.'
'.$post->post_.'
'.$post->post_title.'

'.$value.'

'.$post->post_content.'

'.$author.'
';     die();     }      Following js is which I use to show the above in a lightbox when clicking on a link                jQuery(document).ready(function (){      jQuery('#options_to_connect a').on('click',function(event){              event.preventDefault();     var post_id = jQuery(this).parent().attr('class');      jQuery.ajax({       type: "POST",                       url:  'http:www.myblog.com/wp-admin/admin-ajax.php',          data: 'action=ajaxified_function&post_id='+post_id,            success: function (msg) {                                                    jQuery('#cboxLoadedContent').html(msg);        },        error: function () {                         alert('Error');                       }         });                  });            });


How to make the excerpt_more filter apply to the actual post excerpt?

In the get_blog_excerpt() function below, the excerpt_more filter works perfectly when the post excerpt is not present, however, when the post has an excerpt, I'm not getting the "Read More" link. I understand that the_excerpt first checks to see if a post excerpt is present, which is fine, but I want the read more link applied to it too. What do I need to change in order to make the excerpt_more apply in all cases?               function get_blog_excerpt(){         add_filter('excerpt_length', 'ce4_excerpt_length');         add_filter('excerpt_more', 'ce4_excerpt_more');         return the_excerpt();     }          function ce4_excerpt_length($length) {         return 150;     }          function ce4_excerpt_more($more) {         global $post;         return '...ID) . '">Read More';     }               function get_blog_links(){         global $post;         setup_postdata($post);         $myposts = get_posts($args);echo '
';          echo '
';          foreach($myposts as $idx=>$post){ ?>
<a href="<?php the_permalink(); ?>"><?php the_title(); ?>         <?php          echo get_blog_excerpt();         echo '

';?>
         <?php } echo '

';     }      The code above is inside functions.php The code below is inside archive.php               <?php      if(is_category()){         if (get_query_var('cat') == get_category_by_slug('blog')->term_id){             get_blog_links();         }         else          {         get_category_links();         }     } ?>


Function to show random posts from a category

Hi to all I'm trying to create a function that can ECHO the excerpt of a random post from a choosen category. What I did up to now is:               <?php function $titoloslide() = {     query_posts(array('orderby' => 'rand', 'category_name' => 'testimonianze', 'showposts' => 1)); if (have_posts()) : while (have_posts()) : the_post();     "
"the_excerpt();"
"      endwhile;     endif;     wp_reset_query();};?>      Obviously... it doesn't work! Is there anyone who can help me? Thank you very much! Why i need all of this inside a function? Because I need to use it as title tag of some images and stuff like this so I can't write all my code inside title="" and I tought that a function could do the trick. I'm trying to use NivoSlider so I need to put this code as a title tag to an image to be shown. example: " title=" /> This function takes a random post from category testimonianze and shows his excerpt (I think it's easy to understan this :P The code works if I use it like this:               <?php query_posts(array('orderby' => 'rand', 'category_name' => 'testimonianze', 'showposts' => 1)); if (have_posts()) : while (have_posts()) : the_post(); ?>
<?php the_excerpt(); ?>
      <?php endwhile; ?>      <?php endif;?>      <?php wp_reset_query(); ?>      But no way to have a working version in any other way even after code corrections. Any idea or suggestions? (Maybe some prays will work too :P )


Eliminate duplicates in a foreach loop

I've created a filter for my search results that allows people to filter user searches based on their `State` from their profile. The problem I am having is that there are duplicate states showing in the drop-down list for users that have the same state. Here is the current code trying to eliminate that problem.               <div class="state">         <input type="hidden" name="search_type" value="members">         <select id="stateDrop" name="state">             <option value="name">State</option>             <?php                 $prevState = "";                  foreach($users as $user) {                     $state = get_cimyFieldValue($user->ID, 'STATE'); // Grabing their state from their profile page                          if($prevState != $state) {                         $prevState = $state;                         echo '<option value="'.$state.'">'.$state.'</option>';                     }                 }             ?>         </select>     </div>      This works great when 2 states are right after each other, but when I have something like the below, it will not eliminate the duplicates...               Not working       -California       -Washington       -California          Working       -California       -California       -Washington      What can I do differently to get the results I need and possibly sort it alphabetically? Thanks,


Check if username exist with AJAX

I've created a custom registration form for a WordPress MultiSite installation. It allows registrations of new blogs and users. I want to check with ajax if a given username is available. This is what I have so far:               add_action( 'wp_footer', 'pb_ajax_add_js' );          function pb_ajax_add_js() {          // add script to the footer     wp_enqueue_script( 'pb_ajax',         plugin_dir_url( __FILE__ ).'js/script.js',         array('jquery'), BOJ_ARM_VERSION, true     );          //Get protocol of the current page.     $protocol = isset( $_SERVER["HTTPS"]) ? 'https://' : 'http://';          // Display the admin-ajax.php using the same protocol as the current page.     $params = array(       'ajaxurl' => admin_url( 'admin-ajax.php', $protocol )     );     wp_localize_script( 'pb_ajax', 'pb_ajax', $params );     }      Server side request handling:               // Ajax request handling.     add_action('wp_ajax_nopriv_boj_arm_ajax', 'pb_check_username');     add_action('wp_ajax_boj_arm_ajax', 'pb_check_username');          function pb_check_username() {     $username = $_REQUEST['usr'];     echo $username;          die();     }      And jQuery script(note: in this version, validation is after click link)               (function($) {         $('.check-username').click(function(){             var link = this;             $(link).html('sprawdzanie...');             // href="' . get_permalink() . "#more-{$post->ID}"             var usr = $("#site-addres-input").attr('value');                  var data = {                 action: 'boj_arm_ajax',                 usr: usr             };                  $.get(boj_arm.ajaxurl, data, function(data){                 $(link).after(data).remove();             });             return false;         });     })(jQuery);      Script isn't complete. It Must check if the username exists, and return true or false. Can You help me Please?


Correct attachment size

I am trying using Really Simple slideshow with Wordpress and I am having issue while trying to retrive the correct image size for the slideshow. I am able to retrieve the first image without problem using the following code:               <?php if ( $attachments ) {         $first_image = array_slice($attachments, 0, 1);         $first_thumb = wp_get_attachment_url( $first_image[0]->ID, 'blog-thumb', false );         ?>         <img src="<?= $first_thumb; ?>" alt="" title="" />      However, I am using the following code to retrieve the rest of the images:               <?php foreach ($attachments as $attachment) { ?>
<a href="<?= wp_get_attachment_url( $attachment->ID, 'blog-thumb', false ); ?>">
     <?php } ?>      and I am able to retrieve the images, but the original version of the images, not the "blog-thumb" dimensions. I am not sure what I'm doing wrong here... Here's how I am retrieving attachments:                       <?php if ( $post->post_type == 'post' && $post->post_status == 'publish' ) {                     $attachments = get_posts( array(                         'post_type' => 'attachment',                         'posts_per_page' => -1,                         'post_parent' => $post->ID,                         'exclude'     => get_post_thumbnail_id(),                         'orderby'           => 'menu_order',                         'order'           => 'ASC'                            ) );             ?>      I am also adding the whole code, so you guys can check the whole picture of what's going on:                       <?php if ( $post->post_type == 'post' && $post->post_status == 'publish' ) {                     $attachments = get_posts( array(                         'post_type' => 'attachment',                         'posts_per_page' => -1,                         'post_parent' => $post->ID,                         'exclude'     => get_post_thumbnail_id(),                         'orderby'           => 'menu_order',                         'order'           => 'ASC'                            ) );             ?>                    <?php if ( $attachments ) {                  $first_image = array_slice($attachments, 0, 1);                 $first_thumb = wp_get_attachment_image_src( $first_image[0]->ID, 'blog-thumb', false );                    ?>                      <div id="post-<?php the_ID(); ?>" <?php post_class() ?>>
                      <div id="slideshow<?php the_ID(); ?>" class="rs-slideshow">
                         <img src="<?php echo '' . $first_thumb[0] . ''; ?>" alt="" title="" />

                     <?php foreach ($attachments as $attachment) { ?>
<a href="<?= wp_get_attachment_image( $attachment->ID, 'blog-thumb'); ?>">
                          <?php } ?>

                                                        <?php } ?>             <?php } ?>
       As mentioned, I am having difficulties while trying to retrieve the correct image size inside the list, the code to retrieve the first image works like a charm. Thanks for your help!


How to add text to comment form #content textarea?

I have a plugin that does validation on user submitted comments. When validation fails, I want to redirect them back to the comment form, and have their comment still appear in the comment box, so they don't have to type it again. How can I add custom content to the comment form #content textarea?


"update_post_meta" not working in "wp_insert_post_data" hook

I have created the following hook in my functions.php               add_filter('wp_insert_post_data', 'ad_change_title');     function ad_change_title($data)     {         if($data['post_type'] != 'ad_listing')             return $data;         if(!is_admin())             return $data;              global $post;            update_post_meta((int)$post->ID, 'cp_entitle_englishel', (string)$_POST['qtrans_title_en']);              return $data;     }      but the "update_post_meta" part. I have checked the post_id, cp_entitle_englishel, qtrans_title_en values, and they are valid. Any suggestions?


How to add Listbox / Select dropdown for shortcodes in WP 3.9 beta2 using TinyMCE?

I need a list-box for shortcodes in visual editor. With WP 3.8 I got it working like :                           createControl : function(n, cm) {                 switch (n) {              case 'example':                 var mlb = cm.createListBox('example', {                     title : 'Example Shortcode',                     onselect : function(v) {                        tinyMCE.activeEditor.selection.setContent(v);                      }                 });                      // Add some values to the list box         mlb.add('Shortcode', '[shortcode]Some Content Here[/shortcode]');              // Return the new listbox instance                 return mlb;         }      But these are not showing up in WP 3.9beta2. How to get it working? Thanks in Advance.


Force Plugin to English Translation

Here's my thing: I'm using a plugin that has multilang capabilities. The point is that the language translation in my country lang is very bad and it makes more complex than simpler my work. :D. So is there a way to force a plugin to not to use multilanguage and be showed, at least, in English?


Why do I get Fatal error: Call to undefined function get_most_recent_post_of_user()?

I am using WordPress 3.4.2. The codex doesn't say anything about this function being depreciated: http://codex.wordpress.org/Function_Reference/get_most_recent_post_of_user


Setting default category for display

The default category for the page News is news. But I want the _page_ news to show all posts. Not just _news_ posts. All posts, includes news posts and engineering posts. When you hit the main site is http://www.papermepress.com, it does indeed do this, as you can verify. But when you go to News it it only shows the news category. How do I fix so that it show both?


How to customize taxonomy archive template files for subterms?

I have a taxonomy called "location" where I have the term "Asia" and the sub- term "Thailand". Now I created the taxonomy archive template file according to the Wordpress Codex, which is working in the following format:   * taxonomy-$taxonomy-$term.php --> taxonomy-location-Asia.php Is there a possibility to create a template file also for the subterm, as following:   * taxonomy-$taxonomy-$term-$subterm.php --> taxonomy-location-Asia-Thailand.php


404 when using pagination in a category

I always struggle with pagination in wordpress. I really wish that was a definitive guide to wordpress rewrite rules. I have a site setup this way:   1. permalink custom structure: /%category%/%postname%/   2. I have a page named "blog"   3. I have the reading settings making the page "blog" the Posts Page.   4. I'm only using the index.php to list all posts   5. No custom queries, just the regular loop Everything works beautifully as long as I am viewing all posts. No issue with pagination here.               All posts -> domain.com/blog/ (works)     All posts page 2 -> domain.com/blog/page/2/ (works)      However as soon as click in a category, let's say "news", and try to see the next page I get a 404.               News -> domain.com/news (works)     News page 2 -> domain.com/news/page/2 (doesn't work)      Nothing atypical in the .htaccess file, and no other custom rewrite rules are present.               # BEGIN WordPress     <IfModule mod_rewrite.c>     RewriteEngine On     RewriteBase /     RewriteRule ^index\.php$ - [L]     RewriteCond %{REQUEST_FILENAME} !-f     RewriteCond %{REQUEST_FILENAME} !-d     RewriteRule . /index.php [L]     </IfModule>          # END WordPress      So what I am doing wrong? This is pretty standard wordpress setup. I would also appreciate if someone could point me out to some awesome guide on wordpress rewrite rules. I have read a lot about them here, but there are so many different cases, I just want to understand how it works. **Update:** I ended up doing the following: Setting the permalinks to /date/post tile/ format Setting the category base to /category/ This way pagination works for all posts and posts under a category. In my opinion it's not ideal because I can only get it to work if I have a category base, and the category base needs to be a fixed name. So now I have:               All posts -> domain.com/blog/page/2     Category posts -> domain.com/category/category_name/page/2      Pagination works in both cases.


Wordpress edit.php category filter to show only posts from direct category and not posts from it child category

On the admin edit.php page, when i filter the posts by a particular category (using the built in dropdown) it shows all the posts related to that category, and all the posts that are 'under' its child categories. How can i change this functionality, so when i filter by a category it only shows posts from that category only, no child categories posts. Will appreciate any help, as i couldnt find any info about this online. thank you.


How to save posts position on homepage after random function?

I use the following code to display a random post on a homepage:               <?php  global $query_string; query_posts($query_string . "&orderby=rand"); ?>      When the page is refresh posts positions are reversed. Is it possible to retain posts positions for a while? I want that posts positions are change once an hour.


Tags outside the loop

I want to display the tags of the posts in my main page. I used:               global $post;     the_tags();      But it's only showing up for my FIRST page.


Search in particular category in wordpress

I am currently using the JSON API to get the data from wordpress http://wordpress.org/plugins/json-api/other_notes/ The plugin helps to retrieve the wordpress post data in JSON format I notice that I can get the post within some category               http://www.test.com/?json=get_category_posts&id=9      And I can also search the post               http://www.test.com/?json=get_search_results&search=keywords      However, are there anyway to implement search within some category? Thanks Also if JSON API is not applicable , are there other approach, I have thought of using wp_query, but do I need to provide the login info if I use the WP sdk in PHP / android? Thanks


What are the Entry classes for?

I've come across a few tutorials that make reference to `entry` classes; `entry-meta` and `entry-content`. Are these classes created by Wordpress or classes I should be creating? And what are they intended for?


Create a Theme Option with Google Analytics

I'd like to create a theme options page just to put a text area so my clients can add the Google Analytics code in the WordPress panel. I have looking for this, but I can't find anything specific just for GA code.


Is there a plugin for messaging users as an admin?

Does anyone know of a simple plugin that allows an administrator to send messages to users that have accounts, and allow those same users to reply to the message. I found one here, but the problem is that it allows any user to send any user messages. Only the admin should be able to send messages. Basically the idea here is to allow the admin to send messages to customers by giving updates as far as their services. Any ideas?


Search child pages from a specific page parent

Anyone know of an easy way to alter the default WordPress search from searching ALL pages, to searching only child pages from a specific page parent? I know of the filter you can use to alter whether pages or posts are searched:               function SearchFilter($query) {     if ($query->is_search) {         $query->set('post_type', 'page');     }     return $query;     }     add_filter('pre_get_posts','SearchFilter');      Maybe there is a way to add further information here to specify a particular page parent?


Buddypress registration page redirection loop errors after adding if(!is_user_logged_in)

I'm running WordPress Multisite install with BuddyPress (WP 3.9, BP 1.9). I'm using the code below to make the main website protected from not-logged-in users, and let them to visit only the landingpage, registration and activation pages. Registration and activation pages are native BuddyPress pages.               <?php     function shield() {         if( !is_user_logged_in() ) {              if( !is_page( array( 'landingpage', 'registration', 'activation') ) ) {                 wp_redirect( 'landingpage' );                  exit();              }         }     }     add_filter('get_header','shield',1);     ?>      The code works perfectly, except that it leads to redirection loop errors on registration and activation pages. I think it's because BuddyPress has similar functions for this kind of pages for logged in users - to redirect them away from those two. How to fix it? I would like to protect part of the site, but still allow registration. PS: To prevent questions about login - it's on landingpage.


How to wrap posts into divs?

Does anyone know how I can turn this:
              <?php query_posts('showposts=4&cat=11'); ?>         <?php if (have_posts()) : ?>                  <?php while (have_posts()) : the_post(); ?>

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

         1         2         3         4
          Prev     Next
      Into:

Welcome to the First Slide!

We hope you enjoy the jFlow Plus Slider - a light-weight slider for your web design needs. Read More!

Hey you made it to the Second Slide!

We Know you enjoy this plugin... it's not too hard to implement, right? Read More!

Woah You're on the Third Slide

You've completed quiet the journey! All the way from slide 1 to slide 3... congratulations! Read More!

      I need to wrap each post preview in to divs so jFlow can then organise them into slides like http://dre.im/how-to-create-a-jquery-carousel-with-wordpress- posts/ Thanks,


jQuery AJAX form validation

I am trying to create a custom login page for my site, namely `http://localhost/site/login`, the problem I am running into now is that when the user tries to log in and enters the wrong username or password, they are redirected to the `wp-login.php` page, which is problematic, as you can imagine, so I would like to add AJAX form validation to my custom form, but the problem is that I am unsure of how to go about this the best way. How can I validate a user using jQuery AJAX? This is what I have thus far: jQuery:               $('#selector').live('click', function(){         $.post('http://localhost/site/wp-login.php', { action: 'login' }, function(data){             console.log(data);         });     });      I do know that this is not the proper way of going about it, it is just to give you guys an idea of what I am trying to do. What would be the best way to achieve the desired effect? Thanks in advance!


Custom Post Type Plugin: Where Do I Put The Template?

I'm writing a custom post type plugin. Part of it I'm outputting to the template via shortcodes. But other parts need a custom post template, and I figured out how to use the template hierarchy for CPT's. But the custom template is in the theme, and I'm thinking the plugin should be self- contained, at least to start with. So what's the best practice here? How do we include template files in a CPT plugin? Can you point me to especially good examples of how this is done? Thanks for your help.


Breadcrumbs for Single Image page

As we know in different post we can use some image which we uploaded. This image can be used in many post but it has only one PARENT post. My question is how to track from which post the user came from. Example Home > post 1 > img 2   Home > post 3 ? img 2 If the image has only one parent post how to find out from which post the user is coming from? Edit: I think it will be better if I send the parent post Id. To generate the url I use get_attachment_link() . Do you know how I can add additional parameter in the generated link. Because I cannot just add ?parent=14 , because of the different permalinks which Wordpress can use. Thank you


Custom walker nav - Add sequential number as class

I'm getting to grips with the walker at the moment, but i need some assistance in getting my desired effect. My walker function looks like:               class ik_walker extends Walker_Nav_Menu{         //start of the sub menu wrap         function start_lvl(&$output, $depth) {             $output .= '
';         }         //end of the sub menu wrap         function end_lvl(&$output, $depth) {             $output .= '
                 <button id="menu" class="menu-button" type="button" role="button" aria-label="Menu Toggle">                                    </button>
';         }         //add the description to the menu item output         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 .= $args->link_before . apply_filters( 'the_title', $item->title, $item->ID ) . $args->link_after;             if(strlen($item->description)>2){ $item_output .= '
' . $item->description . ''; }             $item_output .= '';             $item_output .= $args->after;             $output .= apply_filters( 'walker_nav_menu_start_el', $item_output, $item, $depth, $args );         }     }      What I need is for each `a` within the `li` of the nav, to have it's own class that start with `c` then a number - starting at 1.                               I then need a `span` after each a, with a class when I can specify somewhere, if possible? I know how to get the `span` in there, but I can't figure out from my searches if you can indeed set specific individual classes as I need to do things like:                     Any help would be VERY much appreciated.


How can I display/hide certain content based on a Theme Option field?

I'm building a Theme Options page for my theme, and I've managed to get most of it working fine. But now I'm trying to show and hide certain parts in my theme based on a simple check box. An example: > Show featured content slider ? - Yes - No When the user selects yes I want to enable the following code in a certain template of my theme:               <?php locate_template( array( 'includes/slider.php'), true ) ?>      So how can I wrap this code so that it only shows when Yes is clicked? I think it's some kind of conditional statement but I have now idea how to approach this. Since I can't write php I need some help with this :) The name of the option is called bpslick_featured. Thanks in advance!


How to edit theme functions file to modify pagination?

By default, when adding `<!--nextpage-->`, the following links are displayed: Pages: 1 2 I need to replace "Pages:" with a graphic arrow which links back to the previous page, and append a graphic arrow to the end of the links that links to the next page. I'm guessing there's a way to do this in the functions file?


Displaying Posts from Custom Post Types

I'm trying to display posts from regular and custom post types :
        <?php          // the query         $the_query = new WP_Query( 'cat=-4,-142,-143,-144' ); ?>              <?php if ( $the_query->have_posts() ) : ?>                                     <?php while ( $the_query->have_posts() ) : $the_query->the_post(); ?>
<a href="<?php the_permalink() ?>">

<?php the_post_thumbnail('homepoststhumbnail'); ?>
<?php the_title(); ?>

 <?php the_excerpt(__('(more…)')); ?><?php the_field('questions'); ?>

             <?php endwhile; ?>                                                 <?php wp_reset_postdata(); ?>                  <?php else:  ?>
<?php _e( 'Sorry, no posts matched your criteria.' ); ?>
             <?php endif; ?>


How to insert a writing panel between the title and the page content?

I want a writing panel for a custom field called 'Sub-title' and would like it to appear in its logical place in the Page editor (that is, between the title and the Page content). Is that possible? I would like to avoid having to create a custom post type, since a Page + custom fields is all I really need.


How to prevent further updates of custom meta when using actions to set one meta based on another

I'm using rilwis' Meta Box plugin (see https://github.com/rilwis/meta-box) to add custom meta boxes to a custom post type. I then want to populate one piece of meta data based on the value of another. I'm doing this using the updated_post_meta action hook using some code similar to the following:               add_action( "updated_post_meta", "my_generate_extra_meta", 10, 4 );     add_action( "added_post_meta", "my_generate_extra_meta", 10, 4 );          function my_generate_extra_meta( $meta_id, $object_id, $meta_key, $meta_value ) {         // Only do this for resources post type             if (get_post_type($object_id) == 'resource') {             // Only do this if we're saving the _my_resource_meta_1 data             if ($meta_key == '_my_resource_meta_1') {                    $new_meta = do_some_processing_of( $meta_value );                    update_post_meta( $object_id, '_my_resource_meta_2', $new_meta );             }         }     }      But this seems to happen before the _my_resource_meta_2 is saved from the data submitted. So the value I save using update_post_meta gets overwritten by the submitted value (or deleted if the meta value was empty). What I want to know is, what is the best way to prevent subsequent updates of `_my_resource_meta_2` here? The best way I've found so far is to do something like:               $_POST['_my_resource_meta_2'] = $new_meta;     $_REQUEST['_my_resource_meta_2'] = $new_meta;      at the end of the action. But this feels like a nasty hack, and I guess you still need to do the update_post_meta in case the _my_resource_meta_2 is updated first, which means you do the update twice. Can anyone think of other solutions to this problem? Is there a better way? Thanks


Issues with the excerpt (wordcount/HTML/images)

Struggling here with the excerpt and options for it.   _(NOT looking for a plugin and not extracting from the content, we add seperate excerpt content)_   We want to have an excerpt limited to a max. amount of words, using HTML code when needed and showing an image. The theme we use didn't have the excerpt option so we add following:               <?php the_excerpt(); ?>       in the template. It now shows the excerpt, but it does not limit the output. (characters nor wordcount) Our next step is to solve the length "issue", I thought I was being being smart and used this snippet in functions.php (from codex itself):               function custom_excerpt_length( $length ) {     return 50;     }     add_filter( 'excerpt_length', 'custom_excerpt_length', 999 );      Didn't do anything, maybe I'm overlooking something?! Already feeling dumb but still going on.. So I tried following code in the template itself. (replaced `the_excerpt();` and taken out the codex function).               <?php echo wp_trim_words( get_the_excerpt() , 50, "... read more.." ); ?>      Nice seems to work eh..not as thought, this code is limiting words (as wanted) to max 50 words but stripping html code and not allowing images...argh. So my question is: What code can I use which is able to limit the excerpt (to max Ie. 50 words), allows HTML and allows me to display an image and showing the ...read more link for our excerpt. _Note: tags aint as they should be because my reputation is not high enough.._


Removing orphan users in WordPress Multisite

I've set up WP Multisite and wrote a function to daily delete all the blogs apart from one. Now when you use the wpmu_delete_blog() function the blogs are removed however their users remain, and are not associated to any site. I want to get all those users and remove them straight after deleting the blogs. All the users I create are given the role 'demouser'. How can I do this?


How can I convert a Custom Taxonomy to a Custom Post Type?

I've not been able to find any information on this - a bit of an unusual request. I've decided I'm best off creating a Custom Post Type to handle my database of Artists and Albums on my music site, currently stored as a Custom Taxonomy. There's clearly more flexibility in CPTs than Taxonomies. I'm going to use Scribu's Posts2Posts plugin to connect my current CPTs (Videos, Lyrics, Reviews etc) with the Artists and Albums CPTs. Since I have a large-ish quantity in my Artists Taxonomy including lots of meta data, I'm looking for a way to carry the data to a CPT (and corresponding Meta Fields) - too much to do by hand. Has anyone else got this issue, and has anyone got a solution? **UPDATE** : I'm writing a function that I hope will achieve what I need. I'm a bit stuck however.               function make_posts_from_taxonomy($taxonomy, $post_type) {     // Get all Taxonomy     $args = array(     'parent' => 0     );          $taxonomy = 'hhie_artists';     $post_type = 'hhie_artists';          $terms = get_terms( $taxonomy, $args);          foreach ($terms as $term) {         get_term_by( 'slug', get_query_var( 'term' ), get_query_var( 'taxonomy' ) );         $id = $term->ID;         $name = $term->name; //Title         $slug = $term->slug; //Slug         $description = $term->description; //Description          $new_post = array(               'post_title' => $name,             'post_content' => $description,             'post_name' => $slug,             'post_type' => $post_type,         );         //Insert post         wp_insert_post ($new_post);              } //End foreach          } //End function      This has worked. I've been able to create the new CPT posts. Remaining issues:   1. I can't work out how to call all the metadata associated with each `$term`.   2. How can I then pass each piece of metadata into each post?


Hooking Into Widget Output Loop

When wordpress sidebar outputs any particular `registered sidebar` it loop through all widgets that assigned through it and outputs it (i guess). Is is possible to hook into the loop and add some content, say **I want to add a ad code every three widgets**. **What I have tried?** Unable to find any leads. Tried to search on wordpress source code but not sure what to search. searching `widget` or `widget loop` doesn't help.


Gallery - custom html for inserting images

I have gallery (I'm using Cleaner Gallery plugin) with many images. I want to add asynchronous image loading with jQuery (I'm using JAIL to do that). But to use this JAIL plugin I need to change gallery output (need to use data-href tag with link to image). How can I do that? I've been trying to edit cleaner- gallery.php inside my plugin directory but id does not change anything! @edit: Changing cleaner-gallery.php doesn't give wanted output. I don't know why but maybe I have to edit some function from wp-includes/media.php? Do you know what function should I overwrite?


Multi-Site Plugin Activated (Not Network-Activated), What Happens?

Hey guys. I am working on a plugin and I am trying to figure out all of the possible scenarios in which the plugin can be used. I am aware of the new Multi-Site feature. If the plugin is network activated, then it will basically be forced upon all of the blogs within that website. What happens if the plugin is just activated, but not network activated? Does this mean that **it's giving** the user the choice of enabling it? In other words: does activating the plugin mean it will appear in each blog admin's plugin list, allowing them to enable it or not? If this is true, then that means that if the plugin is _not_ activated, then it won't show up in each blog admin's plugin list, correct? So the scenarios are:   1. network activated => forced upon all users   2. activated => each user now has the option to enable it or not   3. disabled => the user won't even see it in their plugin list Is this correct? Thanks, I would really appreciate any help.


One comment per user per post

How can i disable the comment form, if the user is already submitted a comment for the specified post? I am using this now, but this is only good for 1 post / user / website.               <?php     global $current_user;     $args = array('user_id' => $current_user->ID);     $usercomment = get_comments($args);     if(count($usercomment) >= 1){         echo 'disabled';     } else {         comment_form();     }     ?>


Can't get metabox value (a url) returned using WPAlchemy

I'm using the WP Alchemy class to add custom metaboxes to templates in the admin panel and pull results from those metaboxes into the theme front-end. Here is the relevant code in content-link.php (in the loop - in Twenty Eleven Theme).               <a href="<?php display_url_info(); ?>">         Right now the link shows just the permalink instead of the url in the metabox. If I hardcode a url in there instead, the custom url shows up on the post. I've verified it being properly stored under _custom_meta in the db (and successfully implemented metabox display in other templates. Here's the value in the db:               a:1:{s:5:"links";a:1:{i:0;a:2:{s:6:"domain";s:25:"http://stackexchange.com/";s:13:"post_link_url";s:48:"http://wordpress.stackexchange.com/questions/ask";}}}      Here's my plugin file:               $basic_metabox = new WPAlchemy_MetaBox (              array (         'id' => '_custom_meta',         'title' => 'Basic Meta',         'template' => ABSPATH . 'wp-content/themes/beernews-child-theme/custom/basic-meta.php',         'types' => array('post','link')         )          );             add_filter('beernews-child-theme_post', 'display_url_info');          function display_url_info() {              // usually needed         global $basic_metabox;              // get the meta data for the current post         $basic_metabox->the_meta(); ?>              <?php if ($basic_metabox->get_the_value('post_link_url')) {              echo $basic_metabox->the_value('post_link_url');          }          }


Show current page featured image in sidebar

How do I call the current post's featured image in the sidebar? and if there is none, then a backup image?


How to prevent a post from being deleted?

For auditing issue, I only want a post can be trashed, but not deleted - for all users. So I have a plugin like               add_action('before_delete_post', function($id) {             wp_die(0);         });      But seems not all delete action are ajax, so it will be show a black screen with return an error page with result "0" Feature wise the above code is ok, but are there any better way?


filter custom field values $min $max

The user needs to query posts by entering a $minPrice, $maxPrice and a category value. Here is my query which returns no results:               function result() {              $result = array(             'cat'        => '10,17,18,13',             'meta_query' => array(                 array(                     'key' => 'filter',                     'value' => array(  $min, $max ),                     'compare' => 'BETWEEN',                     'type' => 'numeric',                 )             ),         );              // The Query         $result = new WP_Query($result);         // The Loop         while ( $result->have_posts() ) : $result->the_post();             include (ROCKABLE_INCLUDES . 'houseLandPackage-post-excerpt.php');              endwhile;         // Reset Post Data         wp_reset_postdata();     }      So problem is im not getting any results back when i use $min and $max as the meta query values. I will get the correct "min - max" results back when i use "300" and "400" however. Here is what the url looks like when the query is submitted: `http://localhost:8888/provgreen/?mode=advanced&min=3000&max=4000&s=+&cat=17&sa=Submit+Query` This thread states that the below code is needed for my query to work.: http://wordpress.org/support/topic/searching-for-posts-with-custom-data-in-a- numeric-range-price?replies=4 Any help or pointers much appreciated. Here is the code i have in search.php               <?php         $selectedCategory='';         $selectedPrice='';         $newsearch='';              $newsearch=$query_string;         $newsearch.="&posts_per_page=8";         $newsearch.="&post_type=post";              if(isset($_GET["category"]) && $_GET["category"]!='') {             $selectedCategory=$_GET["category"];             $selectedCatId = get_term_by( 'slug', $selectedCategory, 'category' );             $selectedCatId = $selectedCatId->term_id;             $newsearch.="&cat=".$selectedCatId;         }              if(isset($_GET["filter"])&& $_GET["filter"]!='') {             $selectedPrice=$_GET["filter"];             $parts = explode("-",$selectedPrice);             $min = $parts[0];             $max = $parts[1];                  mam_custom_field_range('filter',$min,$max);         }              query_posts($newsearch);     ?>      this is in function.php               // Define the function that will create the join string     function mam_custom_field_range($filter='',$min=false,$max=false) {       global $mam_global_join,$wpdb;       if ($filter && ($min !== false || $max !== false)) {         $mam_global_join =           " JOIN $wpdb->postmeta acfr_$filter ON           ( $wpdb->posts.ID = acfr_$filter.post_id             AND acfr_$filter.meta_key = '$filter'";         if ($min !== false) $mam_global_join .= " AND acfr_$filter.meta_value >= $min";         if ($max !== false) $mam_global_join .= " AND acfr_$filter.meta_value <= $max";         $mam_global_join .= ')';       }     }     // Define the join filter function     function mam_posts_join ($join) {        global $mam_global_join;        if ($mam_global_join) $join .= $mam_global_join;        return $join;     }     // Add the filter to the hooks     add_filter('posts_join','mam_posts_join');      im using `<?php wp_dropdown_categories(); ?>` and some input fields for the min, max values in form.php


some things in child theme css not overriding parent

I am writing a child theme with Blogolife as its parent. (I'm doing it on a local server, so can't show you the actual page). I have made several changes to the CSS in the child theme's "style.css" file. Up until this point, all those changes showed up fine. However, I am now trying to get rid of a quotation mark image that the parent theme uses after a blockquote. Here is how the CSS appears in the PARENT style.css:               .quote blockquote {             background: #f8f8f8 url(images/q.png) bottom right no-repeat;             font-size: 19px;             font-style: italic;             line-height: 35px;             padding: 10px 20px 20px 10px;     }            blockquote {             background: #f8f8f8 url(images/q.png) bottom right no-repeat;             font-size: 19px;             font-style: italic;             line-height: 35px;             padding: 10px 20px 20px 10px;      }      I copied these portions into the CHILD style.css, and deleted the two "background" lines, which are the only places the q.png image is called (I checked). Why does the image still show up on my page? (I'm doing the development on a local server, and yes, I saved the child's style.css file ;) ) I also refreshed the cache. When I examine the blockquote element with Chrome Developer tools, the background image still appears in the CSS. I even tried adding a new background color to the blockquote element in my child's CSS using 'background-color:', and THAT shows up, but the stupid image is still there! Why is everything else in my child's style.css overriding the parent, but the deletion of the call to the image is not? Seems kind of arbitrary. Thanks.


Excerpt Now Showing on the Post Page

I followed the excepted answer to this question (Twenty Eleven home page show only excerpt) to a tee. And it worked just like I hoped for the _main_ page. But now when I click on the blog post and go to the _post's_ page, it also only has the excerpt. How can I make this change so that the excerpt shows only on the main page, but the full blog article on the actual post's page? My blog is located at http://sqlsalt.com for reference.


Filter 5 latest post from the loop

Recently I made a theme for my wordpress blog. Now I wanna filter(remove) my 5 latest post from the main page(index.php) and show them into slider. Now my 5 latest posts are showing in the first page and slider simultaneously :( Pleas help Thanks # Update: Thanks for your reply. I couldn't solve my problem. this is my index.php source:               <?php get_header() ?>

                 <?php if (function_exists('dynamic_sidebar') && dynamic_sidebar('sidebar-right')) : else : ?>                 <?php endif; ?>

                     <?php echo get_touchcarousel(2); ?>

Latest News

                         <?php if(have_posts()) : ?>                             <?php while (have_posts()) : the_post(); ?>                                 <article id="etc" class="post<?php the_category_unlinked(' '); ?>">

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

                                         <?php the_excerpt(); ?>                                         <?php the_post_thumbnail(array(260,140), array ()); ?>

                                  <?php endwhile; ?>                         <?php endif; ?>
                     <?php if(function_exists('wp_simple_pagination')) {                         wp_simple_pagination();                     } ?>

                     <?php if (function_exists('dynamic_sidebar') && dynamic_sidebar('sidebar-left')) : else : ?>                     <?php endif; ?>

         <?php get_footer(); ?>

     <?php get_footer(); ?>      Would you please help me?


Create a new page for each form selection

I have a got custom page template which displays a drop down box that has list of countries.A user selects the box and clicks sumbit.Page then then displays the relevant details for that country .IT has also displays discription which is stored in a the database. The following sql queries are used to display data.                           $id = mysql_escape_string($_GET['id']);             $row_RsInt = $wpdb->get_results("SELECT * FROM wp_num_countries",ARRAY_A);             $totalRows_RsInt = count($row_RsInt);              <form id="formITFS" name="formITFS" method="post" action="">                                     <select class="itfsDrp" id="country" name="country">                                         <?php                                         foreach($row_RsInt as $row_RsInts){                                             $selected = $_POST['country'] == $row_RsInts['countryID'] ? 'selected="selected"' : '';                                             echo '<option value="'.$row_RsInts['countryID'].'" '.$selected.'>'.$row_RsInts['country'].'</option>';                                         }                                         ?>                                                                 </select><input name="imageField2" id="imageField2" src="http://xxxxxxxx/wp-content/themes/responsive/images/rates.png" type="image">                  </form>          <?php         if($_POST['country'])             $country_id = $_POST['country'];         else             $country_id = 1;              $countryinfo = $wpdb->get_row("SELECT * FROM wp_num_countries WHERE countryID = ".$country_id);         ?>           <form action="" method="POST" name="form" id="formn">         <div id="ITFSworks">          <?php echo $countryinfo->desc; ?>      I want to create a seperate page for each country .The page will contain more text.When a user goes to this new page he gets the same layout as the custom page template. So if my perma link is France-page , i want the drop down to be pre-selected with france and info of france dispayed under and so forth.. How can i best achieve this. I am using the latest wordpress. Whats the best way to do this.