• Resolved erick.dhaene

    (@erickdhaene)


    This

    "printf('<li><a href="%s"> %s </a> le %s %s</li>',
                 get_permalink($event->ID),
                 get_the_title($event->ID),
                 eo_get_the_start($format, $event->ID,null,$event->occurrence_id),
    eo_get_event_uid($event->ID));"

    this works well but why i can’t do this :

    "printf('
    <li><a href="%s"> %s </a> le %s %s</li>
    ',
                 get_permalink($event->ID),
                 get_the_title($event->ID),
                 eo_get_the_start($format, $event->ID,null,$event->occurrence_id),
     eo_get_the_content($event->ID));"

    ????

    https://www.ads-software.com/plugins/event-organiser/

Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Author Stephen Harris

    (@stephenharris)

    No, you use WordPress’ native the_content() or get_the_content(). (Though the former you can’t use ‘outside’ the loop).

    Thread Starter erick.dhaene

    (@erickdhaene)

    So how do you bring up the contents or extract and the thumbnail?

    Thread Starter erick.dhaene

    (@erickdhaene)

    <?php
    		$events = eo_get_events(array(
                        'numberposts'=>-1,
                        'tax_query'=>array( array(
                             'taxonomy'=>'event-category',
                             'operator' => 'IN',
                             'field'=>'slug',
                             'terms'=>array('photos','petite-enfance-2')
                             ))));?>
    
    			<?php if ( have_posts() ) : ?>
    
    			<header class="archive-header">
    				<h1 class="archive-title"><?php printf( __( 'Photos de la petite enfance: %s', 'twentyfourteen' ), single_cat_title( '', false ) ); ?></h1>
    
    				<?php
    					// Show an optional term description.
    					$term_description = term_description();
    					if ( ! empty( $term_description ) ) :
    						printf( '<div class="taxonomy-description">%s</div>', $term_description );
    					endif;
    				?>
    			</header><!-- .archive-header -->
    
    			<?php
    				// Start the Loop.
    
    if ( $events ) {
    	foreach ( $events as $post ) {
    		setup_postdata( $post );
    		the_title();
    		the_post_thumbnail ();
    		the_excerpt();
    	}
    	wp_reset_postdata();
    }
    
    					// Previous/next page navigation.
    					twentyfourteen_paging_nav();
    
    				else :
    					// If no content, include the "No posts found" template.
    					get_template_part( 'content', 'none' );
    
    				endif;
    			?>

    I do not understand why it works, can you explain please ?

    Plugin Author Stephen Harris

    (@stephenharris)

    See this post: https://stephenharris.info/get-post-content-by-id/.

    From memory you need to declare global $post; when using stuff like the_content() outside the loop. (Not sure about excerpt).

    Thread Starter erick.dhaene

    (@erickdhaene)

    Thank you to you for your response speed. Sincerely, good luck to you and your plugin

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Why eo_get_the_content/eo_get_the_excerpt don't exist ?’ is closed to new replies.