How can I group posts by date on frontpage?

You test when the date changes and only show it once, right when it changed for the first time. <?php $date = 0; $newDate = true; if (have_posts()) : while (have_posts()) : the_post(); if ($date == 0) $date = the_date(); else if ($date != the_date()) { $date = the_date(); $newDate = true; } if ($newDate) … Read more

multicheck box for post metabox

I took the example code you suggested and changed the following to get multicheck support: // Add this at the end of the file // A good prefix for your name prevents problems later! function wpse6513_get_meta_check( $args = array(), $current_values = array() ) { extract( $args ); $name_esc = esc_attr( $name ); if ( ! … Read more

Navigation link to specific user page

While you could possibly add a filter to walker_nav_menu_start_el and have your callback function alter/recreate the menu item according to your needs, I would say the best and easiest solution is to implement you own menu walker, and supply that to wp_nav_menu. This should help get you started: class WPSE_90204_Walker extends Walker_Nav_Menu { function start_el( … Read more

Sort posts by activity date

I like the idea proposed in this comment. Connecting the posts table to the comments table seems like it’d be some super complicated SQL (well all SQL is complicated to me). Instead the link proposes that you add a post meta field to the post to hold the date of the most recent comment. add_action(‘comment_unapproved_to_approved’, … Read more

Which file displays the date archive?

archive.php is used to display author, search, category, tag and date archives. As clicking on a calendar day will take you to the date archive for that day, then the file you’re looking for is archive.php. More specifically, WordPress will check for these files in this order, stopping when it finds one of these files … Read more

Problem ordering posts with numbers for titles numerically E.g. 1, 10, 100

Here’s code that will order posts by the post_title field, numerically. This code will affect the main query for posts on both the back end and front end. // Apply numeric post ordering for posts in admin and front end. // Adapted from https://www.fldtrace.com/custom-post-types-numeric-title-order function wpse247871_post_order( $wp_query ) { if ( $wp_query->is_main_query() && $wp_query->query[‘post_type’] == … Read more

Specific loop in Shortcode

Ok mate – i got you… you should really break into 2 shortcodes. One as a wrapper (which is really short) and the other for the content… Example: add_shortcode(‘servicewrap’, ‘service_wrapsc’); function service_wrapsc($atts, $content = null) { return ‘<div class=”service”><div class=”container”><div class=”row”>’.do_shortcode($content).'</div></div></div>’; } add_shortcode(‘servicesingle’, ‘service_singlesc’); function service_singlesc($atts, $content = null) { extract(shortcode_atts(array( ‘icon’ => ‘fa-briefcase’ ), … Read more

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