Skip Navigation

[Resolved] Custom type template custom shortcode + YOAST SEO

This support ticket is created 5 years, 8 months ago. There's a good chance that you are reading advice that it now obsolete.

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

Sun Mon Tue Wed Thu Fri Sat
- 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 -
- 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 -

Supporter timezone: Asia/Kolkata (GMT+05:30)

Tagged: 

This topic contains 4 replies, has 2 voices.

Last updated by BV 5 years, 8 months ago.

Assisted by: Minesh.

Author
Posts
#1229195

BV

Hi!

I made my custom shortcode which displays gallery made of all images attached to the custom post. I placed shortcode call into a custom type template.

Now I have such problem: YOAST SEO not see that shortcode output and recommend me to add photos. As I suppose, it's because shortcode is out of the post body.

What to do to make YOAST SEO check that shortcode output to form proper advice on how to improve post SEO?

This is the code:

function display_attached_images($atts) {
	if(isset($atts['id'])):
           $pid = $atts['id'];
    else:
           return;
    endif;
	$images =& get_children( array (
		'post_parent' => $pid,
		'post_type' => 'attachment',
		'post_mime_type' => 'image'
	));
	
	if ( empty($images) ) {
		// no attachments here
      	return;
	} else {
      	$output='';
		foreach ( $images as $attachment_id => $attachment ) {
			$output.= wp_get_attachment_link( $attachment_id, 'thumbnail' );
		}
      	return $output;
	}
}
add_shortcode("display_attached_images", "display_attached_images");

function add_class_attachment_link($html){
    $postid = get_the_ID();
    $html = str_replace('<a ','<a rel="lightbox" ',$html);
    return $html;
}
add_filter('wp_get_attachment_link','add_class_attachment_link',10,1);
#1229293

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

Hello. Thank you for contacting the Toolset support.

Well - I would recommend you to contact the Yoast support on this query as they will be the best person to guide you on SEO things and what will be the correct solution to apply here.

Thank you.

#1229295

BV

I understand, but toolset custom fields work correctly in toolset types templates by similar way, so maybe a person who wrote them can answer my question.

#1229317

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

Well - sir, there is no issue to support you if Toolset is involved here but the code you shared is custom code and it's beyond the scope of our support policy to support such custom edits.
=> https://toolset.com/toolset-support-policy/

As a supporter, We need to work within defined support boundaries and that is why (as this is a custom code) I can not escalte this to the next level. Hope this is clear and you will find the solution from Youst support.

Thank you for understanding.

#1232666

BV

My issue is resolved now. Thank you!