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

wp-link-pages in header and footer of the post

For the header First of all you have to know how retrieve the current page, that is done by get_query_var(‘page’) Knowing it, writing what you want is easy. It can be a little hard if you want to link the previous page correctly. In this case you have to use an internal function of wordpress, … Read more

How can I check which archive has referred the single? [closed]

Either use http referer or pass own param with your urls determining referring category. The first option seems better to me. The //check, whether a user does not access a page directly if(isset($_SERVER[‘HTTP_REFERER’])) { //get category object $category = get_category_by_path($_SERVER[‘HTTP_REFERER’], false); //if category URL was passed if(NULL !== $category) echo $category->name; //otherwise get your random … Read more

wp_query issue with post_type = page

If your goal is to load the selected custom template for each page within the loop, then you’re actually pretty close to that. You’re getting the value of _wp_page_template, but then you’re not doing anything with that template, you’re just loading content-page.php for each of those pages with the line get_template_part( ‘content’, ‘page’ );. If … Read more