Hot answers tagged

3

Your original solution was a hack, and no surprise it failed. In general never add methods/attributes to objects that you do not control their class and future development. The right way is to create your own object to be passed to the walker. Pass to it the category object on construction and either populate fields is a similar way to the category object ...


3

What causes /pages/ to appear in URI? As it turned out, you had a parent page with slug pages. How to remove it? Don't have a parent page. is there an easy way to prevent child pages from showing the parent page in the URI? This has been asked and answered countless times, for example here, you can find more here. Im not going to duplicate ...


1

Here is what I ended up with. Needs some clean up on my end still but it works. https://gist.github.com/curtismchale/fa8d0570ce2c9b14880f31766c560872


1

You can only have one page at example.com so let's say you have an 'about' page: example.com/about In Wordpress Settings > Reading Settings you can select a static page to be the homepage, so example.com would now show the 'about' page. Now, go to Wordpress Settings > Permalinks and select Post name.


1

Best way to check the option before setting the permalink is as follows: if ( get_option( 'page_for_posts' ) ) { echo '<a href="'.esc_url(get_permalink( get_option( 'page_for_posts' ) )).'">'.esc_html__( 'Blog', 'textdomain' ).'</a>'; } else { echo '<a href="'.esc_url( home_url( '/' ) ).'">'.esc_html__( 'Blog', 'textdomain' ...



Only top voted, non community-wiki answers of a minimum length are eligible