Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Difference between back end and front end rendering using query loop #135

Open
phoopee3 opened this issue Aug 31, 2022 · 9 comments
Open
Labels

Comments

@phoopee3
Copy link
Collaborator

phoopee3 commented Aug 31, 2022

WordPress v6.0.2
GatherPress v0.4.1

When using the query loop to display events, the date is not rendered correctly (it shows the post date, not the event date), and there is no excerpt show.

gatherpress-backend-query-loop

On the front end it shows the event date correctly (no time, but that's ok for now i think), and it shows the excerpt.

gatherpress-frontend-query-loop

@pbrocks
Copy link
Collaborator

pbrocks commented Jan 8, 2023

@phoopee3 Can you pull the latest version and check that this has been taken care of? There is a checkbox in settings that allows you to choose how you want to display dates.

@phoopee3
Copy link
Collaborator Author

phoopee3 commented Jan 8, 2023 via email

@phoopee3
Copy link
Collaborator Author

phoopee3 commented Jan 9, 2023

The query loop doesn't show the event date at all, and I don't know of a way to show it in the loop.

@pbrocks
Copy link
Collaborator

pbrocks commented Jan 11, 2023

The query loop doesn't show the event date at all, and I don't know of a way to show it in the loop.

I don't know what you mean here. I've looked at this using 2020 theme and things mostly work as expected. I do notice that using the Query Loop block, the GatherPress setting for showing dates isn't accounted for in the editor, but frontend works.

Custom Query works as expected
https://
custom-query-loop
take.ms/lsYUS

Query Loop Block
https://take.ms/KPGtX
query-loop-block

@pbrocks
Copy link
Collaborator

pbrocks commented Jan 11, 2023

add_shortcode('do-custom-event-loop', 'do_custom_event_loop' );
/**
 * [do-custom-event-loop] Shortcode for Events 
 *
 * @return string
 */
function do_custom_event_loop() {
	$settings = GatherPress\Core\Settings::get_instance();
	$use_event_date = ( $settings->get_value( 'gp_general', 'general', 'post_or_event_date' ) ? 'using Event Date' : 'using Post Date' );

	$args = array(
	    'post_status' => 'publish',
	    'post_type' => 'gp_event'
	);
 
	$query = new WP_Query( $args );

	ob_start();
	echo '<h4 style="color:salmon">' . $use_event_date . '</h4>';
	if ( $query->have_posts() ) {

	    echo '<ul class="category posts">';

	        while ( $query->have_posts() ) {
	            $query->the_post();
	            ?>
	            <li <?php post_class( 'left' ); ?>>
	            	<?php echo 'Post ID -- ' .  $query->post->ID . ' = '; ?>
	                <a href="<?php the_permalink(); ?>" title="<?php the_title_attribute(); ?>">
	                    <?php the_title(); ?>
	                </a> | <?php the_date( 'F j, Y' ); 
	                 echo ' |*no*format*| ' . the_date();
	                 echo '<br>|| ' . get_the_date( 'Y F j', $query->post->ID  ); 
	                 echo '<br>|| ' . get_the_time( 'Y F j', $query->post->ID  ); 
	                 echo '<br>||| ' . get_the_date( 'F j, Y', $query->post->ID  ); 
	                 echo '<br>|||| ' .  get_the_time('Y-m-d', $query->post->ID );
	                 ?> 
	            </li>
	            <?php
	        }
	    echo '</ul>';
	}

	wp_reset_postdata();
	$return_value = ob_get_clean();
	return $return_value;
}

@pbrocks
Copy link
Collaborator

pbrocks commented Jan 11, 2023

@mauteri Seems to be an issue in editor for Query Loop blocks, but I wouldn't dig further into this for v1, unless we get someone with deep knowledge of React blocks.

@mauteri
Copy link
Contributor

mauteri commented Feb 23, 2024

Query Loop block is probably not great for Events. Best to use the GatherPress block Events List or the future calendar block. Query Loop is using published date, which events have but are not relevant. On the front end, we have a setting to override the published date with the event date for events.

There might be a filter we can leverage in Query Loop (or one we can put a PR in for Gutenberg so it honors the filter that exists in the publish date filter), but the ordering is still by publish date, which you wouldn't want with events.

We can leave this open, but I don't think there's anything actionable at this point.

@carstingaxion carstingaxion added this to the 0.30.0 milestone Jun 16, 2024
@mauteri mauteri removed this from the 0.30.0 milestone Jul 21, 2024
@mauteri
Copy link
Contributor

mauteri commented Aug 7, 2024

@carstingaxion I believe solved this with his Event Query Loop block variation. If you select Event it converts itself to the Event Query Loop from what I understand from his quick demo. So this will be solved when we release Event Query Loop as a feature of the plugin.

@carstingaxion
Copy link
Collaborator

That is correct. Take a look at the screen capture in my least recent comment at #599 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants