Forum Replies Created
-
AuthorPosts
-
September 15, 2021 at 1:27 am in reply to: How to remove page animations without affecting CLS #504457
LanceHillier
ParticipantHi Jack,
I realise this post is a few months old but if you look for this code in the themes `style.css' file you can either delete or modify to something you like.
/* Site Container --------------------------------------------- */ .site-container { animation: fadein .25s; word-wrap: break-word; } @keyframes fadein { from { opacity: 0; } to { opacity: 1; } }
This is taken from a theme I am working on so the values might be slightly different, I usually just delete the
@keyframes fadein
and set theanimation: fadein .25s;
to a value I like.Cheers,
Lance.LanceHillier
ParticipantThanks Andy, I have this fixed now, it ended up being a permalink conflict because of the way I had the page set up, it was the same as the CPT which after changing it to something else everything was fine.
Thank you!
LanceHillier
ParticipantThanks for the reply Andy, missed that one!! but hasn't changed the outcome, unfortunately.
LanceHillier
ParticipantHi Brad, Just as a follow-up, I managed to get this working and turns out I was looking in completely the wrong place, the 'Videos' were coming from an ACF repeater field so wp_query wasn't working. I started then looking at how to limit ACF fields and priced together this:
if( $videos ) {
for( $i = 0; $i < $videos; $i++ ) {
if($i==6){ break; }Which now limits the videos to 6.
Happy days!! Thanks again for your help!!
LanceHillier
ParticipantAnd would love to know how to do this in a single loop, do you have an example I could look at?
LanceHillier
Participantok, figured everything out except getting the $args to limit the number of posts in each loop.
Could WordPress core be interfering with the $args somehow?
LanceHillier
ParticipantHere is my current code:
<?php //* Force full-width-content layout setting add_filter( 'genesis_pre_get_option_site_layout', '__genesis_return_full_width_content' ); add_action( 'genesis_loop', 'lh_ukevideos_loop' ); remove_action( 'genesis_loop', 'genesis_do_loop' ); /** * Uke Charts Loop * */ function lh_ukevideos_loop() {?> <?php $args=array( //Loop 1 'post_type' => 'videos', 'taxonomy' => 'video-tags', 'term' => 'beginner-videos', 'posts_per_page' => '3' ); $myloop = new WP_Query($args);?> <div class="beginner-videos"> <div class="wrap"> <?php if ( $myloop->have_posts() ): $count = 2; while ( $myloop->have_posts() ): $myloop->the_post(); $videos = get_post_meta( get_the_ID(), 'beginner_videos', true ); if( $videos ) { for( $i = 0; $i < $videos; $i++ ) { $title = esc_html( get_post_meta( get_the_ID(), 'beginner_videos_' . $i . '_title', true ) ); $video = esc_url( get_post_meta( get_the_ID(), 'beginner_videos_' . $i . '_video', true ) ); $thumbnail = (int) get_post_meta( get_the_ID(), 'beginner_videos_' . $i . '_thumbnail', true ); // Thumbnail field returns image ID, so grab image. If none provided, use default image $thumbnail = $thumbnail ? wp_get_attachment_image( $thumbnail, 'be_video' ) : '<img src="' . get_stylesheet_directory_uri() . '/images/default-video.png" />'; // Displayed in three columns, so using column classes $class = 0 == $i || 0 == $i % 3 ? 'one-third first' : 'one-third'; 'clearfix'; // Build the video box echo '<div class="' . $class . '"><a href="' . $video . '">' . $thumbnail . '</a>' . $title . '</div>'; } } endwhile; endif; ?> </div> </div> <?php wp_reset_query(); // end beginner videos loop ?> <?php $args2=array( //Loop 2 'post_type' => 'videos', 'taxonomy' => 'video-tags', 'term' => 'event-videos', 'posts_per_page' => '3' ); $myloop2 = new WP_Query($args2); if($myloop2->have_posts()) : while($myloop2->have_posts()) : $myloop2->the_post();?> <div class="event-videos"> <div class="wrap"> <?php $videos = get_post_meta( get_the_ID(), 'event_videos', true ); if( $videos ) { for( $i = 0; $i < $videos; $i++ ) { $title = esc_html( get_post_meta( get_the_ID(), 'event_videos_' . $i . '_title', true ) ); $video = esc_url( get_post_meta( get_the_ID(), 'event_videos_' . $i . '_video', true ) ); $thumbnail = (int) get_post_meta( get_the_ID(), 'event_videos_' . $i . '_thumbnail', true ); // Thumbnail field returns image ID, so grab image. If none provided, use default image $thumbnail = $thumbnail ? wp_get_attachment_image( $thumbnail, 'be_video' ) : '<img src="' . get_stylesheet_directory_uri() . '/images/default-video.png" />'; // Displayed in three columns, so using column classes $classs = 0 == $i || 0 == $i % 3 ? 'one-third first' : 'one-third'; 'clearfix'; // Build the video box echo '<div class="' . $classs . '"><a href="' . $video . '">' . $thumbnail . '</a>' . $title . '</div>'; } } ?> <?php endwhile; endif; ?> <?php wp_reset_query(); // end beginner videos loop ?> </div> </div> <?php } ?> <?php genesis();
LanceHillier
ParticipantWhen I use
get_the_title()
it echo's out the second loops titleLanceHillier
ParticipantEverything is laid out how I want it too now, Just need to figure out how to call the taxonomy/term title for the two loops and get the $args working to limit posts.
I've just sat down now to spend the day on it
LanceHillier
ParticipantOk, the wraps are just basic html structure that for some reason my brain didn't connect the dots...
LanceHillier
ParticipantHi Brad,
Sorry for taking up your time mate.
The problem I'm having with the styling is that their doesn't appear to be a HTML tag wrapping the containers for the loop. I can just put in a div around the loops but when I inspect element on the first loop for example the div is in the left hand corner but doesn't contain the videos in the loop.
Does that make sense?
I know this code...
// Build the video box echo '<div class="' . $classs . '"><a href="' . $p_video . '">' . $p_thumbnail . '</a>' . $p_title . '</div>'; }
...Is building the Video Box and it's putting them all in a column class of three which has been defined with the $class variable.
Just not sure how to contain those video boxes in a wrapping element that actually contains them.
LanceHillier
ParticipantHi Brad,
Is it still possible to have different number of posts in a single loop?
Do you now how I can get the two loops in containers so I can put a titles and style? they seem to be in the Video Box and in columns but I don't seem to be able to style them as a whole
Thanks again mate!!
LanceHillier
ParticipantYeah thanks Brad, I love it but I am way over my head here I think.
One of the problems I'm having with the arguments is that if I put the `if($myloop->have_posts()) : while($myloop->have_posts()) :
$myloop->the_post();`back on the first loops $arg, it runs the code twice. I have it set up like two loops inside a main loop and I wonder if that's wrong.
I'm looking for answers for the arguments in the ACF documentation right now as, are these fields even classified as posts?
LanceHillier
ParticipantThanks Brad, I'll look through that, just to clarify the two loops are coming from CPT's and a repeater field in each set up with a title, video and thumbnail.
It's been about a week of getting this far, would be great to know if I'm on the right track with it all?
LanceHillier
ParticipantVictor,
This is perfect!! I'm learning a lot about ACF right now, and this just opens up to a whole new level.
Thank you!
Lance.
LanceHillier
ParticipantOh Thanks Anita, I didn't even think of doing it the other way around, Excellent!!
November 17, 2019 at 12:09 am in reply to: Unique Image in the Genesis Featured Post Widget? #494800LanceHillier
ParticipantThanks Brad, looking at this probably not as easy to do as I'd hoped!
Thanks for the link will go through and see if I can figure it out.
November 16, 2019 at 11:49 pm in reply to: Unique Image in the Genesis Featured Post Widget? #494798LanceHillier
ParticipantHi Anita,
I have a featured post on the home page, but the post is also being featured on an archive page and I'm looking to use a different one on the front page. I know the Featured Post Widget doesn't have the capability so looking for another way, maybe through code, just can't figure it out and wondering if anyone had done this before.
Thanks for getting back to me.
LanceHillier
ParticipantAll good,
thanks Brad! and for anyone else reading my 'thinking out loud' posts!!
Will mark this as solved.
Lance.
LanceHillier
ParticipantHa,
ok I have it working with code I used from this page..
Thanks Brad, your post has helped me find the right solution, or a solution that works, really helps knowing what to look for.
I wonder now if there is an easy way to omit words from being displayed in the featured post widget, from within the editor?? as that may be an easier solution for me to remove the Author name from the top of the post?
Thanks again,
Lance. -
AuthorPosts