Forum Replies Created
Viewing 5 posts - 1 through 5 (of 5 total)
-
AuthorPosts
-
December 17, 2017 at 7:35 am in reply to: Is it possible to track and show page views on Genesis without plugin? #214626dedsonusMember
Thank you, Victor!
December 23, 2016 at 8:18 am in reply to: How to Make Embedded YouTube Videos Responsive on Genesis? #198043dedsonusMemberThank you, Victor!
I'll try this solution.
Regards,
MikeDecember 30, 2015 at 10:00 am in reply to: Related posts – how to show only posts of last N. days? #175196dedsonusMemberI appreciate it. Just found the solution:
/** WPT related post widget */ function related_posts_categories() { if ( is_single ( ) ) { global $post; $count = 0; $postIDs = array( $post->ID ); $related = ''; $cats = wp_get_post_categories( $post->ID ); $catIDs = array( );{ foreach ( $cats as $cat ) { $catIDs[] = $cat; } $args = array( 'category__in' => $catIDs, 'post__not_in' => $postIDs, 'showposts' => 5, 'ignore_sticky_posts' => 0, 'orderby' => 'rand', 'date_query' => array( 'after' => date('Y-m-d', strtotime('-700 days')) ), 'tax_query' => array( array( 'taxonomy' => 'post_format', 'field' => 'slug', 'terms' => array( 'post-format-link', 'post-format-status', 'post-format-aside', 'post-format-quote' ), 'operator' => 'NOT IN' ) ) ); $cat_query = new WP_Query( $args ); if ( $cat_query->have_posts() ) { while ( $cat_query->have_posts() ) { $cat_query->the_post(); $related .= '<li><a href="' . get_permalink() . '" rel="bookmark" title="' . get_the_title() . '">' . get_the_title() . '</a></li>'; } } } if ( $related ) { printf( '<div class="related-posts"><h4>Related posts:</h4><ul>%s</ul></div>', $related ); } wp_reset_query(); } } add_action( 'genesis_after_entry_content', 'related_posts_categories' );
I used this code to limit posts to 700 last days:
'date_query' => array( 'after' => date('Y-m-d', strtotime('-700 days')) ),
dedsonusMemberShould i add something else like <form>...</form>? Code shown above doesn't show search form.
Thank you.dedsonusMemberThank you, but i've tried it with no result. Nothing shows up. I used this code:
<script> (function() { var cx = '005637352947012259361:m-807l9uvfz'; var gcse = document.createElement('script'); gcse.type = 'text/javascript'; gcse.async = true; gcse.src = (document.location.protocol == 'https:' ? 'https:' : 'http:') + '//cse.google.com/cse.js?cx=' + cx; var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(gcse, s); })(); </script> <gcse:searchresults-only></gcse:searchresults-only>
-
AuthorPosts
Viewing 5 posts - 1 through 5 (of 5 total)