Edit post meta with checkboxes on front end

I'm trying to build an interface so that two custom fields for a custom post type can be edited on the front end with checkboxes. I'd like to display empty checkboxes if neither of those the fields have values, and allow a user to check one or both boxes, and have the corresponding fields be set to true (or just have some value, I suppose - not sure if a postmeta can have a boolean value) (preferably via AJAX). My first thought is to use Scribu's Front End Editor plugin, although it obviously doesn't solve this use case without some tweaking. However, I figured I'd ask to see if anyone else has done something like this before, or has suggestions on how specifically to implement the FEE plugin to do this (or if I should look elsewhere). Edit to expand: this is going on a page listing multiple posts, so I'm trying to figure out a way to make this work for more than just one post on a page. Here's what the page looks like right now: ![enter image description here](http://i.stack.imgur.com/KbJgu.png) And here's the markup for that table:

                             Date/Time	                             Job ID	                             Customer Name	                             File Size	                             Details	                             Download	                             Scheduled	                             Completed

                             8/8/12 1:12pm	                             28	                             Selina Kyle	                             filesize	                             Details	                             Download File	                             <input type="checkbox" name="28-scheduled"  />	                              <input type="checkbox" name="28-completed"  />	                              <input type="hidden" name="post_id" value="28" />

                             8/8/12 1:06pm	                             26	                             Jim Gordon	                             filesize	                             Details	                             Download File	                             <input type="checkbox" name="26-scheduled"  />	                              <input type="checkbox" name="26-completed"  />	                              <input type="hidden" name="post_id" value="26" />

                             8/8/12 1:05pm	                             25	                             Lucius Fox	                             filesize	                             Details	                             Download File	                             <input type="checkbox" name="25-scheduled"  />	                              <input type="checkbox" name="25-completed"  />	                              <input type="hidden" name="post_id" value="25" />

                             8/8/12 12:51pm	                             22	                             Bruce Wayne	                             filesize	                             Details	                             Download File	                             <input type="checkbox" name="22-scheduled"  />	                              <input type="checkbox" name="22-completed"  />	                              <input type="hidden" name="post_id" value="22" />


How can I make gallery slideshow width fit to picture width?

I am using WordPress 3.8 and I want to make gallery width to fit image width.How can I do that? Currently it look like this:   ![enter image description here](http://i.stack.imgur.com/2Mb0R.png) I want it look like this:   ![enter image description here](http://i.stack.imgur.com/EXoH1.png)


Does a query executed through wpdb class get cached?

I am not sure how WordPress cache the queries. I had the impression that whenever I execute a query through wpdb class, it gets cached. For example, on codex under Select a Row and Select a Var, it says the whole query is cached for later use. And I think which means if more data is requested in another query, partials or full results of which are already in wpdb cache, then those are used and a query doesn't happen(in case of full results already in cache). Am I correct in understanding? I was trying something and I found that I can't use the cache. For reference, I was listing the recent comments the current user has made. I used `get_comments()` but since it only has post id in the results, I used `get_the_title()` inside the loop for displaying them. Obviously this is expensive in terms of query, so I though I can cache the required rows of post table by querying them beforehand so that `get_the_title()` does no actual query. I did something like               $query = implode( ' OR ID = ', $collect_post_ids );     $query = 'SELECT * FROM '.$wpdb->prefix.'posts WHERE ID = '.$query.';';     $wpdb->get_results( $query ); // just cache it      but that didn't help. `get_the_title()` is still doing queries. Most likely its me who has misunderstood how WP Cache works. So where I am wrong? Here is the full code for reference - http://ashfame.pastebin.com/BpxjHiQr


Add SideBar/Widgets Just Below the Post

I have created and registered side bar in function.php and using it another place. It's working fine. Now I like to use it just below the post. I have installed some plugins -Bookmarks, related post...etc. They are also coming just below post. I want to show first the sidebar then the plugins. If I put code just after               the_content();       It appears after plugins, but I have to show before plugins. Let me know how to do.


Hide price & title in store thumbnail dispay?

I'm setting up a WooCommerce site to sell shirts. I have the front page (and the "Store" page" set up to show a grid of thumbnails of the shirt designs. Each item has the price and the title of the design under it by default. I want to "turn off" showing the title and the price in the store view. I _DO_ want them to appear on the individual product page, after a user clicks on a thubnail to go to the product page. Since it is a shirt site, I plan to keep uniform pricing so there is no need to have the same $17.95 price showing up under every shirt, and the title isn't really needed since they can read the graphic on the shirts. So, any idea if this is possible? Where would I go to turn this feature off? I'm running the Rustik theme using WooCommerce. Thanks!


Ajax for subscibers not working

I have a very simple AJAX function that works fine when logged in as admin, but when logged in as a subscriber the call to admin-ajax.php returns a html page with the header and footer of my theme, and that's it. By doing some wolf fencing I've tracked it down to line 37 of admin-ajax.php `do_action( 'admin_init' );`. It gets there and just returns.


Wordpress 3.0 Multisite - Child sites and backends appearing blank

I've just installed wordpress on our Rackspace server - I've set wordpress up for Multisite as I have done many times before. The main wordpress site at the root functions fine - however when I add a new site and click on either 'backend' or 'visit' I get 'page not found'. Pages in the main site seem to work fine with the default permalink settings but not custom such as /%category%/%postname%/ I think this must be a server issue but am a bit stumped. Any suggestions appreciated!


Custom terms in custom category taxonomy

I have a Custom Post Type called 'directory'. I have a custom category taxonomy assigned to the post type called 'directories'. This custom taxonomy has several custom terms (e.g. one is 'art supplies' (slug is 'art- supplies')). I can get all my custom taxonomy terms to list out to the screen as links but I can't find a way that when one of the custom term links is clicked to show all posts assigned to that term. Is there a way to do this and if so, how would I go about it? Thanks for your help. Kev


functions.php conditional output for a single plugin

hope I've asked this correctly. Bizarre situation. I have some non-breaking spaces in my titles for typography reasons. They are added automatically where required in place of normal spaces by the following function...               // stop brackets in titles appearing on own line     function clean_orphan_titles($content){          $array = array (             '{ ' => '{ ',             ' }' => ' }'          );          $content = strtr($content, $array);          return $content;          }          add_filter('the_title', 'clean_orphan_titles');      The problem I have is that one plugin doesn't like this - you can see the result here http://skipology.com/temporary-test-page/ However. If I replace `return $content;` with `return htmlspecialchars($content);` the plugin output renders correctly but the rest of my site displays ` ` instead of the space. Can I either create a conditional situation to include both lines with one just targeted at the output of the plugin (Wordpress Popular Posts) or can I create a near duplicate function somehow triggered by the plugin? I can't target a specific page because all pages will potentially contain this conflict. Edit - the conflicting output is from the plugin and shows my post titles as generated by the plugin as 'iPhoneography seascape workflow – {�horizon�}' where the � is the ` ` Edit2 - That helps. What is the Plugin itself doing to filter the post title? This is what I can see...               // TITLE          $title = ($this->qTrans) ? qtrans_useCurrentLanguageIfNotFoundUseDefaultLanguage($p->title) : $p->title;     $title = strip_tags($title);     $title_sub = strip_tags($title);          // truncate title (section on truncating the title here - I don't use)          $title = htmlspecialchars( $title, ENT_QUOTES, $this->charset );     $title_sub = htmlspecialchars( $title_sub, ENT_QUOTES, $this->charset );     $title = apply_filters('the_title', $title, $p->id);     $title_sub = apply_filters('the_title', $title_sub, $p->id);      Specifically re character sets we have:               var $charset = "UTF-8";      and...               // set charset     $this->charset = get_bloginfo('charset');      and the SQL character set seems to be               $sql = "";     $charset_collate = "";      Edit 3 - I've just done another test and if I manually insert ` ` into a title rather than relying on my functions.php code posted above it's rendered perfectly by the plug in. Is there something wrong with the functions.php? My source code shows the correct behaviour as does my site so I'm confused! e.g. this is the title from a post... `
iPhone photography tip { extend canvas and auto clone }
`


WPMU - new users are automatically subscribed to the main blog - how to prevent that?

New users added via `wpmu_signup_blog($domain, $path, $title, $user_name, $user_email);` are automatically subscribed to the main blog. Can this be prevented? I only want them to be administrators of their newly created blog. I have no idea where to start looking for that as it seems to be some internal WordPress's mechanism that handles that. http://codex.wordpress.org/WPMU_Functions/wpmu_signup_blog


Update an existing post in a custom post type

Alright lets say we have a connected user that access one of his post to replace some existing informations in X fields thats already exist with some new ones.. How could i manage to update the old ones with the new ones ? Example : custom post type name = recipe field trying to be updated with new content = $_POST['title'] Thks for the help


Custom Post Type URL Rewrite's

I am going to try and sum up what I am trying to achieve... Basically I have a custom post type called 'marketing_list' which will have custom fields holding information relating to marketing lists available for purchase. Each marketing list will belong to a category (custom taxonomy). So currently my URL's look like this:   * `/marketing-lists` -> archive page   * `/marketing-lists/post-slug` -> single marketing lists entry   * `/marketing-lists/category/category-slug` -> custom taxonomy What I want to achieve is:   * `/marketing-lists` -> archive page but editable within the admin in case the client wants to update text, like a Page.   * `/marketing-lists/category-slug` -> custom taxonomy   * `/marketing-lists/category-slug/post-slug` -> single entry On top of that I would like to create some additional pages which have a base of `/marketing-lists` i.e   * `/marketing-lists/consumer-marketing-lists` -> single page   * `/marketing-lists/business-marketing-lists` -> single page Is this at all possible? Perhaps their is a better way to achieve this?


Query based on custom fields start and end date

I have a custom post type called Events, with 2 custom fields, start date and end date. These fields are stored using a timestamp in the database. I want to create a custom query based on these 2 values, so i can list events that are inside the specified date/time range. This is how my code looks like:               $start_date = strtotime($_POST['start_date']);     $end_date = strtotime($_POST['end_date']);     $args = array(         'post_type' => 'event',         'posts_per_page' => -1,         'orderby' => 'title',         'order' => 'ASC',         'meta_query'=>array(             'relation'=>'AND',              array(                 'key' => 'event_start_date',                 'value' => $start_date,                 'compare' => '<=',                 'type' => 'NUMERIC'              ),              array(                 'key' => 'event_end_date',                 'value' => $end_date,                 'compare' => '>=',                 'type' => 'NUMERIC'              )          )     );     $events = new WP_Query($args);            So i'm using a simple NUMERIC meta_query, since all of my values and keys stored in a timestamp. The code looks fine for me, but somehow theres no results in this query. Here is an example: $star_date = 1343779200 $end_date = 1412121600 And one of my event post has these values as a custom field: event_start_date = 1375315200 event_end_date = 1377734400 So it should give me at least one result, because the start_date is smaller and the end_date is higher compared to the event_start_date and event_end_date. Any idea whats wrong?


Is the only way to add taxonomy terms via an admin panel?

Is it possible to register taxonomy terms programmatically from a plugin? I would like to add a custom taxonomy 'geographical area' and also prepopulate the taxonomy with a list of areas in the UK.               public function sample_taxonomy() {         // create a new taxonomy         register_taxonomy(             'resellers',             'wps-reseller',             array(                 'label' => __( 'Geographical Areas' ),                 'rewrite' => array( 'slug' => 'area' ),                 'capabilities' => array(                     'assign_terms' => 'edit_guides',                     'edit_terms' => 'publish_guides'                 )             )         );     }      Also, how would I run this code only once as part of plugin activation? I am using the Wordpress plugin boilerplate activation functions.


WPMU schedule doesn't execute actions

Here's a simple event that is correctly scheduled to be executed `daily`. Unfortuantely, it doesn't execute `delete_old_users()` function daily. It is supposed to delete users older than a certain date.               function delete_old_users() {         $old_users = get_site_option( 'old_users' );              foreach ( $old_users as $user_id => $expiration_time ) {             if ( $expiration_time <= gmmktime() ) {                 wpmu_delete_user( $user_id );             }         }         return;     }     add_action( 'delete_old_users_daily', 'delete_old_users' );               function setup_schedule() {         if ( ! wp_next_scheduled( 'delete_old_users_daily' ) ) {             wp_schedule_event( time(), 'daily', 'delete_old_users_daily');         }     }     add_action( 'wp', 'setup_schedule' );      Is there anything I'm missing here? When I manually do `do_action( 'delete_old_users_daily' )` it works. I'm out of ideas. It just doesn't execute my action and I have no idea how to debug that.


wordpress ajax relationship query

Using the relationship field from Advanced Custom Fields I link artists to events. Both these artist and events are custom post types. For each event, the post IDs of the related artists are stored in an array as a custom meta field (lineup_artists). On each event page I list all the artists. When you click on an artist, I'd like to show all the events where you can find this artist (through an AJAX call which shows the results in a bootstrap modal). I've tested the AJAX call and it's working, but there's something wrong with the query (takes very long to complete). In my function I have:               $ArtistID = $_POST['ArtistID']; // Gets the ArtistID from the AJAX call          $meta_query = array(         'key'       => 'lineup_artists',         'value'     => '"' . $ArtistID .'"',         'compare'   => 'LIKE'     );              $args = array(             'post_type'         => 'events',             'meta_query'        => array($meta_query),             'posts_per_page'    => 5,             'post_status'       => 'publish',        );      If I dump the results of wp_query, I get the following sql query:               SELECT SQL_CALC_FOUND_ROWS yt_posts.ID FROM yt_posts           INNER JOIN yt_postmeta ON (yt_posts.ID = yt_postmeta.post_id)          WHERE 1=1           AND yt_posts.post_type = 'events'      AND (yt_posts.post_status = 'publish')           AND ( (yt_postmeta.meta_key = 'lineup_artists' AND CAST(yt_postmeta.meta_value AS CHAR) LIKE '%\"17497\"%') )           GROUP BY yt_posts.ID ORDER BY yt_posts.post_date DESC LIMIT 0, 5      When I paste this query in phpmyadmin it takes very long to complete (I've never seen it finish because it takes so long). Is this because the artist IDs are stored as an array? Someone told me that this is not very efficient and that these relations should be stored in a separate table (which I don't know how to do). Is there something wrong with my query or is this a very inefficient way of querying relations? * * * **EDIT:** In reply to kaiser (let's use ACDC as an example :-)): In my event page I have this html/php for each artist (there can be 100+ artists on each event page. `$artistID` and `$artistName` are generated in the `foreach` loop.):               <a class="yt-artist" data-target="#modalArtist" data-toggle="modal" id="ArtistAttr" data-id="<?php echo $artistID; ?>" data-name="<?php echo $artistName ?>"><?php echo $artistName; ?>      This code is generated in a `foreach` loop to get all the artists:               $lineup = get_sub_field('lineup_artists'); // The relationship artists are in a repeater field     if($lineup):     foreach($lineup as $artist):     <a class=... etc      which will result in:               ACDC      So clicking an artist shows the modal, and when the modal is shown the AJAX js is fired:               jQuery(document).ready(function()      {         $(document).on('click','.yt-artist',function()         {             var ArtistID = $(this).data('id');                 var ArtistName = $(this).data('name')             $('#modalArtist').on('shown',function()             {                  jQuery.ajax(                 {                       type: 'POST',                       url: 'http://xxx/wp-admin/admin-ajax.php',                       data:                      {                           action: 'yt_ajax_artist_events_eventpage',                           ArtistID: ArtistID,                                         ArtistName: ArtistName,                     },                     success: function(data, textStatus, XMLHttpRequest)                     {                           jQuery('#modalArtist').html(data);                       },                       error: function(MLHttpRequest, textStatus, errorThrown)                     {                       alert(errorThrown);                     }                 });             });          });      And the function (includes some HTML to inject in the modal):               function yt_ajax_artist_events_eventpage(){              $ArtistID = $_POST['ArtistID'];         $ArtistName = $_POST['ArtistName'];              $meta_query = array(             'key'       => 'lineup_artists',             'value'     => $ArtistID,             'compare'   => 'LIKE'         );              $args = array(             'post_type'         => 'festivals',             'meta_query'        => array($meta_query),             'posts_per_page'    => 5,             'post_status'       => 'publish',            );              $results = '
             <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
'.$ArtistName.'

';         $loop = new WP_Query($args);         while ($loop->have_posts()) : $loop->the_post();              $results .= '
'.get_the_title().'
';              endwhile;         wp_reset_query();         $results .= '
';         die($results);     }       add_action( 'wp_ajax_nopriv_yt_ajax_artist_events_eventpage', 'yt_ajax_artist_events_eventpage' );       add_action( 'wp_ajax_yt_ajax_artist_events_eventpage', 'yt_ajax_artist_events_eventpage' );


Query by post title

I've used a custom post type for one of my website. Custom post type contains scratch card data along with some custom fields. I've developed an android application to manage those items from android device. In the android app, I want to keep search feature which will help admin users to search card numbers to manage those. I can use wordpress query to search by title.               Code     $args = array("post_type" => "mytype", "name" => $title);     $query = get_posts( $args );      It can only provide result if I provide exact title. But I need to retrieve all items with similar title. Any suggestion?


Posts aren't showing up in my dashboard

When an admin logs into my site to edit a post, the list of available posts is empty -- even though there clearly are posts on the site. Do you know why this is happening or how to make the posts show up? ![posts do not show up](http://i.stack.imgur.com/pWhfg.png)


Shortcode for latest -not expired- posts

I've made a short code (part of a plugin) to display the posts which aren't expired. For saving the expiration date, i made already a meta key called newsbox-date. Handy for micro-news, short messages and holliday announcements. My client will not use the posts for blogging but more for short messages a few times a year. With the shortcode we can paste the newsbox on the homepage and contactpage. (as mentioned: handy for holidays) So far i have this:               function my_recent_posts_shortcode( $atts ) {     extract( shortcode_atts( array( 'limit' => 5 ), $atts ) );     $q = new WP_Query( 'posts_per_page=' . $limit );     $list = '
';     while ( $q->have_posts() ) {         $q->the_post();         $expdate = get_post_meta(get_the_ID(), 'newsbox-date', true);         $nowdatetime = current_time("mysql");         if ($expdate >= $nowdatetime) {         $list .= '
' . get_the_title() . '
' . get_the_content() . '';         }     }     wp_reset_query();     return $list . '
';     }     add_shortcode( 'recent-posts', 'my_recent_posts_shortcode' );      There are a few things i need to handle:   * can i do the filtering of expiration date in the WP_Query already ? Now all posts are first requested, right ?   * When all posts are expired, the div newsbox-posts must not be showed. So, an if-statement must be handled before the div; but i don't know yet the best way to get the meta key in this stage. Thanks for any tips. If this thing is working, i'll share the plugin in the rep.


How to change featured content to a different tag in Wordpress Twenty Fourteen?

In twenty fourteen theme, we’d like to know how to change the features content tag. Currently it’s set as `featured`. Now, we would like to know how to code this for different page templates. We notice in `page.php` there is a piece of code calling the template part `featured-content`.               <?php     if ( is_front_page() && twentyfourteen_has_featured_posts() ) {         // Include the featured content template.         get_template_part( 'featured-content' );     }     ?>      From our understanding this calls the file `featured-content.php`. In this file, is there a way to decide the tag. We imagine you can do it using an if statement and the `$tag` or `$term` variable inside an array. But we’re not completely sure. Our idea is to create three pages on our site, each using a different tag to show different posts in the featured content section. Can this be done and can anyone provide us with the code or logic to do it? Thanks in advance! the LWdesign team


Wordpress 1 domain multiple blogs

I need to setup a website with wordpress that 1 domain with have different pages of blogs. For example: \- my website have Home, Artworks, Techniques pages. \- Artworks and Techniques are 2 different blogs. \- Home will shows whichever posts that is latest from Artwork and Techniques. How can I do that with wordpress?? Thanks!


1 WordPress, 2 themes, 2 domains, 2 servers

I've got two sites which are hosted on different servers. 1) domain-one.com 2) domain-two.net I installed a WordPress blog on site one at domain-one.com/blog/. I want visitors of domain-two.net to be able to access the blog installed on site one via domain-two.net/blog/. I have a WordPress plugin called "Domain Theme" that changes the look of the blog depending on the domain the visitor is accessing it from. This plugin determines where the visitor is coming from via the $_SERVER['SERVER_NAME'] variable. I have an .htaccess file in domain-two.net/blog/ redirecting requests to domain-one.com/blog/. Going to domain-two.net/blog/dog.php actually shows what's at domain-one.com/blog/dog.php. Unfortunately, the Domain Theme plugin for WordPress can't tell when it's being accessed from domain-two.net because after the rewrite in .htaccess, the value of $_SERVER['SERVER_NAME'] is domain-one.com (not domain-two.net). Because of this, I see the same theme when I access the blog from either domain. Is there a way to redirect requests from domain-two.net that lets the plugin know where they're really coming from?


Filter or Hook to catch pre-rendering of post content

Is there a filter or hook that is triggered just before post content is rendered? What I'd like to do is to apply a filter to the text content of a post just before the post text is being rendered.


custom post type index page

I have registered a custom post type and I want to create a page where I will list some posts, it will be like an index page. I have created an archive page called **mycpt-archive.php** and a page called **myCPT.php**. I've added a custom URL in the menu called "myCPT" like this : **www.mywebsite.com/mycpt** Now, when I click from the front-end menu on "myCPT" it displays the **mycpt-archive.php** content and not the **myCPT.php**. I've looked through the template hierarchy from CODEX and it seems I'm on the right track. When I click on "myCPT" from the front-end menu the page displayed is **mycpt- archive.php** not **myCPT.php** which I'm expecting to open. What am I missing here ? Thank you !


Save automatically data to user profile once or twice a day

**The main goal :** I am working on a panel which will display statistics of my user websites (external website). For that, I use the Google Analytics API. I save the Google Analytics profile number in a custom profile field. For the moment, I run the script (statistics) each time my users want to see them (in front end). And it takes few seconds to generate them. My statistics change approx once a day (It's not hourly stats, but daily stats). So, the idea was to save once a day the statistics to the user profiles. So, like that, it won't take time to generate them each time the user will load a stats page. **The solutions :** So, I started to think about different solutions. But the best would be to save the data without any action from the users. Or maybe when someone visits the website, it would save the data for everyone once the day with wp_cron. For the moment, the only thing I succeed was to save the data when a user update his profile. But it will save only his data, and not for everyone, so it's not what I want.               function my_save_statistiques( $user_id ) {               $visites_totales = 'My stats script....';         update_usermeta( $user_id, 'visites_totales', $visites_totales );     }     add_action( 'personal_options_update', 'my_save_statistiques' );     add_action( 'edit_user_profile_update', 'my_save_statistiques' );


Get source from the_post_thumbnail

I'm struggling because I'm using the "Sitewide Tags"-Plugin to grab all posts in a network to the main blog. Now I want to embed the post images to the main blog and the only function you're able to use for that is: `the_post_thumbnail ();` But I'm using a grid layout for which I just need the url of the image (src). For that I cant't find the solution and would be very thankful for some help. Best regards, Philipp


URL parameters causing 404 on home page, but nowhere else

I am writing a plugin that utilizes URL parameters. For some reason, adding one of these parameters to the home page of my website causes a 404 (http://bleaney.ca/?source=asdf). Adding the parameter to any other page, however, doesn't cause a 404 (http://bleaney.ca/work- experience-2/?source=asdf). This 404 issue only manifested itself after I registered the parameter with Wordpress:               add_filter('query_vars', 'register_visitor_identifier_query_vars' );     function register_visitor_identifier_query_vars( $qvars ) {         $qvars[] = 'source';         return $qvars;     }      On the 404 page, the URL parameter is still detected by this code, the page itself just 404s for some reason:               if (isset($wp_query->query_vars['source'])) {         echo $wp_query->query_vars['source'];     }      Any idea what is causing this and how I can fix it? I think the workaround of just setting the home page to have a longer ULR like the work experience link would work, but I'd rather fix this issue if possible, rather than work around it.


Why does ini_get('post_max_size') return a different value inside wp_max_upload_size() than outside?

This code in an otherwise empty php file:               var_dump(ini_get( 'post_max_size' ));      ...in my Wordpress directory on the server will output `string(3) "40M"` (as expected). Putting the exact same line of code into the function `wp_max_upload_size()` contained in `/wp-includes/media.php` outputs `string(2) "8M"`. How can this be? `phpinfo()` tells me 40M as well.


Use [embed] filter in template files

WordPress autmatically embeds a youtube video's if I use:               [embed] http://www.youtube.com/watch?v=Xog1T5dUxcw [/embed ]      This is great, but it doesn't work if I use it in an template file. I have a custom field where the admin can put a URL to a YouTube video. I want get the video in the sinle-post using the following code:               <?php       $custom = get_post_custom($post->ID);       $url = $custom['_videoLink'][0];     ?>     <div class="video">       [embed]<?php $url; ?>[/embed]     </video>      How can i convert the Youtube URL into an embed URL using the standard WordPress [embed] function?


Passing variable in nested shortcodes

How can I pass `style` attribute of `[boxes]` shortcode to `[box]` shortcodes without using global variables? I don't want to use global variables, because I saw on a few articles that using global variables is a bad practice.               [boxes style="style-one"]         [box][/box]         [box][/box]         [box][/box]         [box][/box]     [/boxes]


How to redirect a Custom Google Search to a wordpress page/template?

I'm using the Google Custom Search plugin by edwinkwan (the first that appears in the wordpress plugin repository). I added the search box: `<?php display_search_box(DISPLAY_RESULTS_CUSTOM); ?>` in the header. and the results: `<?php display_gsc_results(); ?>` in this page: http://alexchen.info/taiwantalk/search-results (Which is a tempalte called `search-results.php`) Now, I can only see the results if I perform a search in that page (with the search box in the header). If I just search for something, for example, in the front page, absolutely nothing happens. For instance, If I perform search from: **alexchen.info/taiwantalk** Nothing happens. I couldn't find anything like: "the search results page" in my Google Custom Search Panel. Apparently the Custom Google Search is working but the search is not being redirected to `search-results.php` when I perform a search in any other page. Any suggestions to fix this? **EDIT:** I also tried this plugin: **wordpress.org/extend/plugins/google- custom-search-for-wordpress/** but it seem to be based on the code of Google Custom Search of 2010. It requires you to get two pieces of code (the search box and the search results). But Google Custom Search's Panel only provides one. Like this:
Loading
               <link rel="stylesheet" href="http://www.google.com/cse/style/look/default.css" type="text/css" />


Best Practice for Displaying Categorized Posts on Front Page

I am building a custom wordpress theme from a clients mockup. On the homepage there are 2 sliders, and 4-5 areas for recent posts of different types. I would like to have all the content be editable in wordpress what is the best way to create a post, apply some sortof value to it (category,taxonomy,tag,custom post type), and then retrieve more than one loop on a single page or is it best to use feeds? Any suggestions greatly appreciated


Can't place two custom post types into the Wordpress search query?

I placed the following code into my `functions.php` file:               function filter_search($query) {         if ($query->is_search) {         $query->set('post_type', array('topic', 'reply'));         };         return $query;     };     add_filter('pre_get_posts', 'filter_search');      With that code I can only search for the `reply` custom post type (results with the `topic` custom post type don't show up). Both are custom post types from the bbpress 2.0 plugin. I have to do this: `$query->set('post_type', array('topic'));` in order to make the `topic` custom post type show up (but them I no longer get the `reply` custom post type to show up in the results). Any suggestions to fix this?


Wordpress Git Workflow Help

I'm looking for a strong streamlined workflow idea for working with Wordpress.   1. Would like to have my git environment on my own server internally, not using Github to handle repos.   2. Automatic creation of subdomains upon git branch creation (development.domain.com , ryan.development.domain.com) - Probably some shell script hook would be ideal for this.   3. Phing PHP/Shell script Handling of the db migration (something like this http://interconnectit.com/products/search-and-replace-for-wordpress-databases/ ) to handle serialized database replacement upon pushing Operation would probably go something like this:   1. getting the current latest wordpress version and branch it out, name of the branch gets a subdomain entry (branchdevelopment.domain.com)   2. submodule the theme you desire if it's available (i'd like to make my own git repo for this, as I use thesis I'd like to have a blank thesis git repo setup to grab from internally on the server that's already been created)   3. checkout and make changes , client reviews, once it's pushed to live, the database script will then kick in automatically changing the serialized url values from localhost (or subdomain) to the live url Is this possible? I've heard Capistrano is also good to utilize with this but not sure how Capistrano entirely works. I run about 200 sites on my own server and would like to start implementing these sites into a strong git workflow environment so i can streamline my work alot better. As of right now, I basically download an image of the site and work on it locally then upload the changes back to the server. This is very tedious in this day and age. Does anybody have any solutions regarding this type of workflow / has worked with this in the past? If so, some resources / answer would be greatly appreciated.


How to localize inline script called with ajax

I have a loop of posts and I allow a user to edit each post using ajax. When the edit button is clicked for the post I use ajax to retrieve the template part containing the edit form for the post. Easy enough to do by creating a function with 'get_template_part' and then localizing a script where I use $ajax to execute the function. Now here is my problem. I need to process the form with ajax that is in the template part we've called. In order to do anything with jquery for that form, the jquery has to be added as an inline script to the template. So when the button is clicked inside the from to save and edits made, I then need to run my php function that processes any edits made. But I can't do that because I can't actually localize the inline script that will allow me to use that php function I've made. Any ideas. UPDATE: Ok so instead of adding the scripts to the template inline, I register the script inside the function that gets the template part and then print it which I thought would give me a chance to localize. The script works for the template part but it isn't localized.                add_action('wp_ajax_fetch_dashboard_edit_form', 'fetch_dashboard_edit_form');       function fetch_dashboard_edit_form() {         $post_id = $_POST['postId'];         $edit_type = $_POST['editType'];         include(locate_template('edit-'.$edit_type.'.php'));             wp_register_script(          'fod_edit_script',          get_bloginfo('stylesheet_directory') . '/libs/edit.js',          array( 'jquery' ),          null,          true         );         wp_localize_script(          'fod_edit_script',          'editAjax',          array(             'ajaxurl' => admin_url( 'admin-ajax.php' )          )         );         wp_print_scripts("fod_edit_script");      }


How do I preserve changes to a theme's functions.php across updates?

I'm using a theme called "Pinboard", version 1.1.0. I made some edits to the theme's functions.php in order to display FontAwesome icons before archive titles. For instance, if you're browsing the "foo" tag, then up in the header, where it reads "Currently browsing tag foo", there's a tag icon to the left of "foo". These are the changes I made; they're in the "Highlight current location in the archive" section of functions.php, around line 1306:               elseif( is_author() ) {                         $author = get_userdata( get_query_var( 'author' ) );                         echo ' ' . $author->display_name;                     } elseif ( is_year() ) {                         echo ' ' . get_query_var( 'year' );                     } elseif ( is_month() ) {                         echo ' ' . get_the_time( 'F Y' );                     } elseif ( is_day() ) {                         echo ' ' . get_the_time( 'F j, Y' );                     } elseif ( is_category() ) {                         single_term_title( ' ' );                     } else {                         single_term_title( ' ' );                     }      You can see that I'm echoing `<i></i>` elements with certain classes. I want to preserve these changes between upgrades of Pinboard, but as it stands, updating the theme will obliterate my changes and require me to add them again by hand. What can I do to preserve these changes across upgrades? Is this a place where child themes would be useful, and if so, how? Thanks.


Custom taxonomy archive page not working

I have a custom post type, `course` with an associated custom taxonomy `curriculum-area`. On the permalink `domain.com/course/`, a list of all courses is shown as expected. However, on the permalink `domain.com/curriculum-area/equality`, it shows the home page. (The home page is a static page). I would like it to, instead, show an archive of all `courses` in the specified `curriculum-area`: `equality`. Also, if I have a `front-page.php`, this archive page also uses the template from `front- page.php`. How can I get the `archive.php` template to be applied to this custom taxonomy?               // functions.php:          <?php          // add thumbnail support     add_theme_support( 'post-thumbnails' );           // add custom post type 'Course'     add_action( 'init', 'register_cpt_course' );          function register_cpt_course() {              // custom taxonomy - curriculum area         $args_curriculum_area_taxonomy = array(             'hierarchical'          => true,             'labels'                => array(                 'name' => 'Curriculum Areas',                 'singular_name' => 'Curriculum Area'             ),             'show_ui'               => true,             'show_admin_column'     => true,             'update_count_callback' => '_update_post_term_count',             'query_var'             => true,             'rewrite'               => true         );              register_taxonomy( 'Curriculum Area', 'course', $args_curriculum_area_taxonomy );              // custom post type - course         $cpt_course_args = array(              'labels' => array(                 'name' => 'Courses',                 'singular_name' => 'course'             ),             'hierarchical' => false,             'description' => 'The place to display courses',             'supports' => array( 'title', 'editor', 'thumbnail', 'custom-fields', 'revisions' ),             'taxonomies' => array( 'curriculum_area' ),             'public' => true,             'show_ui' => true,             'show_in_menu' => true,             'menu_position' => 5,                  'show_in_nav_menus' => true,             'publicly_queryable' => true,             'exclude_from_search' => false,             'has_archive' => true,             'query_var' => true,             'can_export' => true,             'rewrite' => array(                 'slug' => 'course',                 'with_front' => true             ),             'capability_type' => 'post'         );              register_post_type( 'course', $cpt_course_args );          }          ?>


How to pass on a value as parameter via url to another page

I'm dealing with a problem I can't solve myself. I did a few hours of research about it, but I didn't manage to make it work. I want to send a parameter via the url to the page I'm forwarding to and based on the value of this I want to show a image. Im using the Hana Code Insert Plugin to get my js used in WP. I'm relatively new to WP and have little to no knowledge in PHP, so please consider this. **The Hana-contents are as following:** **shortcut galleryLink and getSelected_05:** http://www.abload.de/gallery.php?key=updfCGrl **The contents of the site are as following:** > toat.me/test-for-ids/ Gallery: [hana-code-insert name='galleryLink' /] Finished... > toat.me/resize-your-image-now/ |img class="aligncenter size-full wp-image-119" alt="" src="http://toat.me/wp- content/uploads/2013/08/blank-t-shirt_white_big.jpg" width="700" height="700" /| [hana-code-insert name='getSelected_05' /] Note: I had to replace the <> tags of the img with | in order to show it in this post. I'm looking forward to helpful answers.


Query page: preserve page formating

dose anyone know how to get this query (or a different query) to preserve the page formatting? Thanks               <?php     $my_postid = 663;//This is page id or post id     $content_post = get_post($my_postid);     $content = $content_post->post_content;     $content = apply_filters('the_content', $content);     $content = str_replace(']]>', ']]>', $content);     echo $content;     ?>      EDIT I did not find a way to alter the above Query to respect the original page formatting but I did find a different Query that dose. Notice the
       in the following query. The "class="format_text"" formats the query output to that of the original page formatting.               <?php      // The Query     $the_query =new WP_Query('pagename=my-page-name');     // The Loop     while ( $the_query->have_posts() ) : $the_query->the_post();          ?>

<?php the_title(); ?>
         <?php the_content(); endwhile; ?>
     <?php          // Reset Post Data     wp_reset_postdata();     ?>


Displaying additional User Contact Information

I have been advised how to add additional contact info fields to the User admin area here (Click here). However, I am not entirely sure how I can display the the field contents in a link within my template files. Here is the code in my functions.php:               add_filter( 'user_contactmethods', 'more_contactmethods' );     function more_contactmethods( $contactmethods ) {         $contactmethods['twitter'] = 'Twitter URL';         $contactmethods['facebook'] = 'Facebook URL';         $contactmethods['linkedin'] = 'LinkedIn URL';         return $contactmethods;     }      And here's the code in one of my template files, but it doesn't seem to work, so I wonder whether I can actually do it this way?               <?php          $twitter = get_usermeta( $user_id, 'facebook' );          $facebook = get_usermeta( $user_id, 'twitter' );         $linkedin = get_usermeta( $user_id, 'linkedin' );     ?>              <a href="<?php echo $twitter ?>" id="twitterBtn" title="Visit our Twitter page">Visit our Twitter page


Wordpress programming video tutorials

I am a beginner in Wordpress programming. I am basically looking out for video tutorials that teach Wordpress programming and specifically creation of plugins and such advanced things. Are there any good video tutorials which teach such sort of stuff? or any courses from training companies like pluralsight. I know pluralsight is not into PHP but are there any other sites? I am even willing to pay for videos. The video tutorials need not be free however free is always welcome. Thanks in advance :)


Store JSON in a custom field

I have a drawing canvas on some of my Wordpress' post pages, where users can draw on. Upon drawing, my JS code currently sends the user's drawing to a php file. This is where I store the array in JSON format in .txt files. Whenever the page is loaded by someone else, JS loads these JSON files on start, so you see other people's sketches and you can draw on it as well - where the txt files get altered etc etc. But is it possible to use Wordpress' custom fields? So every post has their own variable where the drawing array is stored. I have no idea what type of custom field to use.. Or whether there is a plugin out there that might be helpful with helping me achieve what I want. Or maybe not a good idea at all to do it this way. Thanks in advance.


Create password automatically for new users?

Is it possible to automatically create a password for a new user? Ideally, I'm looking for a plugin that, if the password is not given on user creation, would generate one and optionally email it to the user if the checkbox for this is selected. If not, then maybe just show the password after the creation of the user. Does anyone know if there is a plugin with this behavior or similar behavior?


How MUST the directory for a plugin be structured?

I get the basic plugin concept. I've read the Codex article on Writing a Plugin That article talks about the "main plugin file". How does Wordpress determine "the main plugin file" ? **Q1:**   Is it legal / supported to have a plugin that is structured like this:   * pluginname/   * pluginname/mainfile.php   * pluginname/supportingcode-1.php   * pluginname/supportingcode-2.php   * pluginname/Readme.txt   * etc.. ? **Q2:**   If so, how does wordpress determine which php file is the main plugin file? * * * I have seen recommendations that say "I structure my code _this way_ ":   * pluginname/   * pluginname/mainfile.php   * pluginname/inc/supportingcode-1.php   * pluginname/inc/supportingcode-2.php   * pluginname/Readme.txt   * etc.. **Q3:**   Is the use of a subdirectory (like `inc/` in the above example) a requirement when the PHP code spans multiple modules? **Q4:**   Is it true that there should be a maximum of ONE php file in the main plugin directory? Thanks.


Subsite theme mystery man replacement with Buddypress on main site

I have a multi-site install with buddypress on the main site. In the buddypress theme I've been able to override the default 'mystery-man' avatar using my custom buddypress theme. I simply have an images folder containing a replacement 'mystery-man.jpg' avatar. However, for the other wordpress sites on the network this technique doesn't work. I've looked into the solutions proposed here: Set default avatar network-wide But these answers don't seem to work with buddypress enabled on the main site. It seems buddypress somehow interferes with the way the non-buddypress sites get their avatars, because the html returned looks like this:               <img src="http://www.gravatar.com/avatar/ba60ca5beed202054f393b040bfd7ac3?d=http://subsite.example.com/wp-content/plugins/buddypress/bp-core/images/mystery-man.jpg&s=50&r=G" alt="Avatar Image" class="avatar user-16-avatar" width="50" height="50">      ...regardless of the functions and filters I've applied from the previous solution. Is there a way to get it to look to see if the subsites theme has an 'images/mystery-man.jpg' and use that before using the buddypress default? **UPDATE** Following feedback I realise 'BuddyPress' is network enabled on my site, which interferes with the normal solution. I've tried enabling this on just the main site, but this crashes all the subsites. I think this might be because I've attempted to add BuddyPress activity comments to the replies in the subsite blogs, so I actually WANT the subsites to know Buddypress is active.


My CSS, footer and header don't show up!

When I activate my theme in my-admin on WordPress, my CSS, header and the footer don’t show up. I really don't know what the problem is because I followed all the steps of a tutorial. **`header.php`**               <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">     <html xmlns="http://www.w3.org/1999/xhtml" <?php language_attributes(); ?>>          <meta http-equiv="Content-Type" content="<?php bloginfo('html_type'); ?>; charset=<?php bloginfo('charset'); ?>" />     <title>     <?php wp_title('«', true, 'right'); ?>     <?php bloginfo('name'); ?>     </title>          <link rel="stylesheet" href="<?php bloginfo('stylesheet_url'); ?>" type="text/css" media="screen" />          <link rel="stylesheet" href="<?php bloginfo('stylesheet_directory'); ?>/css/wysiwyg.css" type="text/css" media="screen" />     <link rel="pingback" href="<?php bloginfo('pingback_url'); ?>" />                    <link href="<? bloginfo('stylesheet_directory'); ?>/css/index.css" type="text/css" rel="stylesheet" />          <?php  wp_head(); ?>

1234 Main Street NE, Suite 201

Grand Rapids, MI 49503 Main 616 555 5555

Home

Portfolio

About

Contact

           **`footer.php`**
             Copyright © 2009, Megan Sullivan. All Rights Reserved.

          <?php wp_footer(); ?>


Related Posts by Multiple Tags?

I was curious if was possible to display related posts by multiple tags. The site I am working on has about 5 tags per post. Most posts have 1 or 2 tags in common. The related posts I'd like to show have 3-5 tags in common. So, I'd like the related posts to function by looking for posts with the most number of tags in common and display them in descending order. Let's say I display 3 related posts: relatedpost1 would have 4 tags in common, relatedpost2 would have 3 in common and relatedpost3 would have 1 in common. Is it even possible to do this? Right now I am messing around with two ways of displaying the posts but they arent functioning as I'd like: The first method (code) just shows posts with ANY tags in common.               <?php $orig_post = $post;     global $post;     $tags = wp_get_post_tags($post->ID);     if ($tags) {     $tag_ids = array();     foreach($tags as $individual_tag) $tag_ids[] = $individual_tag->term_id;     $args=array(     'tag__in' => $tag_ids,     'post__not_in' => array($post->ID),     'posts_per_page'=>3, // Number of related posts that will be shown.     'caller_get_posts'=>1     );     $my_query = new wp_query( $args );     if( $my_query->have_posts() ) {     echo '

Related Posts

';     while( $my_query->have_posts() ) {     $my_query->the_post(); ?>

<a href="<? the_permalink()?>" rel="bookmark" title="<?php the_title(); ?>"><?php the_post_thumbnail(array(185, 185)); ?>

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

     <? }     echo '

';     }     }     $post = $orig_post;     wp_reset_query(); ?>`      The second method (code) just shows posts with the first tag in common.               <?php     //for use in the loop, list 5 post titles related to first tag on current post     $tags = wp_get_post_tags($post->ID);     if ($tags) {     echo '

Related Posts

';     $first_tag = $tags[0]->term_id;     $args=array(     'tag__in' => array($first_tag),     'post__not_in' => array($post->ID),     'posts_per_page'=>3,     'caller_get_posts'=>1     );     $my_query = new WP_Query($args);     if( $my_query->have_posts() ) {     while ($my_query->have_posts()) : $my_query->the_post(); ?>

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

     <?php     endwhile;     }     wp_reset_query();     }     ?>      Both ways kind of suck; I'm either getting pretty random posts displaying (since most of my posts have at least 1 tag in common) or (for some posts) getting no related posts (since their common tags are tag 4 or 5). Any help would be greatly appreciated.


How to get a value from comment meta

I've add the field **country** in the comment form. Working nice and I can see the value in the table commentmeta. ![enter image description here](http://i.stack.imgur.com/vCFZu.png) Now I try to display this value in my comment list. In my **single.php** I call the list of comments:               <?php wp_list_comments('type=comment&callback=format_comment'); ?>      In my **functions.php** I format the comment:               function format_comment() {  ?>

<?php comment_author(); ?>

<?php get_comment_meta( $comment->comment_ID, 'country', true ); ?>

<?php comment_date('Y/m/d - g:i A'); ?>

<?php comment_text(); ?>

     <?php } ?>      So... to get the value for the meta **country** I use               <?php get_comment_meta( $comment->comment_ID, 'country', true ); ?>      Without success…


How to redirect to action on custom page within admin section

Currently I'm developing(well at least trying to;) plugin which will handle custom gallery of images. I stumbled upon one problem though. I'll try to picture it. I've created custom menu page on which I can edit gallery options as well as I can add/delete/edit elements of gallery. I did add link to every gallery item so after choosing 'edit' I could be able to modify element.               function column_rls_name($item) {       $actions = array(                 'edit'      => sprintf('Edit',$_REQUEST['page'],'edit',$item['rls_name']),             );       return sprintf('%1$s %2$s', $item['rls_name'], $this->row_actions($actions) );     }      Problem begins when 'edit' on element is clicked. It should redirect to settings page. Here I have a question. What is the best way to do this. Are there any helper functions/hooks/etc out there which would help in creating such page (and detect redirection). Of course I could do it in function responsible for displaying main gallery options like:               if($_GET['action']=='edit')         //then do sth     else         //display main gallery options      but I don't think it's the best way. I would like to know which functions I could use, from creating custom link, creating custom page and registering them. What method should be used when action=edit is triggered. How to spot it was requested on the actual page. How to show then page related to the content.               wp-admin/options-general.php?page=rls_logotypes&action=edit&rls_element=element1


wp_signon returns user, but the user is not logged in

I use `wp_signon()` and it returns a user, not an error. However when I do `is_user_logged_in()` it returns false. Help would be very much appreciated :)


w3 Total Cache expire headers not set

I have been using w3 Total Cache with the setting to enable Expires Headers and eTags but they are not being set. I'm serving images and other media from a sub-domain such as static.example.org served by nginx but it didn't work even when I was serving these files with Apache from the main domain. I've tried disabling and re-enabling the browser caching settings in the admin without success. What do you suggest?


Updating Style From WP Options Setting Page

Can you please let me know how I can set a function to update change the style like any CSS class from the setting option page? For example I have some `<P>` elements with a class name `.impo`. Now, I would like to change the color of the class to red when the checkbox has been checked and to default color when un-checked. What I have is:               <?php      add_action('admin_menu', 'fwds_plugin_settings');      function fwds_plugin_settings() {      add_menu_page('Price Display', 'Price Display', 'administrator', 'fwds_settings', 'fwds_display_settings');      }     function fwds_display_settings() {     $html = '
<form action="options.php" method="post" name="options">
Change The .impo Colors
         ' . wp_nonce_field('update-options') . '

      Change Color To Red 	      <input type="checkbox" name="fwds_autoplay" value="enabled" />

     <input type="submit" name="Submit" value="Update" /></form>
';     echo $html;     }


Unfiltered html with update_post_meta

I have buddypress installation. When posting an acitivity, I'm including some data (html) as meta. Let me show some code: this is an action triggered when acitivty is posted.               function add_activitylink_to_activity( $content, $user_id, $activity_id ) { ?>          <?php }     add_action( 'bp_activity_posted_update', 'add_activitylink_to_activity', 10, 3 );      and here is a ajax handler:               function addActivityMeta() {         bp_activity_update_meta( $_POST['activity_id'], 'activitylink', $_POST['add_link'] );         die('success');     }      everything works fine as long as I'm logged in as administrator, but with normal users, the meta does not get posted as I understand it, it's because "unfiltered html", but I don't understand much of it and this maybe sound stupid: can I filter it somehow? :D there are table and image links and such. or is there any workaround? for example I'm thinking about inserting this meta with mysql query? Is this bad solution?


Wp get archive only text not link

i use this function               wp_get_archives( array( 'type' => 'yearly', 'limit' => 12, 'format' => 'html' ) );      And i got this:               2013      I need only "2013". Just anyone know how to do this?


Customized featured image doesn't refresh in post admin metabox after upload/insert

I customized my featured image metabox position, the default name, and text for a custom post type. While I'm able to add/edit an image in post admin, after I have uploaded an image, the post admin doesn't show the new image in the metabox until after I save the post. The featured images are set and I'm able to query and retrieve them in the frontend just fine. Also, strangely, I can only upload images--it doesn't seem that I can insert existing images from the media library. Here's the relevant code below:                       // Add custom featured image box "sketch" using existing featured image metabox; remove default featured image box.             public function image_box() {                 remove_meta_box( 'postimagediv', 'tn_cstm_sketchbook', 'side' );                 add_meta_box('postimagediv', __('Sketch'), 'post_thumbnail_meta_box', 'tn_cstm_sketchbook', 'normal', 'high');             }                  // Conditionally filter featured image text only for sketchbook custom post types             public function add_featured_image_filter() {                      if ('tn_cstm_sketchbook' == get_post_type() ) {                          add_filter('admin_post_thumbnail_html', array($this, 'do_thumb' ));                     add_filter( 'admin_post_thumbnail_html', array($this, 'remove_featured'), 9999, 1 );                      }             }                       public function remove_featured( $content ) {                 return str_replace( 'Remove featured image', 'Remove sketch', $content );             }                  public function do_thumb($content){                  return str_replace(__('Set featured image'), __('Add a sketch'), $content);             }      And here are the hooks that I'm calling them with:               public function __construct() {             add_action( 'do_meta_boxes', array($this, 'image_box' ));             add_action( 'admin_head-post-new.php', array($this, 'add_featured_image_filter' ));             add_action( 'admin_head-post.php', array($this, 'add_featured_image_filter' ));         }


templates with page teasers Or Featured Items

I've been given a design for a WordPress site which will be mostly made up of pages rather than posts. However, at the top of each page there needs to be three featured items in a row. Each featured item will have an image, title, a small bit of summary text, and a link to another page. Can anyone tell me the best way of implementing these featured items for a page? Would they need to be a custom content type? And if so how would I implement it in the template? They need to be fairly easy for administrators to edit, and change, and link to other pages. I am an experienced Drupal designer, but am new to WordPress. Any help would be much appreciated. Ben


Custom Post Type conflicting with page?

I have a page on my website called Work (that uses a work.php page template) set up as my front page, where I would like to display a list of the last ten posts with the custom type called portfolio. Here is my code so far:                   <?php $the_query = new WP_Query( array( 'post_type' => 'portfolio', 'posts_per_page' => 10 ) ); ?>         <?php while ($the_query -> have_posts()) : $the_query -> the_post(); ?>             <section id="post-<?php the_ID(); ?>" <?php post_class( 'portfolio-post' ); ?>>
<a href="<?php the_permalink(); ?>" rel="bookmark"><?php the_title(); ?>
                     <time datetime="<?php the_time('Y-m-d') ?>" pubdate><?php the_time('F jS, Y') ?></time>
         <?php endwhile;?>      The problem is that nothing shows up on that page, despite my having created a couple of posts of this type in wordpress' backend. And when one is clicked, I would like to be taken to `/work/the_post_i_clicked/`. I must admit to being a bit confused here. Any help would be greatly appreciated.


Save attachment ID instead of URL in custom field

I am testing several frameworks (currently Vafpress) to help me creating custom meta boxes. I need to save a lot of attachments with my posts but noticed that the attachment is saved with its full URL, not the ID.   1. There seems to be no "easy" way to get full data (title, desc, date) from an attachment, when I only have the URL, right?    2. Is there any framework that saves ID instead of the URL?   3. Any other suggestions to save attachments, maybe without a custom meta box?


WordPress Multisite - is this possible?

I've found documentation on multisite a little sparse so I'm hoping someone will be able to answer some of my questions. What I'm trying to achieve:   * A main admin user that can look at all networked sites.   * Network sites on a subdomain or on their own domain   * All sites running on the same theme but with different theme options.   * Each network site only has one user, they can only access one site on the network that is assigned to them. If anyone could give me a heads up or point me in the right direction it would be much appreciated.


wordpress makes duplicate images of different size

I have a wordpress website. I upload my pictures to the media library. And when I import a picture in a post, you get the options, one of which ask you what size to display it in. And doing this results in creating a new image file that is a different size, rather than wordpress using html to control the size of the image. The following image shows how different sized picture copies are made of the same one with different resolution. ![enter image description here](http://i.stack.imgur.com/bc44U.png) Thank you everyone in advance.


API for Post Stats for Self-Hosted Wordpress using JetPack

**EDITED** for Clarification WordPress.com as well as JetPack provides stats (like no of views, referrer, etc) for various posts and blog as described here :Wordpress Stats Is there an API so that I can access the stats data and use it as per my needs ?


How to store media files in subdomain

In order to parallelize downloads, i created already a subdomain for images. images.mydomain.com Now, i don't know how to move my media files, without breaking attachments, and after that, in the future, how to automatically store media file in subdomain. Eventually, what i was thinking of doing was something like , redirect images.mydomain.com to mydomain.com/wp/content/uploads and after that replace all strings 'http://www.domain.com/wp- content/uploads/'with'http://images.mydomain.com/' using the wordpress plugin "search and replace". Does someone believes to know how to get around this? thanks in advance


Detecting Embed URLs Within post_content

I need to change the way WP outputs html when given an embed URL within the content. Example content within the WP editor:               This is standard content and will be wrapped in a 'p' tag. But check out this cool vid:          http://www.youtube.com/watch?v=3JJv4TvURj4          This will be output as another 'p' tag. The above URL will be turned into an iFrame.      The goal is for the client to input something simple like that, and change the way wordpress outputs it on the page. I have been using the `oembed_dataparse` filter to good effect so far, but **I would like to take the video URL and pass it to another function outside of the filter**. How can I do that? My initial approach was to use a global variable. Here's my abridged filter code:               add_filter('oembed_dataparse', 'modal_embed', 10, 3);     function modal_embed($html, $data, $url) {         // This is supposed to store the URL globally so I can access it          // outside this filter.         global $video_url;         $video_url = $url;              $custom_output = "
$html
"; // Just an example.          return $custom_output;     }      The code I create as `$custom_output` works just fine and is displayed on the page. The issue is that I'm not getting access to `$video_url` globally as I expected. Any thoughts? Thanks.


Restrict download files from not generated Urls

I use a plugin in WPMU that encrypt all downloads urls in wp-content/uploads/ : The downloads can still be accessed if users know the path to the file: e.g. www.domain.com/wp-content/uploads/2013/02/file.pdf . My problem is how to prevent this . i want to restrict direct downloads from not encrypted urls I tried this in my `.htaccess` but it disable downloads also from encrypted urls:               Deny From All     Allow From http://domain.com/wp-content/plugins/Encryptor-plugin/encrypt.php


Author List page: Exclude based on last post date not working correctly

Using the following code from this post I thought I had found the answer to my problems of showing authors that have posted in the last 6 months. Unfortunately the way the function checks the date it only seems to block some months and doesn't take in to consideration previous years as it is showing older posts/authors still. I believe the problem lies in the `if (6 < (date('n',(time() - strtotime($posts[0]->post_date)))))` with the `n` being the month. Could anyone assist to correct the lookup so it only shows from the last 6 months?               <?php     // Arguments to pass to get_users     // ************* $args = array( 'orderby' => 'post_count', 'order' => 'DSC', 'who' => 'authors' );     // Query for the users     $authors = get_users('orderby=post_count&order=DSC'); //&role=contributor ?>     <?php     // Loop through all the users, printing all of their posts as we go     foreach ( $authors as $author ) {              // Set up a Loop, querying for all of the current user's posts         $args = array( 'author' => $author->ID, 'posts_per_page' => 1 );         $posts = query_posts($args);              if (6 < (date('n',(time() - strtotime($posts[0]->post_date)))))             continue; //skips this autor as long as his last post is older than 6 months, be aware that this check uses date function.           ?>                 <a name="<?php echo $author->user_nicename; ?>">                 <div class="author-posts-wrapper" id="author-<?php echo $author->ID; ?>-posts-wrapper">                     <div class="author-avatar" id="author-<?php echo $author->ID; ?>-avatar">                         <?php echo get_avatar( $author->ID, 96 ); ?>
                     <div class="author-posts" id="author-<?php echo $author->ID; ?>-posts">
<a href="<?php echo get_author_posts_url( $author->ID ); ?>"><?php echo $author->display_name; ?>
              <?php if ( have_posts() ) :  ?>                     <div class="author-post-list" id="author-<?php echo $author->ID; ?>-post-list">             <?php while ( have_posts() ) : the_post(); // Print whatever we want for each post - for now the title ?>
                             <?php the_author_meta("description"); ?>

Most recent article: <a href="<?php the_permalink(); ?>" title="<?php the_title(); ?>"><?php the_title(); ?>

                 <?php if(get_the_author_meta('user_url')): ?>                     <?= get_the_author_meta('user_url') ?>                 <?php endif; ?>
             <?php endwhile; ?>
         <?php else: ?>
This author has not yet published any posts
         <?php endif; ?>

     <?php } // End looping over all users ?>


Empty string supplied as input when parsing content

I have this code:               <?php     function mb_find_my_image( $content ) {         if( is_home() ) { /* if is home start */                $dom = new domDocument;           $dom->loadHTML($content);           $dom->preserveWhiteSpace = false;                   } /* if is home end */         return $content;     }     add_filter( 'the_content', 'mb_find_my_image' );     ?>      However, it seems that I always get the following error: > Empty string supplied as input on line 6 What I'm I doing wrong here?


WP 3.5.1 password protected not working for post

After adding right password fornt side wp, post not open and it's say > Not Found Apologies, but the page you requested could not be found. Perhaps > searching will help. how to solve this?


How do I find out which plugin is exceeding memory limits?

I had an issue today when my sites had stopped working. Calling up the link just showed a cryptic message `Database connection error`, on all my sites on one server. The error disappeared on rebooting. While trying to get to the root of the issue, I was examining syslog (I'm using Debian 7), and found the following entries:               Jun 15 05:46:03 myserver suhosin[8368]: ALERT - script tried to increase memory_limit to 268435456 bytes which is above the allowed value (attacker 'myipx.y.z.a', file '/var/www/virtual/mylocation/htdocs/wp-content/plugins/wordfence/lib/wfUtils.php', line 502)     Jun 15 05:46:21 myserver suhosin[8372]: ALERT - script tried to increase memory_limit to 268435456 bytes which is above the allowed value (attacker 'myipx.y.z.a', file '/var/www/virtual/mylocation/htdocs/wp-content/plugins/wordfence/lib/wfUtils.php', line 502)     Jun 15 05:46:38 myserver suhosin[8368]: ALERT - script tried to increase memory_limit to 268435456 bytes which is above the allowed value (attacker 'myipx.y.z.a', file '/var/www/virtual/mylocation/htdocs/wp-content/plugins/wordfence/lib/wfUtils.php', line 502)     Jun 15 05:46:54 myserver suhosin[8376]: ALERT - script tried to increase memory_limit to 268435456 bytes which is above the allowed value (attacker 'myipx.y.z.a', file '/var/www/virtual/mylocation/htdocs/wp-content/plugins/wordfence/lib/wfUtils.php', line 502)     Jun 15 05:55:01 myserver /USR/SBIN/CRON[8508]: (root) CMD (command -v debian-sa1 > /dev/null && debian-sa1 1 1)     Jun 15 05:56:59 myserver suhosin[8514]: ALERT - script tried to increase memory_limit to 268435456 bytes which is above the allowed value (attacker 'myipx.y.z.a', file '/var/www/virtual/joel.co.in/kgimoa.com/htdocs/wp-content/plugins/wordfence/lib/wfUtils.php', line 502)     Jun 15 05:57:18 myserver suhosin[8516]: ALERT - script tried to increase memory_limit to 268435456 bytes which is above the allowed value (attacker 'myipx.y.z.a', file '/var/www/virtual/joel.co.in/kgimoa.com/htdocs/wp-content/plugins/wordfence/lib/wfUtils.php', line 502)     Jun 15 05:57:33 myserver suhosin[8514]: ALERT - script tried to increase memory_limit to 268435456 bytes which is above the allowed value (attacker 'myipx.y.z.a', file '/var/www/virtual/joel.co.in/kgimoa.com/htdocs/wp-content/plugins/wordfence/lib/wfUtils.php', line 502)      The error repeats itself. Looking at the code, on line 502:                public static function iniSet($key, $val){                     if(self::funcEnabled('ini_set')){                             @ini_set($key, $val);                     }             }      Is this because one of my plugins/theme is using an excess amount of RAM? How can I isolate and identify which one? Other than disabling each plugin one by one and waiting for the error to show up in syslog, is there a quicker, and directed method?


How do I get gallery thumbnail URL and change the default thumbnail size?

when I create a gallery I get this code generated yet I can;t find out how               <img width="150" height="150" src="http://localhost/wp2/wp-content/uploads/2012/06/28_0120-150x150.jpg" class="attachment-thumbnail" alt="_28_0120" title="_28_0120">      What function generates the thumbnail URL and how does the thumbnail image generated and cropped to the size of 150-150? I forgot to mention:   for the gallery page I use `get_children`, so this is what I need to work with


Highlite current menu page problem

Hello I have a problem with the wordpress menu I have the main menu parent item has the same link width first page in submenu Parent --- Haloterapie: www.site.com/halorepaie Submenu --- Actiunea Terapeutica: www.site.com/halorepaie When activated one of them,show that they are active all page in submenu To show active page I made so:               add_filter('nav_menu_css_class' , 'special_nav_class' , 10 , 2);     function special_nav_class($classes, $item){      if( in_array('current-menu-item', $classes) ){              $classes[] = 'active ';      }      return $classes;     }      ![enter image description here](http://i.stack.imgur.com/cJDbk.png)


Implode Taxonomy to hide parents?

The following code will display the child taxonomy term of the parent only.               $terms = get_the_terms($wp_query->post->ID, 'propertytype');      $props = array();      foreach ($terms as $term) {      if ($term->parent)      $props[] = $term->name;      }      echo implode(', ', $props);      For example: London (Parent), West London (Child) - the above will only echo West London (Child). However, if there are multiple child levels e.g London (Parent), West London (Child), Chelsea (Grand Child) This does not work! I only want to display the last term. **How would i modify the above to only display the last term even if there is more than one sub level?** Thanks Paul **FINAL CODE USED**                  $terms = get_the_terms($wp_query->post->ID, 'propertytype');           //die(print_r($terms));           $props = array();           foreach ($terms as $term) {            $hasChildrenTest = get_term_children($term->ID, 'propertytype');               if ($term->parent) {                   if (empty($hasChildrenTest) && !is_wp_error($hasChildrenTest)) {                   $props[] = $term->name;                   }               }           }           echo $props[0];


Menu fallback "menu_class" rendering a "div" instead of a "ul"

I'm working on a fallback menu for a WordPress theme I'm working on. The main menu's `menu_class` renders a `ul` which is what I want. However, if I use the menu fallback, the `menu_class` renders a `div` instead. Is there a way to make Wordpress render a `ul` for the fallback menu instead of a `div`? Here's my code:                function clarity_main_nav_fallback() {               wp_nav_menu(array(              'show_home' => true,         'container' => false,                           // remove nav container         'container_class' => 'menu clearfix',           // class of container (should you choose to use it)         'menu_class' => 'nav navbar-nav'              // adding custom nav class              ));           }


Set static page as default front page on newly created sites in multisite

How to set a Static page (example Sample Page with every WordPress install) as default fron page for every newly created site on multisite network. I mean when a new user creates a site on my multisite network a Page with custom name sets as front page automatically. Please tell me how to accomplish that.


How to customize and keep things up-to-date?

I made a few websites in WP (that was kind of my first serious web-related work where I started learning about more serious and concrete stuff other than homework type of programming exercises) and only now that some time has passed do I see some things that I did wrong in the first place that I would do differently now. One of those thins is that I hard-coded lots of custom stuff into plugins themselves and now I realize that I cannot update lots of plugins because that would break certain parts of the website. What I am interested is how do you cope with this? I understand that this probably falls into the scope of website maintenance, but perhaps there is a common approach, a design pattern or something that could be used to minimize this problem? One could perhaps make and include a custom css file that would contain all the override/custom values, but how about custom php/html/js changes? Is there a similar way of making customizations in that area without the fear of loosing all of them once an update is in place?


Automated Footer information

Working on a theme and I'd like the copyright and title texts on the footer to be automated. It works but the tittle switches to the current page instead of the website's main title when you switch pages. How do I get it to stick to the website's main title or home page title. My line of code is as shown below.                ©<?php echo date("Y"); ?> <?php the_title(); ?>


Custom form, shortcode, and submit handler

I have a frontend form with a bunch of input. My requirements force me to use a custom shortcode to create the form. I have already tested a page with that shortcode. Here's my :               <form name="myform" method="post" action="<?php echo str_replace( '%7E', '~', $_SERVER['REQUEST_URI']); ?>" enctype="multipart/form-data">      Based on this, it should open up the same page (and it did). However, when I hit submit, I got 404 on that very same URL. Is there any solution? **UPDATE #1** I try different route, using add_action('init'):               add_action('init', 'mbro1_intercept_form_input');     function mbro1_intercept_form_input()     {         if( !(isset($_POST['action_code']) && $_POST['action_code'] == 'mbro_intercept_form_input') )             return "";         if( isset( $_POST['submit'] ) )         {             //do my code here             wp_redirect( get_permalink(35) );//page that has [shortcode]         }     }      This successfully run my intended action on submit. But! upon redirection, it still got 404. I don't know what is wrong.


How to write sql query to get the posts from a custom taxonomy term name

I hope someone will help me............. I have a   * Post Type ----> Dealers   * Taxonomy ----> State how to write a sql query in this format               $catinfo1 = $wpdb->get_results("select t.*,(select count(tr.object_id) from $wpdb->term_relationships tr join $wpdb->posts p on p.ID=tr.object_id where tt.term_taxonomy_id=tr.term_taxonomy_id and p.post_status='publish') pcount from $wpdb->terms t join $wpdb->term_taxonomy tt on tt.term_id=t.term_id where tt.taxonomy=\"fueltype\" and tt.parent=0 order by t.name");


Is It A Good Idea To Change Author Slug (user_nicename field) Directly In MySQL DB?

Searching for a how-to on changing author slug, I found two methods:   1. Change the `user_nicename` field in the MySQL database of your WordPress site to whatever you want the slug to be.   2. Changing the Author Slug from Username to Nickname The (2) is out of question because I want the slug to be something custom, but not the nickname/nicename. As for (1) I wanted to know if this is okay -- to change the value of `user_nicename` field in the database for the user?


Style.css redirects to 404 Page not found

I've just uploaded a wordpress site from MAMP to a live site. Exactly the same methods I usually use to upload them, including permalinks and all the usual PHPMyAdmin bits. This time the style.css, js and all the images are just redirecting to a 404 page. The website is here Can anyone help? This makes no sense at all. EDIT: heres a snippit of header.php:               <!DOCTYPE html>                                        <meta charset="utf-8">             <meta content='width=device-width, initial-scale=1.0' name='viewport'>             <meta content='Josh Stevens, Lyndsay Hooper, PotatoMou.se' name='author'>             <meta content='<?php bloginfo( 'description' ); ?> ' name='description'>             <meta content='' name='keywords'>                                                                    <link rel="stylesheet" type="text/css" media="all" href="<?php bloginfo( 'stylesheet_url' ); ?>" />                  <title>                 <?php echo get_the_title() . "  -  ". get_bloginfo ( 'description' );  ?>
                              </title>                              and here is the actual rendered code:                    <!DOCTYPE html>                                            <meta charset="utf-8">             <meta content='width=device-width, initial-scale=1.0' name='viewport'>             <meta content='Josh Stevens, Lyndsay Hooper, PotatoMou.se' name='author'>             <meta content='Ken Christy Rural Support ' name='description'>             <meta content='' name='keywords'>                                                                    <link rel="stylesheet" type="text/css" media="all" href="http://www.kenchristy-ruralsupport.com/wp-content/themes/KenChristy/style.css" />                  <title>                 Home  -  Ken Christy Rural Support
                              </title>


Custom post pagination trouble

I do have a problem with a custom post pagination. I search through this site and googled the whole day yesterday, and found nothing that was similar to what I experience (or I'm getting blind...). Here is my custom post "recipe":               register_post_type( 'recipe', array(     'labels' => array(         'name'               => __('Recipes'),         'singular_name'      => __('Recipe'),         'add_new'            => __('Add New'),         'add_new_item'       => __('Add new Recipe'),         'view_item'          => __('View Recipe'),         'edit_item'          => __('Edit Recipe'),         'new_item'           => __('New Recipe'),         'view_item'          => __('View Recipe'),         'search_items'       => __('Search Recipes'),         'not_found'          => __('No Recipes found'),         'not_found_in_trash' => __('No Recipes found in Trash'),     ),     'public'        => true,     'show_ui'       => true,     'hierarchical'  => true,     'supports'      => array('title', 'editor', 'thumbnail'),     'menu_position' => 100,     'menu_icon'     => get_stylesheet_directory_uri() . '/images/icon_recipe.png',     'rewrite'       => array(         "slug"       => "recipe",         "with_front" => false,                 "pages"      => true     )     ) );      I need to load 6 recipes on my recipe page, and then I use jQuery to load the next 6 in AJAX. The code actually grab the "next page" URL (that is hidden in my page) to perform this. The problem is that it keeps loading the first 6 recipes, despite the fact that the url is correct (/recettes/page/2/). When I try to load this page directly in the address bar, it redirects to /recettes/ (that is my first page). Even when I put a die("test") at the top of my template file, it never gets there. Could it be only related to the URL rewriting? Here is my .htaccess file:               <IfModule mod_rewrite.c>     RewriteEngine On     RewriteBase /     RewriteRule ^index\.php$ - [L]     RewriteCond %{REQUEST_FILENAME} !-f     RewriteCond %{REQUEST_FILENAME} !-d     RewriteRule . /index.php [L]     </IfModule>      The strange thing is that the same mechanism works for the news section... Any ideas? Thanks a lot for your help! Matt PS: here is the page, if you want to have a look: http://www.francoischartier.ca/recettes/ PPS: and this is the news section that works: http://www.francoischartier.ca/chartier/nouvelles/ Here is the query in the page template for recipes:                           $paged = (get_query_var('paged')) ? get_query_var('paged') : 1;                 $args = array(                     'post_type'      => 'recipe',                     'posts_per_page' => 6,                     'order'          => 'ASC',                     'orderby'        => 'post_title',                     'tax_query'      => array(),                     'paged'          => $paged,                                         'caller_get_posts' => 1                 );


Woocommerce Product Page edit "from" text

Is there a way to change the "From:" text that denotes the lowest available price for each particular product within the shop? I'm asking this as, on our shop we offer A4 samples within the Wallpaper sections, and the program sees this as the lowest available price. However this is somewhat misleading. So, is it possible to change this text to "A4 Sample:" Alternatively, is there away to add text. Either before the "From:" text, or to the end of the field, after the price? If none of this is possible, is there a way to get the default price of products in the Wallpaper section to be that of the Rolls of Wallpaper?


Using <?php echo get_num_queries(); ?> queries in and i see 7000+queries?

I have put queries in seconds. in my footer.php and i see more than > 7000 queries in about 9 secs , is this a lot?? On my localhost > i have 195 queries in 3,070 seconds. As the live version is slow i like to know if the queries could be the cause? And what would be the best step by step way to monitor/reduce the queries? How can i check which code triggers the queries? Regards


New Twitter API and Twitter count + timeline doesn't work anymore

As some of you might know, Twitter has changed their API. With that some of my plugins / codes stopped working. I tried to fix them on my own, but failed. I tried googling for the new API URL and I also searched here. I tried to insert the URL provided in this post, but once applied I only got an error message. I need to update the following two codes with the new API, but don't know how to! Twitter followers' count snippet:               function rarst_twitter_user( $username, $field, $display = false ) {         $interval = 3600;         $cache = get_option('rarst_twitter_user');         $url = 'http://api.twitter.com/1/users/show.json?screen_name='.urlencode($username);              if ( false == $cache )             $cache = array();              // if first time request add placeholder and force update         if ( !isset( $cache[$username][$field] ) ) {             $cache[$username][$field] = NULL;             $cache[$username]['lastcheck'] = 0;         }              // if outdated         if( $cache[$username]['lastcheck'] < (time()-$interval) ) {                  // holds decoded JSON data in memory             static $memorycache;                  if ( isset($memorycache[$username]) ) {                 $data = $memorycache[$username];             }             else {                 $result = wp_remote_retrieve_body(wp_remote_request($url));                 $data = json_decode( $result );                 if ( is_object($data) )                     $memorycache[$username] = $data;             }                  if ( is_object($data) ) {                 // update all fields, known to be requested                 foreach ($cache[$username] as $key => $value)                     if( isset($data->$key) )                         $cache[$username][$key] = $data->$key;                      $cache[$username]['lastcheck'] = time();             }             else {                 $cache[$username]['lastcheck'] = time()+60;             }                  update_option( 'rarst_twitter_user', $cache );         }              if ( false != $display )             echo $cache[$username][$field];         return $cache[$username][$field];      Show latest tweets snippet:               function recentTweets($username, $number){       include_once(ABSPATH.WPINC.'/rss.php');            $tweet = fetch_feed("http://search.twitter.com/search.atom?q=from:" . $username . "&rpp=" . $number );            if (!is_wp_error( $tweet ) ) :       $maxitems = $tweet->get_item_quantity($number);        $rss_items = $tweet->get_items(0, $maxitems);        endif;            if ($maxitems == 0) echo '
No Tweets.
';       else foreach ( $rss_items as $item ) {            $content = html_entity_decode($item->get_content());       $link = html_entity_decode($item->get_permalink());       $date = $item->get_date('U'); // retrives the tweets date and time in Unix Epoch terms      $blogtime = current_time('U'); // retrives the current browser client date and time in Unix Epoch terms      $dago = human_time_diff($date, $blogtime) . ' ago'; // calculates and outputs the time past in human readable format           echo "
$content •$dago
";       }      }      Thank you so much in advance. Here's my blog for reference.


Strange Anchor Tag Behavior (in-page links work, external pages do not)

I've got a strange issue in that anchor links on the current page work fine, but that the exact same link doesn't work if clicked from another page. If you go here, and click on any one of the items in the table, It'll take you to the correct area of the page, for instance, searching and clicking on corks takes me to this URL ( http://www.cswd.net/recycling/a-z/#corks ) but if I copy and paste that link into a browser, it will jump to the cork section and then immediately jump down to the bottom of the page. I don't see any conflicting javascript, the site is using thesis (I didn't have any hand in the design, coding or anything, just doing maintenance), and I'm not getting any errors in the console of firebug. I've tried removing the trailing '/' on permalinks (as suggested on the wordpress forums) but that didn't work - same issue. I'm personally stumped. Any ideas?


dropdowboxes with pre-selected custom fields optios that filters the results according seach needs

In my site I have one custom post types with custom taxonomies: custom post_type=listings --> Category --> Tags Along with it, I have some custom fields to separate them by country, state, region. The problem is that I need too supply an efficient form for users to perform a search and I would like to create several dropdowboxes with pre-selected custom fields optios that filters the results according their needs... eg. A user selects country-a and a second dropdowbox becomes active with states from that country and after that another one becomes active with regions from country a. Then, the user inserts the search term and gets their results filtered Is this possible? How can I do it? Any help is appreciated, Thanks!


Display tags that only appear in one category

I'm trying to get this less manual than it currently is. I want to display tags that appear in only a single category, so if they are in a post that has two categories, I want that tag ignored. The following code works, but is a little clunky. Ideally I'd like to be able to skip having to add the excludes and just have it figure it out itself.               <?php      function pl8_artist_list($catname, $exclude) {         $custom_query = new WP_Query('posts_per_page=-1&category_name='.$catname.'&cat='.$exclude.'');         if ($custom_query->have_posts()) :             while ($custom_query->have_posts()) : $custom_query->the_post();                 $posttags = get_the_tags();                 if ($posttags) {                     foreach($posttags as $tag) {                         echo '
' . $tag->name . '
';                         echo '
' . $tag->description . '
';                         echo '
slug . '">Read posts about ' . $tag->name . '
';                     }                 }             endwhile;         wp_reset_postdata(); // reset the query         endif;     }      ?>      And I call it like so:               <?php     pl8_artist_list(trance, -3,-11,-4,-8);     ?>      The excludes being the other categories that the tags may appear in. I'm quite new to PHP, so any light that could be shed would be greatly appreciated.


WordPress get or set active menu class

How to get active menu class in wordpress, I want to get it in one plugin to change menu style. Just to clear, I do not want active menu element class.

Home

About

Services

Team

Blog

Contact

      In this I want to get "nav-menu" or i want to set new class like
      But not using themes file, I want to work it for all theme which is active. Thanks In Advance, Ajay


How can I use Varnish Edge Side includes for a sidebar?

I've read this post here but am unsure where to start. https://www.varnish- cache.org/trac/wiki/ESIfeatures Edit for clarification: I do want to use Full page caching but once we cache say the article page, it can stay in the cache for a day or so, or if something pushes it out. But I'd Want the sidebar to refresh at a faster rate


Query post types with multiple keys

I'm looking for a way to only show posts results that contain all of the custom fields requested. Not one or the other. I was only able to get results with one array at a time. Any help would be appreciated.                       $documents = array(             'post_type' => 'documents',             'meta_query' => array(                 array(                     'key' => 'document-type',                     'value' => 'manual',                 ),                 array(                     'key' => 'document-status',                     'value' => 'current',                 )             )          );             query_posts( $documents );             get_template_part( 'loop', 'documents' );             wp_reset_query();      I also tried an SQL Query without any luck.                        $documents = "                 SELECT wposts.*                 FROM $wpdb->posts wposts                 JOIN $wpdb->postmeta document-status ON                   ( wposts.ID = document-status.post_id AND                     document-status.meta_key = 'document-status' )                 JOIN $wpdb->postmeta document-type ON                    ( wposts.ID = document-type.post_id AND                     document-type.meta_key = 'document-type' )                 WHERE document-status.meta_value = 'current'                 AND document-type.meta_value = 'manual'                 AND wposts.post_status = 'publish'                 AND wposts.post_type = 'documents'                 AND wposts.post_date < NOW()                 ORDER BY wposts.post_date DESC                 LIMIT 0 , 4              ";               $documents = $wpdb->get_results($documents, OBJECT);             query_posts( $documents );             get_template_part( 'loop', 'documents' );             wp_reset_query();


How are bulk actions handled in custom list table classes?

I'm working on a custom data table to display in the WordPress dashboard. The table populates from a database table I built in a plugin. I've been using the provided WordPress Custom List Table example for most of my coding questions in this area, but the example doesn't have anything for handling bulk actions. Here is the link for the documented example: http://wordpress.org/extend/plugins/custom-list-table-example/ For processing the bulk actions, the example only provides this:                   function process_bulk_action() {              //Detect when a bulk action is being triggered...         if( 'delete'===$this->current_action() ) {                  wp_die('Items deleted!');         }          }      I want to know how to pull the items selected for the action so I can delete them or edit their database entries accordingly.


wp_redirect not working when going to www version of site

The following function works perfectly when logged-in visitors go to http://sitename.com, taking them to the site homepage. When logged-in visitors go to http://www.sitename.com, however, they're incorrectly redirected to http://sitename.com/splashpage. Does anyone know what's causing this? I have tried switching my site settings to use http://www.sitename.com as the WordPress and Site Address URLs, but that simply reverses the issue so it incorrectly redirects when a logged-in user goes to http://sitename.com.               // REDIRECT USERS TO SPLASH PAGE IF THEY'RE NOT LOGGED IN     add_action ('template_redirect','mkm_restrict_access',1);     function mkm_restrict_access() {         $url = site_url('/splashpage/');         if (is_page('splashpage') || is_page('login')) {             //do nothing         } elseif (!is_user_logged_in()) {             wp_redirect( $url );              exit;          }     }      Thank you for your help!


Menu Arrow for Child Element

I have a menu for a website I am designing and there are parent and child elements...I was wondering if there was someway I could add an arrow to my navigation if the parent has a child element? My navigation code looks like:               <div id="nav">         <ul>             <?php                 wp_list_pages("title_li=");             ?>         </ul>     </div>      My CSS code looks like: http://pastebin.com/xBbHsyVM I would prefer to use a text arrow, but an image arrow will work just as easily...a css solution over javascript or jquery is also a plus, but not a big deal if it isn't. Thanks,   Josh