Function to allow single post template based on custom taxonomy?

I think what you’re looking for is the WordPress Template Hierarchy. Basically you can just name the template single-{custom-post-slug}.php and put it in the right directory. Update Now that I understand what you’re actually asking: I bet you could hook {$type}_template, which is called by get_query_template(). It’s expecting a path to the template which has … Read more

Use of antispambot with $curauth->email

As the Codex states for the antispambot() function: Return Values (string) Converted email address. You have to do one of the following: echo antispambot( $curauth->publicemail ); // OR… print antispambot( $curauth->publicemail ); So your full example would look like the following: if ( ! empty( $curauth->publicemail ) ) { echo ‘Email <a href=”https://wordpress.stackexchange.com/questions/43732/mailto:”.antispambot( $curauth->publicemail ).’?subject=Webmail”> … Read more

Stripping and/or altering the content of a custom field (video URL)

Whipped up a nifty little parsing function for you: function wpse44048_parse_video_link( $link ) { $url=”some url”; // pass this in $parsed_url = parse_url( $url ); $host = $parsed_url[‘host’]; // check that the service exists, otherwise return false if( strpos( $host, ‘youtube.com’ ) !== false && strpos( $host, ‘youtu.be’ ) !== false && strpos( $host, ‘vimeo.com’ … Read more

Pagination Not Working (pages duplicating content)

This is because query_posts resets the query. See this warning on the Codex page: Pagination won’t work correctly, unless you use query_posts() in a page template and you set the ‘paged’ query var appropriately: http://scribu.net/wordpress/wp-pagenavi/right-way-to-use-query_posts.html The call: query_posts( ‘category_name=category&showposts=2′); does not tell it which page to get (so it gets the first page). It’s a … Read more

How d0 i get the number of attachments in the post

Use following code to do the work : global $post; $page_id = $post->ID; $all_attachments = get_posts( array( ‘post_type’ => ‘attachment’,’post_mime_type’ => ‘image’, ‘post_parent’ => $page_id, ‘post_status’=>’published’, ‘numberposts’ => -1 ) ); $no_of_photos = count($all_attachments); // Gets the number of photo’s attached in $no_of_photos variable $first_img_URL = get_permalink($all_attachments[0]->ID); // Gets the URL of first attachment in … Read more

How to change a specific admin label

You could try that with the gettext filter in the following manner. function rename_header_to_logo( $translated, $original, $domain ) { $strings = array( ‘Header’ => ‘Logo’, ‘Custom Header’ => ‘Custom Logo’, ‘You can upload a custom header image to be shown at the top of your site instead of the default one. On the next screen … Read more