Windows scaling issues for high-DPI devices: Adobe Photoshop & Illustrator
If you have recently bought a 4k monitor, you may have noticed...
5.Jul.2015 | Code Snippets, Freelance Web Design, Wordpress
Add this to your functions.php to add a class to all pages within a tree:
function is_tree($pid) { // $pid = The ID of the page we're looking for pages underneath
global $post; // load details about this page
$cpid = get_the_ID();
$parents = get_post_ancestors( $post->ID ); // get the ancestors
$ancestorid = ($parents) ? $parents[count($parents)-1]: $post->ID;
if(($post->post_parent==$pid||$cpid==$pid||$ancestorid==$pid))
return true; // we're at the page or at a sub page
else
return false; // we're elsewhere
};
// Then use this conditional anywhere in your template files:
if ( is_tree( //page id here ) ) :
// Do something...
endif; ?>
Reference – css tricks blog post
Wordpress Function, WordPress Tips
Share
If you have recently bought a 4k monitor, you may have noticed...
A quick snipped of code that can be used attach a function...
In the early days (2003), WordPress was essentially a blogging tool and...
Here is a really simple way to create custom tabs for your WooCommerce builds using the ACF Repeater Field. First,...
If you’re a start up business, a sole trader or a small business, it is inevitable that you are going...
So, you have just got your new website and you want to get it to the top of search engines....