Display all categories including sub categories

Solved with the following: $args = array( ‘orderby’ => ‘name’, ‘parent’ => 0 ); $categories = get_categories( $args ); $first = true; foreach ($categories as $category) { if ( $first ) { echo ‘<li class=”title” style=”border-top: 0px;”><a href=”https://wordpress.stackexchange.com/questions/116483/acatalog/abovegroundpools.html”>’.$category->cat_name.'</a>’; $first = false; } else { echo ‘<li class=”title”><a href=”https://wordpress.stackexchange.com/questions/116483/acatalog/abovegroundpools.html”>’.$category->cat_name.'</a>’; } $theid = $category->term_id; $children = $wpdb->get_results( … Read more

How do I add text in a shortcode?

hello you can try this // Add Shortcode function text_shortcode( $atts , $content = null ) { // Code return ‘<div>’ . $content . ‘</div>’; } add_shortcode( ‘b’, ‘text_shortcode’ ); The shortcode will be something like this [b] content [/b]

Strange wordpress slowness

You can use the plugin Debug Objects and his query function to identify the slowest queries from core and plugins. I see very often the problem on a plugin or theme functionality. Identify and solve.

Create Logout Link WordPress Admin Menu

You can use the awesome WP_Admin_Bar & hook in with admin_bar_menu: /** * Add a “Log out” link directly to the admin bar. * * @link http://wordpress.stackexchange.com/q/141446/1685 * * @param WP_Admin_Bar $wp_admin_bar */ function wpse_141446_admin_bar_logout( $wp_admin_bar ) { if ( is_user_logged_in() ) { $wp_admin_bar->add_menu( array( ‘id’ => ‘my-log-out’, ‘parent’ => ‘top-secondary’, ‘title’ => __( ‘Log … Read more

Can I use HTTP POSTs? Is there a better alternative?

WordPress is an HTTP/PHP web application. The ordinary rules of HTTP and PHP apply, and work. WordPress itself uses $_POST and $_GET more times than I can count. If you want to pass information from one page to another– say from a form to a search handler– you have to use one or the other. … Read more

Get category name from custom loop and echo it once

Here is an idea. Note, this will only work if all posts are in the desired category and if all posts have only category The posts are returned in an array which you can access through $currentissue->posts With this in mind, you can get the first post ID as follows $currentissue->posts[0]->ID Now, you can add … Read more