posts_nav_link() not working on index.php

You are missing the paged= paramter. $myquery = new wp_query(‘cat=-41&paged=’ . get_query_var( ‘page’ )); Codex Note – You should set get_query_var( ‘page’ ) if you want your query to work with pagination. Tip – If you want to eclude a category from main page you can use the pre_get_post filter. That is better way to … Read more

Get all first images of posts in same category

You can do this, and it isn’t that hard though could be a lot of work for the server. The code, a bit simplified, should look something like this: $cposts = wp_list_pluck($wp_query->posts,’ID’); // var_dump($cposts); // debug $args = array( ‘post_type’ => ‘attachment’, ‘post_mime_type’ =>’image’, ‘post_status’ => ‘inherit’, ‘order’ => ‘DESC’, ‘posts__in’ => $cposts ); // … Read more

How to make an anchored page in a navigation menu tab

Add this page link in navigation menu with #target_point, example http://example.com/contact#location_map Then add an anchor at somewhere of that page with name=”location_map”. Something like <a name=”location_map”></a> Now when someone clicks on this menu, he’ll be directed to this specific part of contact page.

‘get_previous_post’ in same category returning (!empty) when no previous post in category exists

Figured it out 🙂 It ends up the Smarter Navigation plugin has a few other functions that I missed: https://plugins.trac.wordpress.org/browser/smarter-navigation/trunk/template-tags.php I used get_adjacent_id_smart() like so: <?php $prev_post = get_adjacent_id_smart(true); if(!empty($prev_post)): echo ‘not empty’; previous_post_smart(); else: echo ’empty’; endif; ?> And I got the behavior I was looking for, don’t know why the default WP function … Read more

How to add or remove borders in navigation menu?

With CSS 3, you can use the :last-child or :last-of-type selectors: .is-frontend #content-holder .semplice-navbar nav ul li:last-child { border-right: 1px solid #000000; } However, you could flip this around to make it more backwards compatible using :first-child (which is available in CSS2): .is-frontend #content-holder .semplice-navbar nav ul li { border-left: 1px solid #000000; } .is-frontend … Read more

how to make a walker to this (in bootstrap, i try but not work)

I use this navwalker <?php class wp_bootstrap_navwalker extends Walker_Nav_Menu { public function start_lvl( &$output, $depth = 0, $args = array() ) { $indent = str_repeat( “\t”, $depth ); $output .= “\n$indent<ul role=\”menu\” class=\” dropdown-menu\”>\n”; } public function start_el( &$output, $item, $depth = 0, $args = array(), $id = 0 ) { $indent = ( $depth … Read more

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