title: Custom Post Type Template - Archive

text: I have a custom post type, called 'job', and I have the following templates in my theme:   * single-job.php (works fine, displays single job as expected)   * archives-job.php (is not recognized?)   * archives-current.php (also not recognized)    * archives.php (is not recognized either?)    * index.php (archives page uses this page) Here is how I've registered my custom content type in functions.php:               add_action( 'init', 'create_jobs' );     function create_jobs() {       $labels = array(         'name' => _x('Jobs', 'post type general name'),         'singular_name' => _x('Job', 'post type singular name'),         'add_new' => _x('Add New', 'Job'),         'add_new_item' => __('Add New Job'),         'edit_item' => __('Edit Job'),         'new_item' => __('New Job'),         'view_item' => __('View Job'),         'search_items' => __('Search Jobs'),         'not_found' =>  __('No Jobs found'),         'not_found_in_trash' => __('No Jobs found in Trash'),         'parent_item_colon' => ''       );            $supports = array('title', 'editor', 'custom-fields', 'revisions', 'excerpt');            register_post_type( 'Job',         array(           'labels' => $labels,           'public' => true,           'has_archive' => 'current',            'supports' => $supports         )       );     }      When i go to the url http://mywebsite/wordpress/current/, it displays all of my jobs as expected-- but it is not using ANY of the archive templates, and instead uses index.php. My understanding of the wordpress documentation was that it would look for archives-(special archive for post type name).php, then archives-(post type).php, then archives.php, then index.php... but it just goes straight to index.php? I did visit the permalinks settings page and clicked save to refresh everything, so I'm not getting 404's, it's just not outputting to the correct templates... did I name them incorrectly? Is there a registration setting I missed when I created my custom post type?


title: Custom post type routing with hierarchy

text: I've been playing around with a lot of custom post types lately and I am pretty anal about my URL structure / routing. An issue I ran in to a with a site that I just developed was this:   * I had many custom post types, for example: `videos`   * The URL structure to 'view' the video list (ie: archive of sorts) was `/media/videos/`   * This 'view' was basically a custom `WP_Query` displaying things properly from a custom .php template.   * When an individual 'video' link is clicked you are taken to the post type URL structure, ie: `www.site.com/videos/{slug}`   * This causes all loss of URL structure/parental relationship to structure. I would love to solve this problem:   * When you navigate to `/media/videos/` you get the custom loaded template file   * When you click a video `permalink()`, you will be linked to `/media/videos/{slug}`   * Ideally this would perserve hierarchy of URL structure (so if something like Breadcrumb NavXT it would still have a relationship). I made a teacher/student/etc module one time where I did custom routing via `add_rewrite_rule` to handle these problems, but I would rather figure out how to handle hierarchy appropriately in this situation. Can someone please point me in to the right direction? Thanks! Tre


title: Using Images in Wordpress - Best Practices

text: I'm not a novice to Wordpress Theme Design & Development. I've actually been doing it for a few years now and in recent years, it has become more than a hobby and is slowing shaping into a career choice. However, I have a somewhat simple yet puzzling question to ask here... Forever, I've been uploading the images I use through my custom themes into their own "img" or "images" directory under the themes directory under wp- content. Of course, for posts I just used the Media Uploader built within Wordpress itself. But, now that I'm trying to be more professional and produce grade-A work consistently I recently thought about how I handle my images. You see, using my old method I also did NOT use Wordpress template tags for the image paths. I was doing the old fashion HTML method with it's relative path and if I encountered a problem, I just put the WHOLE path in there to save time. That is a huge no, no. I'm well aware but this wasn't client work... Anyway, to get to my point - what IS the best practice for using images in Wordpress? I'm now beginning to think more inline with this process: **For theme development I now have a "inc" directory within my theme's directory that then has a "imgs" and "js" directories, etc. When designing the theme, I'm now using Wordpress template tags for my paths to work properly throughout the theme. For my posts, I'm still using the Media Uploader and the normal /upload directory.** Is my new method the best practice? Thank you!! Again, I'm just trying to clean up my workflow and methods so I'm more in-line with the Codex and other top tier Wordpress projects out there. Thanks!


title: How to define a custom font family for a wordpress blog that will not affect the entire site

text: While my related question on Stack Overflow _should_ explain the basic CSS for this once it gets answered, how would I define a custom font family for a wordpress blog that will _only_ apply to a <span> and will not affect the site-wide font families being used by the theme on my wordpress site? > Related: Creating Useable Custom Font Family


title: Course listing with multiple dates

text: I'm trying to build a course listing (custom post type) - each course has multiple dates assigned to it, but I'm failing miserably (mainly due to my poor PHP skills!). I'm trying to use standard WordPress custom fields with a key called date and values of the dates (until I get it working, then moving onto custom metaboxes). What I need to do is output the courses multiple times - once for each date value, so I need to display for example (Category and location are custom taxonomies): 25/09/2013 - Course 3 - Category - Location   26/09/2013 - Course 1 - Category - Location   28/09/2013 - Course 1 - Category - Location   29/09/2013 - Course 2 - Category - Location   01/01/2014 - Course 1 - Category - Location   06/01/2014 - Course 2 - Category - Location Dates will be stored as YYMMDD for sorting purposes as I'm sure I read this is the best format? As for what I need to output - the plan was a page template in the above format. I also need to order them by date, and not show any dates prior to today's date. I can't for the life of me work out how to do this - specifically outputting the post info once per date. I will also need to filter the results shown using a few select dropdowns, but I should be able to figure this out later.


title: 403 forbidden due to .htaccess?

text: I have this 403 forbidden issue that i can't tell what's causing it. At this moment, i've already talked with theme support, wich advised me to talk with host support, wich i've done it already, they identified the issue after following the steps i told. They suggested then to check either with cloudflare support or w3tc, cause after running Firebug's "NET" the following info was:               HTTP/1.1 403 Forbidden     Server: cloudflare-nginx     Date: Wed, 25 Sep 2013 10:46:34 GMT     Content-Type: text/html; charset=UTF-8     Transfer-Encoding: chunked     Connection: keep-alive     X-Pingback: http://findout-macau.com/xmlrpc.php     Expires: Wed, 11 Jan 1984 05:00:00 GMT     Cache-Control: no-cache, must-revalidate, max-age=0     Pragma: no-cache     X-Powered-By: W3 Total Cache/0.9.3     X-W3TC-Minify: On     Link: <http://wp.me/3UMOt>; rel=shortlink     Vary: Accept-Encoding,User-Agent     CF-RAY: b3721978b0506dc     Content-Encoding: gzip      I've checked with cloudflare, and they let me know that usually this kinda of issue has to do with:               1. Permission rules you have set or an error in the .htaccess rules you have set.     2. Mod_security rules.     3. IP Deny rules      Nevertheless i've my .htaccess content below:               RedirectMatch 301 ^/wp-content/uploads/(.*)$ http://images.findout-macau.com/$1          # BEGIN W3TC Browser Cache     <IfModule mod_mime.c>     AddType text/css .css     AddType text/x-component .htc     AddType application/x-javascript .js     AddType application/javascript .js2     AddType text/javascript .js3     AddType text/x-js .js4     AddType text/html .html .htm     AddType text/richtext .rtf .rtx     AddType image/svg+xml .svg .svgz     AddType text/plain .txt     AddType text/xsd .xsd     AddType text/xsl .xsl     AddType text/xml .xml     AddType video/asf .asf .asx .wax .wmv .wmx     AddType video/avi .avi     AddType image/bmp .bmp     AddType application/java .class     AddType video/divx .divx     AddType application/msword .doc .docx     AddType application/vnd.ms-fontobject .eot     AddType application/x-msdownload .exe     AddType image/gif .gif     AddType application/x-gzip .gz .gzip     AddType image/x-icon .ico     AddType image/jpeg .jpg .jpeg .jpe     AddType application/json .json     AddType application/vnd.ms-access .mdb     AddType audio/midi .mid .midi     AddType video/quicktime .mov .qt     AddType audio/mpeg .mp3 .m4a     AddType video/mp4 .mp4 .m4v     AddType video/mpeg .mpeg .mpg .mpe     AddType application/vnd.ms-project .mpp     AddType application/x-font-otf .otf     AddType application/vnd.oasis.opendocument.database .odb     AddType application/vnd.oasis.opendocument.chart .odc     AddType application/vnd.oasis.opendocument.formula .odf     AddType application/vnd.oasis.opendocument.graphics .odg     AddType application/vnd.oasis.opendocument.presentation .odp     AddType application/vnd.oasis.opendocument.spreadsheet .ods     AddType application/vnd.oasis.opendocument.text .odt     AddType audio/ogg .ogg     AddType application/pdf .pdf     AddType image/png .png     AddType application/vnd.ms-powerpoint .pot .pps .ppt .pptx     AddType audio/x-realaudio .ra .ram     AddType application/x-shockwave-flash .swf     AddType application/x-tar .tar     AddType image/tiff .tif .tiff     AddType application/x-font-ttf .ttf .ttc     AddType audio/wav .wav     AddType audio/wma .wma     AddType application/vnd.ms-write .wri     AddType application/vnd.ms-excel .xla .xls .xlsx .xlt .xlw     AddType application/zip .zip     </IfModule>     <IfModule mod_expires.c>     ExpiresActive On     ExpiresByType text/css A31536000     ExpiresByType text/x-component A31536000     ExpiresByType application/x-javascript A31536000     ExpiresByType application/javascript A31536000     ExpiresByType text/javascript A31536000     ExpiresByType text/x-js A31536000     ExpiresByType text/html A3600     ExpiresByType text/richtext A3600     ExpiresByType image/svg+xml A3600     ExpiresByType text/plain A3600     ExpiresByType text/xsd A3600     ExpiresByType text/xsl A3600     ExpiresByType text/xml A3600     ExpiresByType video/asf A31536000     ExpiresByType video/avi A31536000     ExpiresByType image/bmp A31536000     ExpiresByType application/java A31536000     ExpiresByType video/divx A31536000     ExpiresByType application/msword A31536000     ExpiresByType application/vnd.ms-fontobject A31536000     ExpiresByType application/x-msdownload A31536000     ExpiresByType image/gif A31536000     ExpiresByType application/x-gzip A31536000     ExpiresByType image/x-icon A31536000     ExpiresByType image/jpeg A31536000     ExpiresByType application/json A31536000     ExpiresByType application/vnd.ms-access A31536000     ExpiresByType audio/midi A31536000     ExpiresByType video/quicktime A31536000     ExpiresByType audio/mpeg A31536000     ExpiresByType video/mp4 A31536000     ExpiresByType video/mpeg A31536000     ExpiresByType application/vnd.ms-project A31536000     ExpiresByType application/x-font-otf A31536000     ExpiresByType application/vnd.oasis.opendocument.database A31536000     ExpiresByType application/vnd.oasis.opendocument.chart A31536000     ExpiresByType application/vnd.oasis.opendocument.formula A31536000     ExpiresByType application/vnd.oasis.opendocument.graphics A31536000     ExpiresByType application/vnd.oasis.opendocument.presentation A31536000     ExpiresByType application/vnd.oasis.opendocument.spreadsheet A31536000     ExpiresByType application/vnd.oasis.opendocument.text A31536000     ExpiresByType audio/ogg A31536000     ExpiresByType application/pdf A31536000     ExpiresByType image/png A31536000     ExpiresByType application/vnd.ms-powerpoint A31536000     ExpiresByType audio/x-realaudio A31536000     ExpiresByType image/svg+xml A31536000     ExpiresByType application/x-shockwave-flash A31536000     ExpiresByType application/x-tar A31536000     ExpiresByType image/tiff A31536000     ExpiresByType application/x-font-ttf A31536000     ExpiresByType audio/wav A31536000     ExpiresByType audio/wma A31536000     ExpiresByType application/vnd.ms-write A31536000     ExpiresByType application/vnd.ms-excel A31536000     ExpiresByType application/zip A31536000     </IfModule>     <IfModule mod_deflate.c>     <IfModule mod_headers.c>         Header append Vary User-Agent env=!dont-vary     </IfModule>         AddOutputFilterByType DEFLATE text/css text/x-component application/x-javascript application/javascript text/javascript text/x-js text/html text/richtext image/svg+xml text/plain text/xsd text/xsl text/xml image/x-icon application/json     <IfModule mod_mime.c>         # DEFLATE by extension         AddOutputFilter DEFLATE js css htm html xml     </IfModule>     </IfModule>     <FilesMatch "\.(css|htc|js|js2|js3|js4|CSS|HTC|JS|JS2|JS3|JS4)$">     <IfModule mod_headers.c>         Header set Pragma "public"         Header append Cache-Control "public"          Header unset Set-Cookie          Header set X-Powered-By "W3 Total Cache/0.9.3"      </IfModule>      </FilesMatch>      <FilesMatch  "\.(html|htm|rtf|rtx|svg|svgz|txt|xsd|xsl|xml|HTML|HTM|RTF|RTX|SVG|SVGZ|TXT|XSD|XSL|XML)$">     <IfModule mod_headers.c>         Header set Pragma "public"         Header append Cache-Control "public"          Header set X-Powered-By "W3 Total Cache/0.9.3"      </IfModule>      </FilesMatch>      <FilesMatch "\.(asf|asx|wax|wmv|wmx|avi|bmp|class|divx|doc|docx|eot|exe|gif|gz|gzip|ico|jpg|jpeg|jpe|json|mdb|mid|midi|mov|qt|mp3|m4a|mp4|m4v|mpeg|mpg|mpe|mpp|otf|odb|odc|odf|odg|odp|ods|odt|ogg|pdf|png|pot|pps|ppt|pptx|ra|ram|svg|svgz|swf|tar|tif|tiff|ttf|ttc|wav|wma|wri|xla|xls|xlsx|xlt|xlw|zip|ASF|ASX|WAX|WMV|WMX|AVI|BMP|CLASS|DIVX|DOC|DOCX|EOT|EXE|GIF|GZ|GZIP|ICO|JPG|JPEG|JPE|JSON|MDB|MID|MIDI|MOV|QT|MP3|M4A|MP4|M4V|MPEG|MPG|MPE|MPP|OTF|ODB|ODC|ODF|ODG|ODP|ODS|ODT|OGG|PDF|PNG|POT|PPS|PPT|PPTX|RA|RAM|SVG|SVGZ|SWF|TAR|TIF|TIFF|TTF|TTC|WAV|WMA|WRI|XLA|XLS|XLSX|XLT|XLW|ZIP)$">     <IfModule mod_headers.c>         Header set Pragma "public"         Header append Cache-Control "public"          Header unset Set-Cookie          Header set X-Powered-By "W3 Total Cache/0.9.3"      </IfModule>      </FilesMatch>      # END W3TC Browser Cache      # BEGIN W3TC Page Cache core      <IfModule mod_rewrite.c>     RewriteEngine On     RewriteBase /     RewriteCond %{HTTPS} =on     RewriteRule .* - [E=W3TC_SSL:_ssl]     RewriteCond %{SERVER_PORT} =443     RewriteRule .* - [E=W3TC_SSL:_ssl]     RewriteCond %{HTTP:Accept-Encoding} gzip     RewriteRule .* - [E=W3TC_ENC:_gzip]     RewriteCond %{REQUEST_METHOD} !=POST     RewriteCond %{QUERY_STRING} =""     RewriteCond %{REQUEST_URI} \/$     RewriteCond %{HTTP_COOKIE} !(comment_author|wp\-postpass|w3tc_logged_out|wordpress_logged_in|wptouch_switch_toggle) [NC]     RewriteCond "%{DOCUMENT_ROOT}/wp-content/cache/page_enhanced/%{HTTP_HOST}/%{REQUEST_URI}/_index%{ENV:W3TC_SSL}.html%{ENV:W3TC_ENC}" -f     RewriteRule .* "/wp-content/cache/page_enhanced/%{HTTP_HOST}/%{REQUEST_URI}/_index%{ENV:W3TC_SSL}.html%{ENV:W3TC_ENC}" [L]     </IfModule>     # END W3TC Page Cache core     # BEGIN WordPress     <IfModule mod_rewrite.c>     RewriteEngine On     RewriteBase /     RewriteRule ^index\.php$ - [L]     RewriteCond %{REQUEST_FILENAME} !-f     RewriteCond %{REQUEST_FILENAME} !-d     RewriteRule . /index.php [L]     </IfModule>          # END WordPress      What i'ld like to know is some tip on how to solve this? Does someone believes to know how to get through this?


title: Remove category link

text: I want to use categories but I also want to remove the category pages.               http://www.example.com/categories/foo/      Assumed that this category exists this URL should return a 301 and redirect to               http://example.com/index.php      I've tried to add a `category.php` to my theme but this won't work for me. I don't want to hide posts with a specific category or remove the category base or something like that. I'm using WordPress 3.6.1.


title: How to set up htaccess to redirect a particular post type or subdirectory to HTTPS?

text: I have a post type with the slug 'open-tour', so all its pages are under www.domain.com/open-tour/. **I need all the pages under this "directory" to go to HTTPS (for credit card payments).** I can redirect a single URL okay, but the dynamic stuff goes a bit over my head. Maybe it's also because I don't know how/where to write the redirect in relation to Wordpress's htaccess block. Anyway here's the latest iteration of my fail code:               RewriteEngine on     RewriteCond %{HTTPS} off     RewriteCond %{http_host} ^www.domain.com/open-tour/(.*) [nc]     RewriteRule ^(.*)$ https://www.domain.com/open-tour/$1 [r=301,nc]       Can anyone tell me what I'm doing wrong here? EDIT: Thanks JMa and Pothi! Now, is there a way to make another rule that is the reverse of this? That is, if the user is viewing a page that's NOT in the open-tour directory, then redirect to HTTP? I tried the following code, but it didn't work. Is says "Firefox has detected that the server is redirecting the request for this address in a way that will never complete."               RewriteEngine On     RewriteBase /      RewriteCond %{HTTPS} on      RewriteRule !^open-tour/(.*) https://%{SERVER_NAME}/open-tour/$1 [R,L]      I figured it would be a simple matter of adding the exclamation point, but I guess not. Sorry I wrote this in a comment below, but it wasn't formatted very nice :P This whole thing wouldn't be an issue, but unfortunately once you get to the HTTPS page and go elsewhere on the site, the HTTPS sticks. I have a Constant Contact plugin that pulls up a warning for trying to pull unencrypted data to an encrypted https protocol.


title: What action to use for when a post is saved / published, with a caveat

text: I'm trying to do some stuff when a post has been saved, I'm currently using the `save_post` action, of which generally works. However, the problem I'm having is when a post is scheduled it fires the `save_post` action, of which changes some data I don't want it to. Is there an action of which fires **only** when the user clicks publish / save in the post edit screen, and **not** when a post changes schedule status.


title: Exclude the category of the current post

text: I have a simple site that shows one random post when you reach it. This post then has a link below it that, when clicked, will pull in another random post to that homepage, excluding all posts from the category that the current post is in. Eg. A post from category 'Bikes' is shown. Below it is a link that needs to replace that post with another random post from all the categories excluding the posts in 'Bikes' I am finding it easy to find code for excluding a set category but i can't find a way to read what post category is shown on the page and exclude only that. I would greatly appreciate any advice. WordPress Version 3.1


title: Unable to Change "Pages:" Before WP_LINK_PAGES

text: Below is a functions.php code for wp_link_pages which allows pagination and previous/next links to be displayed. It also wraps each pagination link in a span class called "classlinks". I need to change the default "Pages:" before the pagination while maintaining the rest of the code. My attempts removed the ability to show both next/previous links and pagination. Any help?               // WP_LINK_PAGES: Add prev and next links to a numbered link list     add_filter('wp_link_pages_args', 'wp_link_pages_args_prevnext_add');              function wp_link_pages_args_prevnext_add($args)     {         global $page, $numpages, $more, $pagenow;              if($page-1) # there is a previous page             $args['before'] .= ' '. _wp_link_page($page-1)                  . $args['link_before'] . $args['previouspagelink']  . '' . ' '             ;              if ($page<$numpages) # there is a next page             $args['after'] = ' '. _wp_link_page($page+1)                . $args['link_before'] . $args['nextpagelink']  . ''             ;              $args['link_before'] = '';         $args['link_after'] = '';              return $args;     }


title: Set order of returned items in the WP_Query() class/function

text: I have this function which gives me `IDs` and `titles` of all `child pages` of a given `parent ID`.               function getPageChildren($page_id) {            $my_wp_query = new WP_Query();       $all_wp_pages = $my_wp_query->query(array('post_type' => 'page'));            $page_children = get_page_children($page_id, $all_wp_pages);            foreach ($page_children as $p) {             $tmp['id'] = $p->ID;         $tmp['title'] = $p->post_title;             $pages[] = $tmp;       }            return $pages;         }      I want some way of ordering them in the backend, which I'd presume is done in the page attributes box of the edit page in the `Order` field? I have amended my the second statement in the above with the following:               $all_wp_pages = $my_wp_query->query(array('post_type' => 'page', 'sort_order' => 'ASC', 'sort_column' => 'menu_order'));      hoping this would tell the function to talke into account the order I specify, but this doesn't seem to work. Can anyone tell me how I am supposed to order the results of my function from the backend please? Thanks


title: Add an attachment feature to comments

text: Is there a way to allow attachments with wordpress comments? I know of a paid plugin that allows this but I was hoping for someone to point me in the correct direction that's future proof and doesn't rely on plugins. Ideally I would want the attachment to be connected to the post itself so we could query all the attachments if needed. Thanks!


title: Custom Attachment Type

text: I want to create a "photography" custom post type which uses attachment's same edit/upload panel. Exact same panels usage for "attachment" post type but with "photography" name. Is it possible?


title: WP_Query and two custom fields returns no posts

text: Having trouble with WP_Query returning no posts when filtering on two custom fields, although testing for each custom field individually works perfectly. After reviewing documentation for custom field parameters I'm obviously still missing something. Thank you in advance for any assistance or ideas. Query that produces no posts:               $query = new WP_Query(array(     'post_type'=>'games',     'orderby'=>'menu_order',     'order'=>'asc',     'posts_per_page' => 1,     'meta_query'=> array(         'relation'=>'AND',         array(             'key'=>'game_date_time',             'value'=>$nowtoday,             'compare' =>'>'         ),         array(             'key'=>'home_team',             'value'=>'Allen',             'compare'=>'LIKE'           )     )     ));          SQL produced:                `SELECT SQL_CALC_FOUND_ROWS wp_posts.ID FROM wp_posts INNER JOIN wp_postmeta ON (wp_posts.ID = wp_postmeta.post_id) INNER JOIN wp_postmeta AS mt1 ON (wp_posts.ID = mt1.post_id) WHERE 1=1 AND wp_posts.post_type = 'games' AND (wp_posts.post_status = 'publish' OR wp_posts.post_status = 'private') AND ( (wp_postmeta.meta_key = 'game_date_time' AND CAST(wp_postmeta.meta_value AS CHAR) > '3/5/2014 23:12') AND (mt1.meta_key = 'home_team' AND CAST(mt1.meta_value AS CHAR) LIKE '%Allen%') ) GROUP BY wp_posts.ID ORDER BY wp_posts.menu_order asc LIMIT 0, 1`      The var `$nowtoday` is a formatted timestamp for comparing against the custom field `game_date_time`. Querying only on `game_date_time` yields the expected result. Here is that query and it returns the next chronological game (home or away) as intended.               $query = new WP_Query(array(     'post_type'=>'games',     'orderby'=>'menu_order',     'order'=>'asc',     'posts_per_page' => 1,     'meta_query'=> array(         'relation'=>'AND',         array(             'key'=>'game_date_time',             'value'=>$nowtoday,             'compare' =>'>'         ),         array(            /* 'key'=>'home_team',             'value'=>'Allen',             'compare'=>'LIKE'  */         )     )     ));      SQL produced:               `SELECT SQL_CALC_FOUND_ROWS wp_posts.ID FROM wp_posts INNER JOIN wp_postmeta ON (wp_posts.ID = wp_postmeta.post_id) WHERE 1=1 AND wp_posts.post_type = 'games' AND (wp_posts.post_status = 'publish' OR wp_posts.post_status = 'private') AND ( (wp_postmeta.meta_key = 'game_date_time' AND CAST(wp_postmeta.meta_value AS CHAR) > '3/5/2014 23:11') ) GROUP BY wp_posts.ID ORDER BY wp_posts.menu_order asc LIMIT 0, 1`      Similarly, the modified query to return only home games, that is to say, where home_game is LIKE 'Allen', returns the expected result.               $query = new WP_Query(array(     'post_type'=>'games',     'orderby'=>'menu_order',     'order'=>'asc',     'posts_per_page' => 1,     'meta_query'=> array(         'relation'=>'AND',         array(            /*  'key'=>'game_date_time',             'value'=>$nowtoday,             'compare' =>'>'  */         ),         array(            'key'=>'home_team',             'value'=>'Allen',             'compare'=>'LIKE'           )     )     ));      SQL produced:               `SELECT SQL_CALC_FOUND_ROWS wp_posts.ID FROM wp_posts INNER JOIN wp_postmeta ON (wp_posts.ID = wp_postmeta.post_id) WHERE 1=1 AND wp_posts.post_type = 'games' AND (wp_posts.post_status = 'publish' OR wp_posts.post_status = 'private') AND ( (wp_postmeta.meta_key = 'home_team' AND CAST(wp_postmeta.meta_value AS CHAR) LIKE '%Allen%') ) GROUP BY wp_posts.ID ORDER BY wp_posts.menu_order asc LIMIT 0, 1`      The puzzle is why the two filters together produce no result, when there are numerous posts that meet both conditions, `game_date_time > $nowtoday AND home_team LIKE 'Allen'`. Thank you for your time and any suggestions toward a solution!


title: Advanced Custom Fields - Query Efficiency

text:
For testing purposes I have edited page.php to have nothing other than:               <?php while ( have_posts() ) : the_post(); ?>
<?php the_title(); ?>
     <?php $site_options = get_fields('options'); ?>     <?php endwhile; ?>      I removed get_header, get_footer and only have ACF plugins enabled because I am still early in development and doing some initial testing. When I view the page without calling get_fields it reports 9 queries but if I visit the page with get_fields it jumps to 72 queries. It seems like that should only bump by 1 or 2 queries...not 63. Queries are reported using:               get_num_queries();      Results from get_options call:               Array(     [main_ad_-_image] => Array         (             [id] => 25             [alt] => TEST             [title] => lg-social_media             [caption] =>              [description] =>              [mime_type] => image/png             [url] => {urlhere}             [width] => 460             [height] => 260             [sizes] => Array                 (                     [thumbnail] => {urlhere}/wp-content/uploads/lg-social_media-150x150.png                     [thumbnail-width] => 150                     [thumbnail-height] => 150                     [medium] => {urlhere}/wp-content/uploads/lg-social_media-220x124.png                     [medium-width] => 220                     [medium-height] => 124                     [large] => {urlhere}/wp-content/uploads/lg-social_media.png                     [large-width] => 460                     [large-height] => 260                 )              )          [main_ad_-_url_type] => ext     [main_ad_-_url] => www.google.com     [small_ad_1_-_image] => Array         (             [id] => 28             [alt] => Fake Text             [title] => fake-text             [caption] =>              [description] =>              [mime_type] => image/png             [url] => {urlhere}/wp-content/uploads/fake-text.png             [width] => 220             [height] => 120             [sizes] => Array                 (                     [thumbnail] => {urlhere}/wp-content/uploads/sm-fake-text-150x120.png                     [thumbnail-width] => 150                     [thumbnail-height] => 120                     [medium] => {urlhere}/wp-content/uploads/sm-fake-text.png                     [medium-width] => 220                     [medium-height] => 120                     [large] => {urlhere}/wp-content/uploads/sm-fake-text.png                     [large-width] => 220                     [large-height] => 120                 )              )          [small_ad_1_-_url_type] => ext     [small_ad_2_-_image] => Array         (             [id] => 30             [alt] => Fake Text 2             [title] => fake-text2             [caption] =>              [description] =>              [mime_type] => image/png             [url] => {urlhere}/wp-content/uploads/fake-text2.png             [width] => 220             [height] => 120             [sizes] => Array                 (                     [thumbnail] => {urlhere}/wp-content/uploads/fake-text2-150x120.png                     [thumbnail-width] => 150                     [thumbnail-height] => 120                     [medium] => {urlhere}/wp-content/uploads/fake-text2.png                     [medium-width] => 220                     [medium-height] => 120                     [large] => {urlhere}/wp-content/uploads/fake-text2.png                     [large-width] => 220                     [large-height] => 120                 )              )          [small_ad_1_-_url] => www.google.com     [main_ad_-_page] => {urlhere}     [small_ad_2_-_url_type] => ext     [small_ad_2_-_url] => www.google.com     [small_ad_3_-_image] => Array         (             [id] => 27             [alt] => Fake Text 3             [title] => fake-text3             [caption] =>              [description] =>              [mime_type] => image/png             [url] => {urlhere}/wp-content/uploads/fake-text3.png             [width] => 220             [height] => 120             [sizes] => Array                 (                     [thumbnail] => {urlhere}/wp-content/uploads/fake-text3-150x120.png                     [thumbnail-width] => 150                     [thumbnail-height] => 120                     [medium] => {urlhere}/wp-content/uploads/fake-text3.png                     [medium-width] => 220                     [medium-height] => 120                     [large] => {urlhere}/wp-content/uploads/fake-text3.png                     [large-width] => 220                     [large-height] => 120                 )              )          [small_ad_3_-_url_type] => ext     [small_ad_3_-_url] => www.google.com     [small_ad_4_-_image] => Array         (             [id] => 29             [alt] => Fake Text 4             [title] => fake-text4             [caption] =>              [description] =>              [mime_type] => image/png             [url] => {urlhere}/wp-content/uploads/fake-text4.png             [width] => 220             [height] => 120             [sizes] => Array                 (                     [thumbnail] => {urlhere}/wp-content/uploads/fake-text4-150x120.png                     [thumbnail-width] => 150                     [thumbnail-height] => 120                     [medium] => {urlhere}/wp-content/uploads/fake-text4.png                     [medium-width] => 220                     [medium-height] => 120                     [large] => {urlhere}/wp-content/uploads/fake-text4.png                     [large-width] => 220                     [large-height] => 120                 )              )          [small_ad_4_-_url_type] => ext     [small_ad_4_-_url] => www.google.com     [facebook] => www.facebook.com     [twitter] => twitter.com     [youtube] => www.youtube.com     [office_address] => text     [office_address_-_google_url] => test     [office_-_phone] => 1234567890     [office_-_800_#] => 8001234567     [office_-_email] => email@email.com)      Should I be concerned about this?


title: How / where is the  wp_query object created for RSS feeds?

text: Looking at the code in feed-rss2.php and feeds-rss2-comments.php, after the header preamble, we have a Loop - eg in feeds-rss2-comments.php:               if ( have_comments() ) : while ( have_comments() ) : the_comment();     $comment_post = get_post($comment->comment_post_ID);     get_post_custom($comment_post->ID);      Where is the wp_comment_query object being created for this loop? What I'm doing (following my question yesterday), is creating 2 new RSS feeds - one showing posts that have been trashed, the other showing comments that have been trashed. It's easy enough to add a new query_posts / get_comments call, but is there a more efficient way of doing it?


title: Strip <p> on get_the_content_limit

text: I would like to remove the paragraph tags < p > it generates, i tried adding strip tags but it doesn't seem to work.               function the_content_limit( $max_characters, $more_link_text = '(more...)', $stripteaser = false ) {          $content = get_the_content_limit( $max_characters, $more_link_text, $stripteaser );         echo apply_filters( 'the_content_limit', $content );    }


title: Settings API Multiple Checkbox in General Settings

text:
I am trying to add a custom setting at General Settings page with checkboxes. My plan to this is for users to select appropriate categories for their blog based on a list of categories through checkboxes. I use the code below.               $new_general_setting = new new_general_setting();          class new_general_setting {         function new_general_setting( ) {             add_filter( 'admin_init' , array( &$this , 'register_fields' ) );         }         function register_fields() {             register_setting( 'general', 'mystore_categories', 'esc_attr' );             add_settings_field('mystore_categories', ''.__('Store Category' , 'favorite_color' ).'' , array(&$this, 'mystore_categories_func') , 'general' );         }         function mystore_categories_func() {         $options = get_option('mystore_categories');         $portfolio_cats = ( is_array( $options['mystore_categories'] ) ) ? array_map( 'absint', $options['mystore_categories'] ) : array();         $blog_id = 1;         switch_to_blog($blog_id);         $hiterms = get_terms( 'product_category', array( 'hide_empty' => 0, 'parent' => 0) );              foreach ($hiterms as $hiterm) {           // $checked = $options[mystore_categories][$loterm->term_id] ? ' checked="checked"' : '';           echo '<input type="checkbox" name="mystore_categories[]" value="' . $hiterm->term_id . '" ' . checked( in_array( absint( $hiterm->term_id ),$portfolio_cats ),true ) . '> ' . $hiterm->name . '
';           $loterms = get_terms('product_category', array('orderby' => 'slug', 'parent' => $hiterm->term_id, 'hide_empty' => 0));           if($loterms) {             foreach($loterms as $loterm) {               echo '<input type="checkbox" name="mystore_categories[]" value="' . $loterm->term_id . '" style="margin-left:25px;" ' . checked( in_array( absint( $loterm->term_id ),$portfolio_cats ),true ) . '> ' . $loterm->name . '
';             }           }         }              restore_current_blog();         echo '
Select the category or categories that suits what you sell.';         }     }      However, when submitting the page, the checked ones are not getting checked. Also, when I echo the $options[mystore_categories] its empty. Please help


title: Is it possible to add post specific info in head of worpress post for OG use

text: Im trying to implement this OG features on my site. http://www.jwplayer.com/blog/publish-your-videos-to-facebook-with-a-jw-player/ Is it possible to get post title, thumbnail url, and place it in the head section of a wordpress single post page? Thanks


title: WP_Query using OR arguments e.g. posts in Category OR has Tag

text: I'm wondering if it's possible to use WP_Query() to filter posts by multiple OR arguments. I'd like to retrieve all posts that are in a category OR have a tag. If this is not possible using WP_Query(), what would be the easiest way to achieve this? The code below filters posts that are in cat 1 AND have tag 2. I need posts that are in cat 1 OR have tag 2.               $args = array(       'cat' => '1',       'tag' => '2',       'post_type' => 'post',       'posts_per_page' => -1     );          $the_query = new WP_Query( $args );


title: Customise Wordpress Update Notice in wp-admin backend area

text: Is there any way to customise the wordpress update notice in the backend admin area? ![wordpress 3.9 update notice](http://i.stack.imgur.com/9y6Hx.png) I want to make it so that I can change the **Please update now** to **Please contact now** and link to a different URL. So the person running the website doesn't update the website, since they don't know how to back up the website. I have found ways to hide the notice online, but no way to actually edit it.


title: Check if user registered more than a month ago

text: How would I go about checking if current user registered more than, say, 30 days ago? I would like to display certain content only to that group of users. Thanks very much in advance for your help.


title: sql query to put quotes around numbers in img tag

text: I have quite a few old posts that contain an img tag with height and width with no double quotes around the numbers. For example:               <img height=319 alt="" src="http://www.example.com/images/myexample.jpg" width=496>      I am not sure how to write a MySQL query that can find the height and width numbers, and surround them with double quotes. Although a MySQL query is preferred, if this is not possible then perhaps someone could suggest a regular expression I could use with a PHP script that might solve this issue.


title: Setting admin edit panels & metaboxes positions and visibility for ALL users and admins

text: My WP 3.3 setup involves several post types and customized edit panels with Advanced Custom Fields plugin (which creates many metaboxes) and other plugins such as SEO metabox panel, Scribu's Posts2Posts connections and more. The problem is, the appearance order of these panels is often quite random (even if Adavanced Custom Fields offers some sort of ordering, but it doesn't always work, since other plugins don't have it and furthermore I might want to change metabox positions according to post types). Now, Wordpress allows each administrator / user with proper rights to arrange the metaboxes in edit panels the way he/she wants. However... every admin has to arrange their own!! Isn't there a way to prepare a default/fixed ordering or let superadmin or one admin in particular to set the panels position for EVERYBODY? I have at least 4 admins and few editors/authors... it doesn't make sense I have to set up their panels logging in with EACH of their accounts... it's stupid and time consuming, and confusing for non wordpress savvy users. Is there any plugin or code snippet that could help my case? thank you


title: Set Default User Role

text: I'm using WordPress 3.3.1. When a user registers, I want to be able to set the new user to an author. How would I do this?


title: Target Post Type from array Query

text: I have the following query to extract posts from two different types. However, how can I then target them in the actual content display conditional code? The if ($my_query->post_type == 'featured' ) does not work. I also tried if (post_type == 'featured' ).                   <?php      // query posts     $my_query = new WP_Query             ( array(             'post_status' => 'publish',             'post_type'   => array('featured', 'wpsc-product'),             'orderby'     => 'menu_order',             'order'       => 'ASC',             'showposts'   => 50 ));           while( $my_query->have_posts() ) : $my_query->the_post();     $fitemlink = get_post_meta($post->ID,'new_fitemlink',true);                // display the content           if ($my_query->post_type == 'featured' ) {      echo get_image_path(get_post_meta($post->ID, 'slideimage_src', true));          } else if ($my_query->post_type == 'wpsc-product' ) {      echo wpsc_the_product_image(); }           endwhile; ?>


title: Automatic Shortcode Creation with Custom Fields

text: This is basically a php issue as I'm fairly new to it and can't figure out how to code things the way I want. I am basically trying to pull information from custom fields (grid reference) and post titles etc to then write out a (long) shortcode. This shortcode creates a map (OS OpenSpace Maps Plugin) Currently I have successfully got code to print out (echo) the shortcode, and then I have to edit it slightly, removing spaces and a few obsolete characters, then manually paste this back into template using 'do_shortcode' The correct format of the shortcode is:               [osmap markers="HU123456;Link 1|HU123456;Link 2...etc"]      My current code to print on the screen is:               <?php     echo '[osmap width="800" height="600" markers="';     $args=array(       'post_type' => 'sport-crag',       'post_status' => 'publish',       'posts_per_page' => -1,       'caller_get_posts'=> 1       );     $my_query = null;     $my_query = new WP_Query($args);     if( $my_query->have_posts() ) {       while ($my_query->have_posts()) : $my_query->the_post(); ?>       <?php echo get_post_meta($post->ID,'gridref', true);?>;<a href=\'<?php the_permalink() ?>\'><?php the_title(); ?>|       <?php       endwhile;     }     wp_reset_query();  // Restore global post data stomped by the_post().     echo '"]';     ?>      What I really want to do is put all this inside the 'do_shortcode' function. There are also a few issues with my solution so far that I can't figure out how to sort.   1. Grid references often have spaces in them (e.g. HU 123 456), but this will not work in the shortcode so they need the spaces taking out (HU123456).   2. My code puts a final '|' after the last entry which needs to be removed. Not sure how to do this though as its part of the while loop. Any help to get this an automatic process all inside the php would be much appreciated! It only takes 5 mins at the moment, but the issue is that if any other posts are added, the process has to be redone before they appear on the map, so it will get annoying. I also have 4 maps for different post types so it will get very irritating!


title: Getting a specific "title for a section" only on Startpage?

text: I have a website which shows alle posts from my wordpress on the startpage. thanks to Stephen Harris who helped me with this code I put in the functions.php:               add_action('pre_get_posts','wpse57309_alter_front_page_query');     function wpse57309_alter_front_page_query( $query ){          if( $query->is_main_query() && is_front_page() ){              if( !$query->get('post_type') ){                  //post type is not set, the default will be an array of them:                  $query->set('post_type',array( 'movies', 'music', 'featued'));              }          }     }      Now I have another problem: I am getting the titles for each section by using this code here:               <?php wp_reset_query(); ?>     <?php echo $post->post_type; ?>      in between h2 tags - but now on Startpage I get different names of the post type - but I'd like to have just: "Home" as Title... I tried it with is_home() and with is_front_page() but I had no luck. Also the "post_type" is set to one specific on this page. I have built in a filter which filters on click the posts using a `&style=soul` but on startpage its now always one specific post_type. I guess its the last post's post_type... Maybe someone has a hint?


title: Advice for Beginner in Wordpress

text: I am very new to the wordpress. My simple objective is i want to create one website with database. I have donwloaded wordpress. After this how should i start installing and configuring my local setup before uploading my site into a webserver. Please help. Regards Dinesh.


title: problem with has_post_thumpnail in foreach loop

text:
I have a code that display the post if has_post_thumpnail the problem is it shows all the posts wheather it has thumpnail or not                   <?php      global $post;     $args = array( 'numberposts' => 5 );      $postQuery = get_posts($args);      $num  = 0;      foreach( $postQuery as $post ) : setup_postdata($post);                  if ( has_post_thumbnail() ) { ?>
                          <a href="<?php echo get_permalink(); ?>" title="Go to <?php echo the_title(); ?>" rel="bookmark">                         <?php the_post_thumbnail('medium'); ?>

                     <?php the_title('
','
'); ?>                              <?php the_content();  ?>
             <?php              }         endforeach; ?>


title: Applying if (get_post_meta) to new shortcode

text: It's my first time here so here goes :) I've created a custom image field which allows me to upload new images, or have images added via a form from the frontend. I want these to display. I'm creating a shortcode like so:                   function display_ad() {         global $post;         return do_shortcode( '' . 'ID , "wpcf-display-ad" , true ) . '"/>' . '' );         }         add_shortcode('display-ad', 'display_ad');      This works fine - images are displayed and link to their respective post, but for posts that don't contain a display image, the src tag still returns (and any css, for example a border, too). I'm struggling to figure out how to apply the if statement to the above code, i.e:                   if ( get_post_meta( $post->ID , "wpcf-display-ad" , true ) ) :      ... so that if an image doesn't exist then nothing is returned. * * * Hi Abdussamad Thanks for your suggestions. I've just spent the last hour trying to wrap my head around them and them to work, but no joy. I must warn you I'm very much at the early stages of PHP :) Here's what I've done based on your comments:               function display_ad() {     global $post;     $content = get_permalink($id);     $ad_image = get_post_meta( $post->ID , "wpcf-display-ad" , true );     if( empty( get_post_meta( $post->ID, 'wpcf-display-ad', true ) ) ) {     return $content;     } else {     return $content . $ad_image;     }     }     add_shortcode('display-ad', 'display_ad');      However, this just returns a white screen. I have two posts up at the moment on my development site (one with a display ad, the other not), and if I remove the if statement bit, and just `return $content;` then the posts and their permalinks display. If I just `return $ad_image;` again the posts display together, one showing the path to the image, the other blank (but present in Chrome's Developer Tools panel). However, with the if statement I get the white screen. Evidently I'm doing something wrong. Thanks for your help. Gavin.


title: Why is jQuery not working properly?

text: I've enqueue'd jQuery from Google and it's displaying in the source code but no matter where I put my scripts they don't seem to work. Here is the site in question - http://www.deanelliott.me/handh/ Near the bottom of the page, there are a couple of testimonials, these should appear one at a time in a slideshow, but, as you can see that's not happening. I'm not a jQuery master by any means but I can hold my own and I've never had any issues before... Any help would be greatly appreciated


title: update_option onclick

text: I'm trying to add a update_option value when I click a text link. I came up with the following code, but I don't know how to make it "clickable", like                   <?php          function toggle_chat_front_end()          {                update_option("show_chat","true");          }          add_action("show_chat", "toggle_chat_front_end");     ?>      ### It should work as "Enable/Disable Chat" <\-- Clickable link Also, that would change the value to true, right? How can I make a "toggle" out of it? On and off ### show_chat code:                 if (get_option( 'show_chat' ) != "") {               if(!is_plugin_active('online-chat/online-chat.php'))            activate_plugins('online-chat/online-chat.php');               } else {              if(is_plugin_active('online-chat/online-chat.php'))            deactivate_plugins('online-chat/online-chat.php');                }          }      Thanks for your time!


title: Template for page with overridden Theme

text: I think I've got a somewhat uncommon issue. My wordpress site uses a custom theme, but I wanted to add a blog alongside that, without using multisite because my host charges 3x the amount for such a feature. What I found was the ability to override an individual page's theme using a plugin, called Page Theme (Click for theme home page). This worked great - until I tried to load posts of a specific category. I have a new category with slug blog-posts, cat=14, which are the only ones I want to show up on the page. I set my site's default theme back to my Custom Theme, then overrode the Blog page to be the twentytwelve theme. I then set the page template to a php file that queries for my blog posts (following instructions similar to these) However, all of the formatting is lost. If I go to my site's settings, Reading > Static Page > and then select the Blog page for Posts, the formatting is back, but its showing EVERY post. I realized the templates I can select, because I have my Custom Theme set to default, are only those in my /themes/CustomTheme/.. folder. I also learned that when you select the static posts page, it will look up the index.php for that theme (in this case, twentytwelves index, which looks great!)... But I'm not sure how to QUERY for the posts I would like, while maintaining the TwentyTwelve theme format. Any guidance is very much appreciated. 4 hours spent on this and I'm just where I started :( Charlie


title: Shopping plugin with user groups

text: We need to implement different user groups on our new WP-site so every group has it's own price for every product. For example: "retail customers" and "wholesale customers". Is there an appropriate solution that works out of the box? If not, what approach should you recommend to achieve this? Maybe some combination of plugins will do? We really don't want to create separate domains or to have duplicate items in our shop. Thanks!


title: mobile vs responsive sites

text: A web company for a medical clinic in the US is telling me that it is cheaper for them to build regular WP site and a separate WP mobile site than a single WP responsive site. What is the conventional wisdom which is better. Is responsive just for those who can't afford a regular and a mobile site or does it handle more devices than a mobile site?


title: How to use wildcards in $wpdb queries using $wpdb->get_results & $wpdb->prepare?

text: I am attempting to make a custom search for BuddyPress groups. Here is my method:               public function search_groups($string){         global $wpdb;         $results = $wpdb->get_results($wpdb->prepare(             "             SELECT *              FROM {$wpdb->prefix}bp_groups              WHERE `name` LIKE '%%s%'             AND `description` LIKE '%%s%'              AND `status` = 'public'             ORDER BY `name` ASC             ",             $string,             $string         ));         if(!empty($results)){             $return = $results;         } else{             $return = false;             }         return $return;     }      However, I am receiving a WordPress database error. I'm pretty sure it's due to the fact that I'm using `$wpdb->prepare();`, since it uses % signs for replacing variables. Let's take a look at this portion of my query:               WHERE `name` LIKE '%%s%'     AND `description` LIKE '%%s%'      That just looks like trouble. Is there any way that I can accomplish something along the lines of...               WHERE `name` LIKE '%{$string}%'     AND `description` LIKE '%{$string}%'      and still use the `$wpdb->prepare();` method?


title: using wp_redirect to redirect to a permalink

text: I'm using wp_redirect to change the URL of my 404 page:               function show_404($message = 'page not found'){        wp_redirect(home_url() . '/error/404?m=' . urlencode($message));        exit();     }      I have created a wordpress page that has a `/error/` permalink. It works fine on my local WAMP environment (properly showing my themed 404 page when navigating to `localhost/wordpress/pageThatDNE`), but when I test it to a real server, I get a `The requested URL /error/404 was not found on this server.` message. Navigating to `mysite.com/error/` gives me a `You don't have permission to access /error/ on this server.` message. My other pages/permalinks work fine. Any ideas how to resolve this?


title: How to restricted a page [without plugin]

text: How to restricted a page in wordpress. For example : user [ _without login_ ] can see 5 of game list. [example.com/game/] and after click 'view more', **user must login/register** and after that, user **can access full/100 game list**. [example.com/game/] Anyone know to make it without plugin? thank you


title: How to add options to the plugin page?

text:
I can't find a more or less clear example on how to create additional fields, so may be someone can help me here? Here is my code:               function __construct(){         add_action('admin_init', array($this, 'plugin_admin_init'));     }          public function create_fields(){         register_setting('dleToWp_options', 'database_name');         register_setting('dleToWp_options', 'database_prefix');         register_setting('dleToWp_options', 'version');         //Stuck here         // add_settings_section('dleToWp_options', __('Settings', 'dleToWp'), NULL, 'dleToWp');         // add_settings_field('plugin_text_string', 'Plugin Text Input', 'plugin_setting_string', 'plugin', 'dleToWp');     }          public function settings_page(){              echo '

'.__('Database converter', 'dleToWp').'
             <form action="options.php" method="post">';         settings_fields('dleToWp_options');         do_settings_sections('dleToWp');         echo '</form>
';     }      I nee create 3 fields: Database name, database prefix and select box of versions.


title: How to link a custom post type to a page that uses a template that is a child page?

text: I only have 4 links on my navigation. One of those links is "Neighborhoods". I have created a custom post type so that client can enter new neighborhoods as a menu item on a another page and so that they can enter a custom URL for that menu item. Then i create the Neighborhood page from a template (lets call it Adams Morgan) and the default URL to the site once created is domain/adams-morgan and now i'll present two possible options for why i can't properly link the menu item to the page. On custom post type "Neighborhoods" in the custom field URL box i enter "adams-morgan" assuming it should link to that postname permalink. Instead what it does is change the URL to domain/neighborhoods/adams-morgan and doesn't take me to the actual page which is at domain/adams-morgan. I then tried to make Adams Morgan a child of the Neighborhoods page but all that did was change the URL to domain/neighborhoods/adams-morgan. I know what you're thinking that should've worked because it now matches the one i mention a couple of lines up but the reality is that this page that is created looks like a single blog post page without any content and just uses the "Adams Morgan" name as a title to its content-less page instead of taking me to the actual Adams Morgan page that has styled content? In a perfect world i would like my URL to read domain/neighborhoods/adams- morgan but that page only takes me to a single post looking page. The other URL of domain/adams-morgan takes me to the styled page (when i remove Neighborhoods as the parent to this page) i can actually see the page but when i tried to make the Adams Morgan page a child of the Neighborhoods page the URL domain/adams-morgan ceased to exist and now would forward straight to domain/neighborhoods/adams-morgan. Any suggestions why it does this? What's strange to


title: How to create a custom sort for WordPress categories

text:
I have this problem that I am encountering. I am trying to sort my categories to display in the order that I want them to. I have read the WordPress documentation on all of the sort options. However, there is no inclination of how to choose the categories and make them flow the way I want. This is what the Codex presents:   > **orderby** (string) Sort categories alphabetically or by unique category > ID. The default is sort by Category ID. Valid values:   >  \- id   >  \- name - default   >  \- slug   >  \- count   >  \- term_group > > **order** (string) Sort order for categories (either ascending or > descending). The default is ascending. Valid values:   >  \- asc - default   >  \- desc However, like I said, this does not help me because I need them to display in the order I choose. Here is the code I am implementing at the moment. Which is in the order that I want them to display.               <?php     $args = array(     'orderby' => 'ID',     'order' => 'ASC',     'include' => '5,6,7,8,29,9,10,11,12,13,14,15,16'     );     $categories = get_categories($args);     foreach($categories as $category) {     echo '
term_id ) . '" title="' . sprintf(     __( "View all posts in %s" ), $category->name ) . '" ' . '>' . $category->name . '' . ' ' . '(' . $category->count . ')' . '
 ';     }     ?>


title: What Features would you Most Like to See Added to WordPress?

text: I'm creating a **community wiki** to ask the following question:   * _**What features would you most like to see added to WordPress?_** ### This Question Implies a Few Things:   * It should surface the **_features enthusiasts want most_** , not just drive bys from people who can't be bothered to know that the _"P"_ needs to be capitalized ( _inside joke. Of course..._ )   * **Favor features that benefit the more advanced users** and especially the **theme and/or plugin developers**.   * Also **favor APIs** and **other enablers** vs. just yet another new UI widget. Examples of this might be a Backup API that many developers could build on top of, or a Twitter API that themers could build on.   * Focus on **only the few things you really want most** , not everything you can think of. Don't let this be a dumping ground for everything you can think of or have ever thought of. When adding a wanted feature ask yourself if you'd prefer to have it or your _top 3_ features; if not maybe you shouldn't add it.    * **Give some great details** including, if appropriate: A. **Wireframes** (maybe using Balsamiq?), B. **API Interfaces** C. **Suggested Hooks** D. **URL Structures** E. And more. F. Even **Source code**   * **Significant Features Only** , please. Don't add something like _"I want the admin console to be purple"_ or _"I really want the admin menu to be on the right."_   * _**Avoid things that onlyAutomattic can control_** like things on WordPress.com!! (not that enthusiasts would care, but...) Better to stick with the things that contributors to an open-source project can affect like code and collaboration. ### Rules of This Wiki   * **Do not duplicate suggestions**. It's okay if you do but a moderator may down-vote it and/or delete if possible. In the case a significant duplicate exists but with some good additions we should edit the answer that's duplicating it to include the additions.   * **More rules will come as needed** , as we realize they are needed. If you have concerns about this related to _WordPress Ideas_, _Core Team buy- in_ or _relationship with WordPress/Automattic_ , please see the comments in one of my own " _answers_ " posted to this question, below. My hope is that this effort **will be entirely positive** and that everyone including Automattic and the WordPress core team will get huge value from its outcome.


title: The_excerpt() doesn't parse <!--more--> - how to change that?

text: I'm using `the_excerpt();` in blog.php file (post listing page) and it doesn't recognize `<!--more-->` if "Excerpt" field is empty and it grabs the beginning of the content as excerpt. This issue is described here: http://codex.wordpress.org/Template_Tags/the_excerpt but I don't know why did WordPress disable `<!--more-->` for the excerpt (if excerpt field is empty and content is used as excerpt)? Can i enable that back?


title: How to paginate posts correctly that belong to a particular category and are random ordered

text:
I was interested to read the answer to this question on how to paginate posts correctly that are random ordered. Is it possible to paginate posts correctly that are random ordered? My goal is to randomly order posts that appear in a certain category on my site, in this case artists. Here is the code for the loop. In my case I use the wp_pagenavi plugin
         <?php         $paged = (get_query_var('paged')) ? get_query_var('paged') : 1;         query_posts('cat=6&orderby=rand&posts_per_page='.get_option('posts_per_page').'&paged=. $paged);?>         <?php wp_pagenavi(); ?>         <?php if (have_posts()) : while (have_posts()) : the_post(); ?>         <div <?php post_class() ?> id="post-<?php the_ID(); ?>">
<a href="<?php the_permalink() ?>"><?php the_title(); ?>
          <?php //include (TEMPLATEPATH . '/inc/meta.php' ); ?>
              <?php             global $more; $more = 0;             the_post_thumbnail('medium');             the_content("Continue Reading",FALSE);               ?>

         <?php endwhile; ?>         <?php //include (TEMPLATEPATH . '/inc/nav.php' ); ?>         <?php wp_pagenavi(); ?>         <?php else : ?>
Not Found
         <?php endif; ?>         <?php wp_reset_query(); ?>      I used the filter to modify the ORDER BY statement of WP_query from the link above               session_start();          add_filter('posts_orderby', 'edit_posts_orderby');          function edit_posts_orderby($orderby_statement) {          $seed = $_SESSION['seed'];     if (empty($seed)) {       $seed = rand();       $_SESSION['seed'] = $seed;     }          $orderby_statement = 'RAND('.$seed.')';     return $orderby_statement;     }      and this works fine when the artists page is viewed. As explained a random number is generated on the first page load then this is stored in a SESSION variable and used as the $seed for further paginated requests. This ensures that any potential for repeated artists posts is eliminated and a fresh set of artists posts is returned when the user clicks on page 2 or 3 of the pagination However posts in different categories including events and news also get treated randomly which isn't what is desired. I'd like these to be the latest first. I tried adding orderly = DESC but this makes no difference to that loop. The function from the previous post appears to override it. Is there a method of targeting just the artist category to be random within the seed function and to leave other loops alone. Thanks


title: How do I get the theme URL in PHP?

text: I need to get the URL of my theme directory to reference an image in the theme's image/headers directory. How is this done in PHP?


title: Is there a plugin-log plugin?

text: Is there a plugin that logs my usage of plugins on the blog? (when I downloaded a new plugin. When I activated/deactivated it and so on) ?


title: Rewrite loading custom template file but is_home() returns true, and there's no 404

text: I want to create some custom pages for my theme that don't appear in the Page listing in wp-admin. I have the following class which intercepts the url.               class jtvRewrite {          var $path = '';          function __construct($path) {              $this->path = $path;              register_activation_hook( __file__, array($this, 'activate') );              // Write rules -> Add query vars -> Recalculate rewrite rules         add_filter('rewrite_rules_array', array($this, 'create_rewrite_rules'));         add_filter('query_vars',array($this, 'add_query_vars'));              add_filter('admin_init', array($this, 'flush_rewrite_rules'));         add_action('template_redirect', array($this, 'template_redirect_intercept') );     }          function activate() {         global $wp_rewrite;         $this->flush_rewrite_rules();     }          function create_rewrite_rules($rules) {         global $wp_rewrite;         $newRule = array($this->path . '/(.+)' => 'index.php?' . $this->path . '='.$wp_rewrite->preg_index(1));         $newRules = $newRule + $rules;         return $newRules;     }          function add_query_vars($qvars) {         $qvars[] = $this->path;         return $qvars;     }          function flush_rewrite_rules() {         global $wp_rewrite;         $wp_rewrite->flush_rules();     }          function template_redirect_intercept() {         global $wp_query;         if ($wp_query->get($this->path)) {             $this->output($wp_query->get($this->path));             exit;         }     }          function output( $output ) {         global $wp_query;              if (file_exists( TEMPLATEPATH . '/' . $this->path . '/' . $output . '.php' )) {             include( TEMPLATEPATH . '/' . $this->path . '/' . $output . '.php' );             exit;         } else {             return $wp_query->is_404();         }     }          }     $member = new jtvRewrite('member');      However, if I run `is_home()` on this page it returns true. That makes sense since behind the rewrite is `/index.php?member=profile`. Is there something I can throw in there that makes it not home? The reason being I have another functions which adds something to the front page on `is_home()`. Secondly, I've got `return $wp_query->is_404();` in there if the theme file is not available (i.e. the page doesn't exist) but on a non existent url just a blank page is returned (WP_DEBUG true return nothing). Any idea how to send the 404 correctly? _Edit with solution:_ Otto suggested adding `$wp_query->is_home = false` to `template_redirect_intercept()` \- which worked a treat. And then I've made the `output` function check if a function exists based upon the path that was originally requested. If that function exists (see below) it calls it. That function provides the redirect. If it doesn't the 404 is set. This way I can use the `class jtvRewrite` as much as I like for each new template file I add.               function template_redirect_intercept() {         global $wp_query;         if ($wp_query->get($this->path)) {             $wp_query->is_home = false; // set is_home parameter to false                  if (! $this->output($wp_query->get($this->path)))                 $wp_query->set_404();         }     }          function output( $output ) {         global $wp_query;              $function = 'jtv_rewrite_action_' . $this->path . '_' . $output;              if (function_exists($function)) {             $function();             exit;         } else {             return false;         }     }      Then I can use the following function to fire off to the correct template file:               $member = new jtvRewrite('member');          /**      * Provide the theme template file      */     function jtv_rewrite_action_member_profile() {          include( TEMPLATEPATH . '/member/profile.php' );          }


title: Category RSS feed doesn't show category name

text: I'm pulling an RSS feed from a custom post type "blogs" under a category of "workers-compensation". Here is the URL: http://www.company.com/category/workers-compensation/feed/?post_type=blog The feed works fine, but I'm unable to pull the category name so that feed readers can display the title similar to this "Company >> Worker's Compensation", but I'm stuck with "Company >> " (where nothing gets pulled in for the second part). I'll admit I'm a pretty big RSS nub, so any and all help here would be greatly appreciated. Thanks!


title: Jetpack + VideoPress + Self Hosted Blog = Domain permission issue (1 post)

text: I recently subscribed for VideoPress for $60 a month. I had to sign into my WordPress account which is linked to my jetpack for my self hosted WordPress site. When I uploaded a video and embedded it on my post I got this message: > VideoPress Error > > http://www.MYSITEHERE.com is not an allowed embed site. > > Publisher limits playback of video embeds. Note: I removed my actual domain with "MYSITEHERE". I tried to contact Jetpack support, but they did not respond in a couple of days now, so I thought I'd try the forums as directed by the VideoPress support pages. I believe that because I had to signup for VideoPress by signing into WordPress.com it added the feature to MYSITEHERE.wordpress.com. How do I connect my self-hosted WordPress blog to VidepPress via Jetpack? Is that the problem? What am I missing? Thanks!


title: Problem adding 'has-children' class to wp_nav_menu

text: According to a number of references online, I should be able to use the following function to add the class, `has-children`, to menu items that have children under them:               function gtp_nav_menu_css_class( $css_class, $item ) {         global $wpdb;         $has_children = $wpdb->get_var("SELECT COUNT(meta_id) FROM wp_postmeta WHERE meta_key='_menu_item_menu_item_parent' AND meta_value='" . $item->ID . "'");         if ($has_children > 0) {             array_push($css_class, 'has-children');         }         return $css_class;     }     add_filter( 'nav_menu_css_class', 'gtp_nav_menu_css_class', 10, 4 );      I am using `wp_nav_menu()` in my `header.php`. However, after adding this code to `functions.php`, I am not seeing the `has-children` class being added to any menu items (when in fact there are menu items that contain children). Does anybody know what may be the culprit? Notes:   * I am using WP 3.4.1.   * I am running a Multisite setup   * Table prefix is 'wp_'   * Via debug echo statements, I can see that the function is getting executed, but not inside the conditional statement.


title: Adding Custom Forms

text: I'm looking to create a page for a wedding site that will have a form. The idea is that it is an RSVP page where a visitor will input a unique string that was on the invitation that they received and will take them to another page that will have the info (attending, how many guests, etc.), after that storing it in a database so I have a completed guest list that I can use for later purposes. I'm not very familiar with Wordpress yet, so what is the easiest way to have pages that involve forms and that the second input page would not be displayed in the navigation? I should be able to write the php and form html without too much trouble, just need a jumping off point.


title: Controlling the Admin panel for page templates

text: I want to maintain a specific layout for each page type, rather than embedding HTML into the page itself. I know there has to be a better way, For example I would like to:   * on the contact page create a style for each person   * on the about page i would like to keep the content formatted I know how to make a page-template.php but there has to be something i am missing I would think that in the admin panel there would be fields for each area. Thanks ahead of time.


title: Primary and secondary menus

text: I am trying to make each individual tab on my primary menu link to the secondary menu so that in effect each individual primary tab leads to an individual set of tabs in the secondary menu rather than it just remaining static. I hope you can help and I'm not an advanced WP user so its ok to use simple terms. ## Update I've added the code but it has shown up on my webpage and in the dashboard so I must have it wrong so I've pasted it below so you can see. I'm not sure how to find the primary slug but I think its what I've added in place of primary.               function km_dynamic_secondary_menu_reg() {         global $km_nav_menus;         $theme_location = 'nav-menus';          $locations = get_nav_menu_locations();         $menu_items = wp_get_nav_menu_items( $locations[$theme_location] );         if ( isset($menu_items) && !empty($menu_items) ) {             $km_nav_menus = array();             foreach( $menu_items as $item ) {                 if ( 'post_type' == $item->type ) {                     $post_type = ( 'page' == $item->object ) ? $item->object : 'post';                     $km_nav_menus[get_post_field( 'post_name',  $item->object_id ).'-'. $post_type] = '"'.$item->title . '" Secondary Menu';                     register_nav_menus( $km_nav_menus );                 } elseif ( 'taxonomy' == $item->type ) {                     $km_nav_menus[get_term_field( 'slug', $item->object_id, $item->object ).'-tax'] = '"'.$item->title . '" Secondary Menu';                     register_nav_menus( $km_nav_menus );                 } else {                     //Your default fallback if needed                 }                  }         }     }     add_action( 'init', 'km_dynamic_secondary_menu_reg' );


title: Offset a post in the loop, with using PageNavi Plug-in

text: I am trying to offset 1 post in my main loop, I have tried a few things Like query_posts() etc etc, and i can get the offset to work but my pagination ends up not working , I am using the PagNavi plug in , Any Help would be awesome , the Code is pretty generic , thanks again!               <?php if (have_posts()) : ?>     <?php query_posts('offset=1');?>     <?php while (have_posts()) : the_post(); ?>          //Content          <?php endwhile; else: ?>     <?php _e('Sorry, no posts matched your criteria.'); ?>     <?php endif; ?>


title: URL rewrites and pagination

text: I must say that I am a complete nooby at Wordpress custom URL rewrites. I have searched for past many days to find a clear explanation of how to determine and write correct pattern for URL rewrites. I have a custom page template that uses query var passed to it, e.g. http://example.com/pagename?user=username. In this "pagename" refers to the custom page template and "user" refers to the custom query var. I need this to be represented using the URL http://example.com/pagename/username. I also require the above to work with pagination. So http://example.com/pagename/username/page/2 should be able to represent http://example.com/pagename/page/2?user=username It would be great if someone can provide me with a working example and an explanation of how I should determine and write correct pattern for URL rewrites. Regards, John


title: How to dynamically save a selected option from page "Templates" selectbox?

text: When I select a template for a page from the "Templates" selectbox, the selected item gets “value=selected” only after I hit save draft/publish/update. `<option value='template-gallery.php' selected='selected'>Gallery</option>` How can the option receive the value “selected” without the need of save/publish/update hit button? (like on widgets page: they get saved without page refresh) Thank you!


title: Why is the reset password key missing in the reset password email?

text: Wordpress 3.2.1 - The reset password URL in the email generated by http://mysite.com/wp-login.php?action=lostpassword does not contain a valid key and so users are unable to reset their password. We do have Register Plus Redux plugin installed but the problem persists even if I disable it. Is this a known issue? Clicking the link gives the error "Sorry, that key does not appear to be valid." The link looks like this: http://mysite.com/wp-login.php?action=rp&key=&login=email%40mysite.com (they key is empty)


title: List Post Attachments - Remove Image Thumbnails

text:
I'm using the following code to display a list of the posts attachments within a sidebar:
                 <?php $args = array(     'post_type' => 'attachment',     'post_parent' => $post->ID     );     $attachments = get_posts($args);     if ($attachments) {             echo '
This article has the following attachments:
';             foreach ($attachments as $attachment) {             echo '
';             the_attachment_link($attachment->ID, false);             echo '
';}             } else {              echo '
No documents attached to this article.
';     } ?>
      Most posts contain PDF's, Zip files and JPG/PNG files. The code above does list the attachments, however, when the attachment is an image it displays a thumbnail rather than just a link to the image. Can anyone advise how I can go about making sure each attachment is listed as a link? Thanks, Darren


title: WP_cron won't trigger my action

text: I'm in a dead end with a schedualed task in a wordpress plugin for a multisite. Somehow the action I added don't get triggered. The task is getting schedualed and returns a timestamp when I run wp_next_scheduled(), but the action itself doesn't go off and trigger the function. Information that might give some clues:   * It's running on a WPMU-site   * The cronjob is a part of a plugin   * I'm using OOP approach   * The things I'm importing is a custom post type. _Code Example:_               class Cronjobs     {         function Cronjobs()         {             add_action('init', array(&$this, 'add_cronjobs'));         }              function add_cronjobs()         {             add_action('update_properties_daily', array(&$this, 'do_updates'));                  if(!wp_next_scheduled('update_properties_daily') )             {                wp_schedule_event( time(), 'daily', 'update_properties_daily');             }         }              function do_updates()         {             /* Do updates */         }     }      Could really use the help of some wizes on this one, thanks! * * * ## UPDATE Solution: **Create a global function and call that from the custom action.** Apparently is there some glitch with creating custom actions while refering to an object. Since **custom actions is stored in the DB** (as far as I've understood), **the objected won't be instansiated** and therefor **can't use it's methods**. Therefor: back to basics and use a global function.


title: Suggestions for Developing a Flipbook Style Theme?

text: I'm currently working on a custom WordPress theme that will be a showcase of several different stories, "books" if you will, that contain individual chapters. I'd like to present each of the stories in a kind of flip book presentation using jQuery, AJAX or some combination thereof. Following is an example of what I'd like to do in WordPress: http://www.getfisk.com/somali_pirates At current I've got a basic theme designed with posts created for each chapter, however I'm thinking I might need to create some form of custom post type and/or fields for the flip book functionality to work. Would love any and all suggestions you guys might have on how best to go about doing this as at the moment I'm at a bit of a loss. Thanks in advance. :)


title: Get all posts without tags

text: I'm working with a tag plugin. Is there a WordPress way to get_posts or query all posts that have no tags?


title: Link profile page to the logged in users profile

text: I am new to wordpress and having troubles setting up the user profile page. I created a page 'Profile' and in the permalink option I need to have it so that it is http://mysite.com/members/"CurrentUser". I looked at this Diplay a registered user profile page but I am not able to add all those codes in the permalink. I believe I am missing something, any help is appreciated.


title: How to display many photo albums related to category

text: I am developing one project and in this project i have to display many photos albums related to each category name. **Particular.**               Photos [Custom page.Redirect to next sub-category with name {personal} ]              sub-category Personal Photos             sub-category Professional Photos             ........      I want all of content that i describe in the wireframe below. I want this for each category, and every album to be next to each other like Rome, Madrit album, etc also below this there is a field with number that describes the number of photos for each album like **Rome / 28 photos.** ![Wireframe](http://i.stack.imgur.com/6JWJM.jpg) I read many articles with multiple solutions. Some of them recommend to create this with Custom Post Types, i think that in addition i want to create a Custom Category Template. What are your opinion, how can organize all of these content and if you have any other suggestions, i would like to read. Thanks i advance.


title: Programmatically set featured images

text: Is there a way to set featured images in bulk? I have created a bunch of posts (200+) and would like to set featured images to all of them in bulk - without using the admin panel and setting the featured image for each post one by one?


title: Import 10,000 Users into Wordpress WITH a specific ID for each user

text: I have a website which has about 10,000 users. I am converting this site over to Wordpress. The new site is ready to roll, but I have to bring over all the users. There are a number of plugins available to importing users from a CSV file, and I've got the CSV file ready to go. The plugin that I'd like to use is the following: Import Users from CSV The reason I'd like to use this plugin is that it provides the option to import a CSV file containing user id's. Unfortunately, the plugin is currently designed so that if ID's are present in the CSV file, it assumes that these users already exist in your Wordpress database and you're trying to "UPDATE" those records. I'm not. I'm trying to make NEW users in the database, but with specific ID's (because these ID's are tied to another system and I don't want these losers to lose access to all of this other info as a result of an ID change from the old system to the new. It seems that the plugin above maybe be piggy-backing off of the built-in Wordpress functions for registering or updating users, so this may be the problem. How can I accomplish my goal with as little time investment as possible? BTW - I am pretty comfortable in phpmyadmin, so I don't mind doing it there, the only problem is I want to make sure that all users receive an email notifying them and providing their new password (because I can't move these over). Using the plugin, this is automatic. Without it, not to much. Thanks for any assistance.


title: get_theme_mod(); returns nothing

text: I am having trouble with my customize field in WordPress. The field shows up fine in the customize section of WP but it just does not echo out.               <p> <?php echo get_theme_mod('copyright_details'); ?> </p>      functions.php code:               function limus_customize_register( $wp_customize )     {        //copyright         $wp_customize->add_section('limus_copyright', array(             'title' => __('Copyright Details', 'limus'),             'description' => 'Add/Edit copyright information'         ));         $wp_customize->add_setting('copyright_details', array(             'default' => '© 2000-2013 Limus Design Inc. All Rights Reserved.'         ));         $wp_customize->add_control('copyright_details', array(             'label' => __('Copyright Information', 'limus'),             'section' => 'limus_copyright',             'setting' => 'copyright_details'         ));     }     add_action( 'customize_register', 'limus_customize_register' );


title: MySQL Database User: Which Privileges are needed?

text: The short installation instruction for WordPress ("5 Minutes") state that: > Create a database for WordPress on your web server, as well as a MySQL user > who has all privileges for accessing and modifying it. While setting up a new blog professionally I was wondering how that maps to what the MySQL database user privileges/permissions configuration offers me:   * **Data:** `SELECT`, `INSERT`, `UPDATE`, `DELETE`   * **Definition:** `CREATE`, `ALTER`, `DROP`   * **Extra:** `INDEX`   * **More:**     1. `LOCK TABLES`     2. `REFERENCES`     3. `CREATE TEMPORARY TABLES`     4. `CREATE VIEW`     5. `SHOW VIEW`     6. `CREATE ROUTINE`     7. `EXECUTE`     8. `ALTER ROUTINE` I'm pretty sure for the first three groups, I named them Data, Definition and Extra here. But what about the others below the **More** entry? Normally I would say, those are not needed, but I would like to get a second opinion.


title: Will reducing mysql permissions hinder WP function?

text: While installing WP, I created a mysql user to access only the relevant WP database. It's likely that not technical people will end up with access to this account, so I decided to remove DELETE and DROP privileges from this user. Was this a bad idea? Will anything in WP not function correctly because of this. Thus far, I got a couple of error messages during the install, but I looked up what they were doing, and that was precisely nothing. The DROP queries didn't match anything they would have dropped. UPDATE: It seems that my question is addressed by answers in this question: MySQL Database User: Which Privileges are needed?


title: Archive limit the text of the_content

text:
here's the code for my archive page..               <?php     /*     Template Name: Archive Page     */     ?>          <?php get_header(); ?>
             <?php include'leftsidebar.php';?>
         <?php if (have_posts()) : ?>                  <?php $post = $posts[0]; // Hack. Set $post so that the_date() works. ?>                  <?php /* If this is a category archive */ if (is_category()) { ?>
Archive for the ‘<?php single_cat_title(); ?>’ Category
                  <?php /* If this is a tag archive */ } elseif( is_tag() ) { ?>
Posts Tagged ‘<?php single_tag_title(); ?>’
                  <?php /* If this is a daily archive */ } elseif (is_day()) { ?>
Archive for <?php the_time('F jS, Y'); ?>
                  <?php /* If this is a monthly archive */ } elseif (is_month()) { ?>
Archive for <?php the_time('F, Y'); ?>
                  <?php /* If this is a yearly archive */ } elseif (is_year()) { ?>
Archive for <?php the_time('Y'); ?>
                  <?php /* If this is an author archive */ } elseif (is_author()) { ?>
Author Archive
                  <?php /* If this is a paged archive */ } elseif (isset($_GET['paged']) && !empty($_GET['paged'])) { ?>
Blog Archives
                  <?php } ?>                  <?php include (TEMPLATEPATH . '/inc/nav.php' );?>
             <?php $i=0;?>                  <?php while (have_posts()) : the_post(); ?>                 <?php $i++; ?>
                 <div <?php post_class() ?>>                          <h2 id="post-<?php the_ID(); ?>"><a href="<?php the_permalink() ?>"><?php the_title(); ?>
                          <?php include (TEMPLATEPATH . '/inc/meta.php' ); ?>
                              <?php the_content();?>

                 <?php                  $Archive_Ads = array(                 'Archive Ad1',                 'Archive Ad2',                 'Archive Ad3'                 );                 if ($i % 3 === 0):                 if (function_exists('dynamic_sidebar')) :/*this is the line 69*/                 dynamic_sidebar($Archive_Ads[rand(0, 2)]);                 endif;                 endif;                 ?>                  <?php endwhile; ?>
                            <?php include (TEMPLATEPATH . '/inc/nav.php' ); ?>          <?php else : ?>
Nothing found
          <?php endif; ?>

     <?php get_footer(); ?>      Now What I want is to limit the text by 50 words without affecting the videos and images, I want my Images and Videos to be display, is it possible to do that?


title: Category List With Comma & Link

text: Trying to list the categories for post separated by a comma with link to the category archive.                               <?php                     foreach((get_the_category()) as $category) {                     if($category->name==$homecat) continue;                     $category_id = get_cat_ID( $category->cat_name );                     $category_link = get_category_link( $category_id );                     echo ''.$category->cat_name.'';                     } ?>      Thanks for any help!


title: Change category base based on category

text: How can I change the permalink based on the category? I would like to change the category base based on its category. I want the output to be like this:   1. /news/category1    2. /articles/category2   3. /articles/category3 In short, they're all just categories in one POST TYPE which is "post" but only the permalinks are different. PS. I know I can just build a CPT for this. Just trying not to do it if there's a way.


title: Are .MP3 files with capital letter extensions allowed in [audio] shortcode?

text: In WordPress 3.6, using the new `[audio]` shortcode, I can add a player for an .mp3 file like this:               [audio src="http://example.com/audio_files/test.mp3"]      However, if the .mp3 file has capital letters in the extension, it doesn't work:               [audio src="http://example.com/audio_files/test_capital.MP3"]      If I specify the format in the shortcode, it still fails, although in a different way:               [audio mp3="http://example.com/audio_files/test_capital.MP3"]      Looking at function `wp_audio_shortcode` in "wp-includes/media.php", I can see where this is happening. Is this intentional behavior for WordPress 3.6? Are there any workarounds (other than renaming the file)? Should I file a bug report? # Followup This bug has been fixed in the core for WordPress 3.7.


title: How to limit the number of blogs created in a WP multisite installation?

text: I adapted a function from @rohmann (and with the help of David Sader) to limit the number of blogs that a user can create in a Wordpress multisite installation. The function works well, but the error that it shows to the user on site registration above the fixed limit contains some more text than is set by this function. What here is wrong? This is the received error text: > You have already registered the maximum amount of 3 blogs! We suggest > adjusting the blog address below, in accordance with the following > requirements: » Only letters and numbers allowed. » Must be at least > characters. » Has to contain letters as well. This is the function:               add_filter('wpmu_validate_blog_signup','set_blog_creation_limit');          function set_blog_creation_limit( $result ) {              $blog_limit = 3;         $user_blogs_nr = 0;              $user_blogs = get_blogs_of_user($result['user']->ID);              foreach ($user_blogs as $user_blog) {             $blog_id = $user_blog->userblog_id;             $user_id_from_email = get_user_id_from_string( get_blog_option($blog_id, 'admin_email'));             if ( $result['user']->ID == $user_id_from_email )                 $user_blogs_nr++;         }              if ($user_blogs_nr == $blog_limit )             $result['errors']->add('blogname', __('You have already registered the maximum amount of ' . $user_blogs_nr . ' blogs!'));              return $result;          }


title: My post does not show up

text: I'm facing a WordPress strange behavior. One of my posts is not showing up. If I open post editor I can find the post full text and in my home page I can see an excerpt of this post. Does anybody have any idea how to fix this?


title: How can i disable a plugin for a mobile phone?

text: Is there a way I can not show something to mobile users? I have a floating social bar on my responsive theme, but it get in the middle of the content if I'm on my Android phone. I don't want to use display:none, since the JS will still load. Is there a function I can use to only show the floating bar for desktops users, and not mobile ones? Thanks in advance (:


title: Url redirection using htacess for my website

text: my website has some development issues i really need some help When someone types www.mysite.com/mysite.com/mysite.com/anypagename.php a page opens up which shows data of the original page but without pictures. this problem is occurring for all pages that are in the root directory. How can i solve this using htacess redirection? I don't know whats wrong and it is hurting my performance


title: Custom permalinks rules don't match and lost of query var in the process

text: For my theme i created custom post types (realisation, video). All is working now without the rewriting, but i have trouble when i apply rewriting. my urls are like this :               1) ?realisation=habillage-de-stands&parentid=38 // for custom post type 'realisation'     2) ?video=jardin-d-ailleurs&parentid=visite-jardin // for custom post type 'video'     3) ?video_category=institutionnel&parentid=pedagogique //for custom tag 'video_category' associated to custom post type 'video'     4) ?p=31&parentid=34 //for blog article     5) ?tag=site-web&parentid=34 //for tags      I tried in permalink               http://127.0.0.1/CONSTRUCTION/wordpress/%postname%/      and i added in functions.php               function add_query_vars($query_vars)     {         $query_vars[] = "parentid";         return $query_vars;     }     add_filter('query_vars', 'add_query_vars');          function add_parentid_rewrite()     {         add_rewrite_rule('^realisation/([^/]*)/([^/]*)', 'index.php?realisation=$matches[1]&parentid=$matches[2]', 'top');         add_rewrite_rule('^video/([^/]*)/([^/]*)', 'index.php?video=$matches[1]&parentid=$matches[2]', 'top');         add_rewrite_rule('^video_category/([^/]*)/([^/]*)', 'index.php?video_category=$matches[1]&parentid=$matches[2]', 'top');     }     add_action( 'init', 'add_parentid_rewrite' );      and i have               ?realisation=habillage-de-stands&parentid=38      becomes               realisation/habillage-de-stands/&parentid=0/      the link is working but i wish to have               realisation/habillage-de-stands/38/      also               ?video=jardin-d-ailleurs&parentid=visite-jardin      becomes               video/jardin-d-ailleurs/&parentid=visite-jardin/      instead of               video/jardin-d-ailleurs/visite-jardin      and also               ?video_category=institutionnel&parentid=pedagogique      becomes               video_category/institutionnel/&parentid=&parentid=pedagogique //width 2 &parentid= !!but the link is working      instead of               video_category/institutionnel/pedagogique      **=> what is wrong ? and why &parentid= stays in the rewrite link ?** But               ?p=31&parentid=34      becomes               article2/&parentid=0      and doesn't work => What could be done here for this ? The parentid is well taken into account when no rewrite is done (by doing a simple echo $wp_query->query_vars['parentid'];). But with the rewrite, the value is messed up! for instance :               ?p=31&parentid=34      gives me empty string with rewrite               ?realisation=habillage-de-stands&parentid=38      gives me the string '&parentid=0' Thanks in advance \--- EDIT --- if i var_dump($wp_query); in header.php, i've got in my results \- when permalinks ARE NOT rewritten :               ["query_vars"]=>       array(58) {         ["realisation"]=>         string(19) "habillage-de-stands"         ["post_type"]=>         string(11) "realisation"         ["name"]=>         string(19) "habillage-de-stands"         ["parentid"]=>         string(2) "38"     ...        }      ["query"]=>       array(4) {         ["realisation"]=>         string(19) "habillage-de-stands"         ["post_type"]=>         string(11) "realisation"         ["name"]=>         string(19) "habillage-de-stands"         ["parentid"]=>         string(2) "38"       }      when permalinks ARE rewritten :               ["query_vars"]=>     array(58) {         ["page"]=>         int(0)         ["realisation"]=>         string(31) "habillage-de-stands/&parentid=0"         ["post_type"]=>         string(11) "realisation"         ["name"]=>         string(9) "parentid0"         ["pagename"]=>         string(9) "parentid0"        ["parentid"]=>        string(11) "&parentid=0"         ...     }     ["query"]=>     array(4) {         ["realisation"]=>         string(31) "habillage-de-stands/&parentid=0"         ["post_type"]=>         string(11) "realisation"         ["name"]=>         string(31) "habillage-de-stands/&parentid=0"     }      Does anyone has a clue ?


title: Add postMessage to existing customizer settings

text: I'm trying to add postMessage to the transport of all the pre-exisiting wordpress customizer options. I don't want Site Title & Tagline etc to refresh when I change them. Is there a way to make this happen?


title: Get Users Post ID

text: I need a lil something done and I have looked over Google for and cant seem to find, not even a close solution. My site is totally user front end with wp-admin being blocked by users. When a user logs in they are taken to a "dashboard". Each person can only make one post. What i need is something to take the current logged in user and grab the post id of their post. so i can link to their edit page.


title: $wpdb->get_col and ORDER BY?

text: this is the query that returns the listing of a custom post type               $apartments = $wpdb->get_col( "                     SELECT DISTINCT( post_id )                      FROM $wpdb->postmeta                      WHERE meta_key IN( $fields_string ) AND                            post_id IN ( SELECT ID FROM $wpdb->posts                            WHERE post_type = 'tvr_apartment' AND                                  post_status = 'publish' )                      )" );      By default this returns the newest first, I want to order by random; this is how i am trying but then there are no results               $apartments = $wpdb->get_col( "                     SELECT DISTINCT( post_id )                      FROM $wpdb->postmeta                      WHERE meta_key IN( $fields_string ) AND                            post_id IN ( SELECT ID FROM $wpdb->posts                            WHERE post_type = 'tvr_apartment' AND                                  post_status = 'publish' )                      )                     ORDER BY $wpdb->postmeta.post_id rand()" );      what am i doing wrong?


title: Regsitration form on External page

text: I am trying to achieve where user can register from my another website which is in sub folder and in the same database. However both website has own tables and one is Wordpress and other is non-wordpress website. Means `www.wordpress-site.com` is my wp site and I want to place registration form where site is `www.wordpress-site.com/other-site/` Once user register it should redirect to the same/current page and not to any of wordpress pages. I would highly appreciate your help.