How to display a second image with qrcode in Feed RSS Ticker

Hello @natasha or @dan :v:

I need to display a second image in addition to the main image in the Feed RSS Ticker.
This other image will be the QRCODE with the post link.

I’ve already managed to create the XML containing the 2 links:

<enclosure url="https://mydomain.com/wp-content/uploads/2021/IMG35551.jpg" type="image/jpeg"/>
<enclosure url="https://mydomain.com/wp-content/uploads/qrcode_post_link/9915.png" type="image/png"/>

But I’m not able to display the QRCODE only the Main image is displayed.

See the code:

<rss version="2.0">
<channel>
	<title><?php bloginfo_rss('name'); ?> - Feed</title>
	<link><?php bloginfo_rss('url') ?></link>
	<description><?php bloginfo_rss('description') ?></description>
	<?php while(have_posts()) : the_post(); ?>
		<item>
			<title><?php the_title_rss(); ?></title>
			<guid isPermaLink="true"><?php the_guid(); ?></guid>
			<?php if (has_post_thumbnail( $post->ID ) ): ?>
				<?php $image = wp_get_attachment_image_src( get_post_thumbnail_id( $post->ID ), 'single-post-thumbnail' ); ?>
				<enclosure url="<?php echo $image[0]; ?>" type="image/jpeg" />
			<?php endif; ?>
			<?php $qrcode = get_bloginfo('url').'/site/wp-content/uploads/qrcode_post_link/'.$post->ID.'.png' ; ?>
			<enclosure url="<?php echo $qrcode; ?>" type="image/png" />
		</item>
	<?php endwhile; ?>
	<?php wp_reset_query(); ?>
</channel>
</rss>

See XML Generated:

<rss version="2.0">
    <channel>
        <title>MY Site - Feed</title>
        <link>https://mydomain.com</link>
        <description>News</description>
        <item>
            <title>Post Title</title>
            <guid isPermaLink="true">https://mydomain.com/?p=9915</guid>
            <enclosure url="https://mydomain.com/wp-content/uploads/2021/IMG35551.jpg" type="image/jpeg"/>
            <enclosure url="https://mydomain.com/wp-content/uploads/qrcode_post_link/9915.png" type="image/png"/>
        </item>
    </channel>

</rss>

Ticker Template:

<!- Post image ->
<div class="image">[Link|image]

	<!- QR Code ->
	<div class="qr-code">
		[Link|image]
	</div> 

	<!- Post Title ->	
	<div class="cycle-overlay">
		<p class="texto" style="font-family: Arial, Verdana, sans-serif; font-size:48px; color:#ffffff;">[Title]</p>
	</div>

</div>

As it is, the post image is displayed twice, and the qrcode is not displayed.

What do I need to change to display the QRCODE image?

Will if I use: “<enclosure2” on the second image or [Link|image2] on ticker template will it work?

Thanks to anyone who can help. :grinning:

Hello.
I started a solution but got stuck on an issue.

I added 2 items in the XML creation code.
1 - The post with the cover image.
2 - The QRCode.

<rss version="2.0" 
<channel>
	<title><?php bloginfo_rss('name'); ?> - Feed</title>
	<link><?php bloginfo_rss('url') ?></link>
	<description><?php bloginfo_rss('description') ?></description>
	<?php while(have_posts()) : the_post(); ?>
		<item>
			<title><?php the_title_rss(); ?></title>
			<guid isPermaLink="true"><?php the_guid(); ?></guid>
			<?php if (has_post_thumbnail( $post->ID ) ): ?>
				<?php $image = wp_get_attachment_image_src( get_post_thumbnail_id( $post->ID ), 'single-post-thumbnail' ); ?>
				<enclosure url="<?php echo $image[0]; ?>" type="image/jpeg" />
			<?php endif; ?>
		</item>		
		<item>
			<title><?php the_title_rss(); ?></title>
 			<?php $qrcode = get_bloginfo('url').'/site/wp-content/uploads/qrcode_post_link/'.$post->ID.'.png' ; ?>
			<enclosure url="<?php echo $qrcode; ?>" type="image/png" />
		</item>
	<?php endwhile; ?>
	<?php wp_reset_query(); ?>
</channel>
</rss>

And I activated the option: [Sequential Ordering]
And In the settings, I set to display 2 items at a time.

This way, each time the Ticker is displayed, it also displays the corresponding QrCode. it works perfectly.

  • The problem with this solution is that the same posts are always displayed.

  • If I go to [Configuration] Tab > And activate the first option: [Ramdomise].
    It becomes a mess, with each repetition of the layout, the displayed QrCode does not match the news, other times the QrCode is displayed in place of the cover image, and the cover image in place of the QrCode, and other times 2 QrCodes or 2 images of front cover.

  • I also tried to disable the first option [Ramdomise] and also disable [Sequential Ordering] option.
    But the same mess occurs. (I don’t understand the difference between these 2 options, they seem to do the same thing).
    I haven’t found a combination that works as I wish.

  • If it were possible to display Ramdomizados, every 2 items (The ones that are generated together) would be great.
    So the Corresponding QrCode would always be displayed, and Always a different publication.

Hello.
Sorry to ask again.

Can anyone help me with this question?

Hello everybody.

No one has any idea how to make this implementation?

:no_mouth:

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.