How to set class to “current-page” on the currently viewed single post within a CPT

I figured it out. Before the declaration of $case_query, I declare the active page id, like so: $active_page = get_the_ID();. Then, in the while loop after the_post(); I add the following: $activeclass=””; if (get_the_ID() === $active_page) { $activeclass=”current-page”; } I also add the $activeclass to the .case-list-item div: <div class=”case-list-item <?php echo $activeclass; ?>”> Solved.

Modify Blog Module layout in Child theme

Child theme are loaded first than parent theme. And unlike other template files functions.php of child theme get merged with parent theme’s functions.php instead of being overwritten. So a function i.e. et_pb_blog() declared in parent theme can not be re-declared in child theme. Solution: Remove the shortcode in child theme Add it again with child … Read more

Fetching $_POST from Page Template into functions.php

Assign the value of you $_POST variable to a html element or javascript variable in front-page.php like //html element <input type=”hidden” value=”<?= $_POST[‘variable’]?>” id=”post-variable”> or in javascript variable var postVariable = “<?= $_POST[‘variable’]?>”; Now in ajax call, you can get the value as var myValue = jQuery(‘#post-variable’).val(); //if you set value to html element or … Read more

Sort Events by Venue Title – Sort Post set by related post ids

You can use meta__value in orderby e.g. ‘post_type’ => ‘tribe_events’, ‘posts_per_page’ => -1, ‘meta_query’ => array( ‘relation’ => ‘AND’, ‘event_title’ => array( ‘key’ => ‘post.title’, ), ‘event_id’ => array( ‘key’ => ‘EventVenueID’, ), ), ‘orderby’ => ‘event_title’, Not tested but should work, this was introduced in 4.2 of WP – https://make.wordpress.org/core/2015/03/30/query-improvements-in-wp-4-2-orderby-and-meta_query/

How to sort posts according to meta value?

‘meta_key=keyname’ must also be present in the query so I think you’d want $args = array( ‘meta_query’ => array( array( ‘key’ => ‘wpcf-stream’, ‘value’ => $_POST[‘category’], ‘compare’ => ‘=’ ) ), ‘orderby’ => ‘meta_value’, ‘meta_key’ => ‘wpcf-stream’, ‘post_type’ => ‘half-day-course’, ‘posts_per_page’ => 100, ‘order’ => ‘ASC’ ); to display the rest of the posts I’d … Read more

Main site single-property.php design, as homepage of a multisite

You have two options; either bake into the theme (functions.php) or write a simple plugin that auto-creates the post based on hooking into after new site (blog) creation: https://codex.wordpress.org/Plugin_API/Action_Reference/wpmu_new_blog Use the insert post function to do the creation: https://developer.wordpress.org/reference/functions/wp_insert_post/ Then, set as the home page based on ID returned: update_option( ‘page_on_front’, $new_page->ID );

Filter posts by current date ( WP Post Carousel )

You can use WP_Query to query posts from Date A to Date B, here are all Date Parameters for the WP_Query object : //////Date Parameters – Show posts associated with a certain time and date period. //http://codex.wordpress.org/Class_Reference/WP_Query#Date_Parameters ‘year’ => 2014, //(int) – 4 digit year (e.g. 2011). ‘monthnum’ => 4, //(int) – Month number (from … Read more

Div Missing In Custom Loop Query

You have this code: elseif (17 < $count && $count <= 27 && $paged === 1) : if ($count === 10) echo ‘DIV/CONTENT BEFORE THE NEXT 10 POST GOES HERE’; The first conditional fails when 10 === $count and so the second conditional can never succeed. As your while loop executes (in a structure that … Read more

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