spliting posts into two columns

You could always try to create 2 arrays of titles, say $left and $right, $odd and $even, or $tom and $jerry, and fill them with the titles during your loop, and print them after the loop has ended like so: Create array $left = $right = array(); Then unleash your loop [edited the below to … Read more

Proper use of internationalization

The two are exactly the same but I would go for the first one: Easier to read No interpolation, keep interpolation for variables And, including the tags inside the format is making things more complicated, I can think of designers being tempted to use more tags if they see you are using them.

echo CHILD / SUB CATEGORIES of the CURRENT CATEGORY only

Your code loops through all top level categories, then shows all child categories of each one, so I’m not surprised it’s showing all child cats! If you want to show the child terms of the current category (i.e. on a category archive?), use: $current_cat_id = get_queried_object_id(); $kids = get_terms([ ‘taxonomy’ => get_queried_object()->taxonomy, ‘parent’ => $current_cat_id, … Read more

Customizer Show/Hide

get_theme_mod() has a second parameter where you can set the default value, the value to use if the option is not set. So, if the default value is “1”, you can use: get_theme_mod( ‘display_header_image_title’, ‘1’ ) Then, if there is not value for display_header_image_title (no value in database), “1” is used. So, you could check … Read more

JQuery not working on WordPress Admin page [closed]

There are this type of problem occure. In case- 1- jQuery function conflict to other jquery function. To remove this type of problem, define below script in wp-config.php file. define(‘CONCATENATE_SCRIPTS’, false); 2- jQuery liberaray file are not include in frontend. 3- Jquery same file defined more than one time. then this type of issue show … Read more

php syntax – how to concatenate properly – echo bloginfo(‘stylesheet_directory)

bloginfo() does already an echo. It will be printed before everything else in your echo statement. Use get_bloginfo() instead. stylesheet_directory is one of these arguments where it is better just to use the function that is called by WordPress: get_stylesheet_directory_uri(). It is easier to understand, especially in this case where one could expect a path … Read more

Style wp_page_menu() items

Please find below the function for showing navigation menu. Here, $menu is equivalent to Menu name, ID, or slug <?php function showMyMenu($menu) { $navData = wp_get_nav_menu_items($menu); ?> <ul class=”nav navbar-nav navbar-right is-hidden”> <?php foreach($navData as $k => $v) { echo ‘<li><a class=”page-link” href=”‘ . $v->url . ‘”> ‘ . $v->title . ‘ </a></li>’; } ?> … Read more