WordPress, alternative single post template

You could set a url parameter to change the display so that the URL could be the same, then have your QR code do a pass-through to the desired page. Without knowing how the QR codes are setup and such, I can’t offer much more on high-level implementation than that. The way to switch the … Read more

Exclude single page from function

That is not the way functions work. You can’t tack part of an if/else query onto the end of a function… at least that kinda looks like what you are doing. Or maybe you’re are trying to us an else without the if… Anyway, the syntax is badly broken. Here is a cleaned up version … Read more

How to Highlight current category on category and single page template?

You can do something like <?php $current_category = get_the_category(); /* $current_category[0]->ID is holding the current category now. If there are more than 1 categories for the post you should iterate through all of them and check if the current category you’re displaying is in there */ $cats = get_categories(‘hide_empty=0&child_of=2&orderby=count&number=99&order=asc’); foreach ((array)$cats as $cat) { $catdesc … Read more

Changing the display of the themename_posted_on() function

This question is entirely Theme-dependent. The function will be defined in functions.php, or in a file included in functions.php. Based on the function name, I’m going to take a guess that the Theme in question is derived from Underscores, in which case the function will be defined in /inc/template-tags.php.

How to check if a post is in categories x,y,z inludint their subcategories

post_is_in_descendant_category is not a WP function. If you don’t define it, it doesn’t exist. I think that you have read the docs for in_category() function and have taken post_is_in_descendant_category from the example without read it completely. Add this code to functions.php or in a plugin: if ( ! function_exists( ‘post_is_in_descendant_category’ ) ) { function post_is_in_descendant_category( … Read more

Link from archive-page.php to single-page.php

get_the_permalink() doesn’t echo anything. It just returns a string so that you can further manipulate it. You need the_permalink() instead, which will echo the link. The difference used to be clear in the Codex but now, in the much inferior, “developer” code reference toward which WordPress is migrating it is not so clear.

Single.php category entries not showing right colours

You should be running the first piece of code inside your foreach loop. What you are currently doing is to get all the post terms, get the first term object, then passing the custom field value of that term into your foreach loop for every post term. Your code should look something like this: $post_categories … Read more

force https except one page/post

I just used this in the functions file in the end function force_ssl() { // Specify ID of page to be viewed on SSL connection if (is_page(8616) && !is_ssl () ) { header(‘HTTP/1.1 301 Moved Permanently’); header(“Location: https://” . $_SERVER[“SERVER_NAME”] . $_SERVER[“REQUEST_URI”]); exit(); } // All other pages must not be https else if (!is_page(8616) … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)