WordPress.org

Ready to get started?Download WordPress

Forums

stella plugin
Language specific content when using get_posts() (2 posts)

  1. sterfpaul
    Member
    Posted 1 year ago #

    In a plugin a wrote i use get_posts() to get a list of posts.
    I then show the title and excerpt of these post but it doesn't show the title in the selected language.

    Am I doing something wrong or should i be doing this a different way?

    <?php
    		global $post;
    		$menuItems = get_posts(
    						array(
    							'post_parent' => $post->ID,
    							'post_type' =>  'eazieMenuItem',
    							'post_per_page' => -1
    						)
    					);
    		foreach($menuItems as $menuItem)
    		{
    		?>
    
    			<tr>
    				<td>
    					<span class='menuItemTitle'>
    						<?php echo $menuItem->post_title;?>
    					</span>
    					<?php echo get_eazie_excerpt($menuItem->ID);?>
    				</td>
    				<td class='priceCol'><?php echo get_post_meta($menuItem->ID, 'cals', true)?></td>
    				<td class='priceCol'><?php echo get_post_meta($menuItem->ID, 'price', true)?></td>
    			</tr>
    		<?php
    		}
    
    		?>

    http://wordpress.org/extend/plugins/stella-free/

  2. Ruslan.Khakimov
    Member
    Plugin Author

    Posted 1 year ago #

    Hi,
    Use
    echo get_the_title( $menuItem->post_ID );
    instead
    echo $menuItem->post_title;

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic