petekyle
Forum Replies Created
Viewing 5 replies - 1 through 5 (of 5 total)
-
Forum: Themes and Templates
In reply to: Accessing Comment Author Role or LevelIn case you still need this I just worked out how to do it….
<?php $user_info = get_userdata($comment->user_id); if ( $user_info->user_level == 10 ) { echo('User level: ' . $user_info->user_level . "\n"); } ?>
Forum: Fixing WordPress
In reply to: Comment Author Level or RoleI managed to work it out…
<?php $user_info = get_userdata($comment->user_id); if ( $user_info->user_level == 10 ) { echo('User level: ' . $user_info->user_level . "\n"); } ?>
Forum: Plugins
In reply to: Highlight NEW pages and UPDATED pages in wp_list_pagesI am still struggling with this…
I can achieve it outside of wp_list_pages using:
<?php function skills_date_check() { $postTime = get_the_modified_time("U"); $currentTime = time(); $timeDifference = $currentTime - $postTime; $minInSecs = 60; $hourInSecs = 3600; $dayInSecs = 86400; $monthInSecs = $dayInSecs * 31; $yearInSecs = $dayInSecs * 366; //if less than 3 months if ($timeDifference < ($monthInSecs * 1)) { $output = "<img class='new' src='https://skills.nclmedics.com/wp-content/themes/skillsmono/images/new.png'>"; //if more than 3 months } else if ($timeDifference > ($monthInSecs * 1)) { $output = ""; } echo $output; } ?>
But i still need to highlight my menu items which are generated by wp_list_pages.
Anyone??
Pete
Forum: Plugins
In reply to: If page has subpages – redirect to first child, else – stay on current pagethat’s brilliant thanks!!!
Forum: Plugins
In reply to: Show child page when clicking parent link if parent have childrenHi, that code works really well, but is it possible to redirect to first child but if there are no children then stay on the current page?
Currently I get an infinite loop if the page has no children.
Thanks in advance,
Peter
Viewing 5 replies - 1 through 5 (of 5 total)