gentheme
Forum Replies Created
-
Forum: Everything else WordPress
In reply to: Remove sizes=”auto, …” in WordPress 6.7Add to functions.php
add_filter('wp_lazy_loading_enabled', '__return_false');
Forum: Plugins
In reply to: [WordPress Popular Posts] How to use fully customised HTML StructureThank you. I works. But it looks like I will not able to use it as the plugin generates the html client side with js. I saw huge performance drop in CLS in core web vitals. But thanks for such great plugin.
Forum: Plugins
In reply to: [WordPress Popular Posts] How to use fully customised HTML StructureNot executing SVGs correctly:
<!-- Trending Posts Widget -->
<div class="widget PopularPosts" data-version="2" id="PopularPosts00">
<h2 class="title dt noTOC">Trending</h2>
<div class="itemPp" role="feed">
<?php
if (function_exists('wpp_get_mostpopular')) {
wpp_get_mostpopular(array(
'limit' => 4,
'range' => 'last30days',
'order_by' => 'views',
'wpp_start' => '<div class="wpp-wrapper">',
'wpp_end' => '</div>',
'stats_comments' => 1, // Enable stats_comments to get the comments count
'post_html' => '
<article class="itm {current_post}">
<div class="iThmb pThmb">
<a class="thmb" href="{url}">
<img alt="{text_title}" class="imgThm lazy" src="{thumb_url}" />
</a>
<div class="iFxd">
<a aria-label="Comments" class="cmnt" data-text="{comments}" href="{url}#respond" role="button">
<svg class="line" viewBox="0 0 24 24"><g transform="translate(2.000000, 2.000000)"><path d="M17.0710351,17.0698449 C14.0159481,20.1263505 9.48959549,20.7867004 5.78630747,19.074012 C5.23960769,18.8538953 1.70113357,19.8338667 0.933341969,19.0669763 C0.165550368,18.2990808 1.14639409,14.7601278 0.926307229,14.213354 C-0.787154393,10.5105699 -0.125888852,5.98259958 2.93020311,2.9270991 C6.83146881,-0.9756997 13.1697694,-0.9756997 17.0710351,2.9270991 C20.9803405,6.8359285 20.9723008,13.1680512 17.0710351,17.0698449 Z"></path></g></svg>
<span class="comment-count">Comments: {comments}</span> <!-- Custom comment label -->
</a>
</div>
</div>
<div class="iInf pSml">
<time class="aTtmp iTtmp pbl" data-text="{date}" datetime="{date}" title="Published: {date}"></time>
<div class="pLbls" data-text="in">
{category} {tags}
</div>
</div>
<div class="iCtnt">
<div class="iInr">
<h3 class="iTtl aTtl"><a href="{url}">{text_title}</a></h3>
<div class="pSnpt">
{summary}
</div>
</div>
</div>
</article>'
));
} else {
echo '<p>No trending posts available.</p>';
}
?>
</div>
</div>Can you prefer something like this:
<!-- Trending Posts Widget -->
<div class="widget PopularPosts" data-version="2" id="PopularPosts00">
<h2 class="title dt noTOC">Trending</h2>
<div class="itemPp" role="feed">
<?php
// Query for popular posts
$popular_posts = new WP_Query([
'posts_per_page' => 4,
'orderby' => 'views',
'order' => 'DESC'
]);
if ($popular_posts->have_posts()) :
while ($popular_posts->have_posts()) : $popular_posts->the_post(); ?>
<article class="itm <?php if ($popular_posts->current_post == 0) echo 'mostP'; ?>">
<div class="iThmb pThmb">
<a class="thmb" href="<?php the_permalink(); ?>">
<img alt="<?php the_title_attribute(); ?>" class="imgThm lazy" src="<?php echo get_the_post_thumbnail_url(get_the_ID(), 'large'); ?>" />
</a>
<div class="iFxd">
<a aria-label="Comments" class="cmnt" data-text="<?php echo get_comments_number(); ?>" href="<?php comments_link(); ?>" role="button">
<svg class="line" viewBox="0 0 24 24"><g transform="translate(2.000000, 2.000000)"><path d="M17.0710351,17.0698449 C14.0159481,20.1263505 9.48959549,20.7867004 5.78630747,19.074012 C5.23960769,18.8538953 1.70113357,19.8338667 0.933341969,19.0669763 C0.165550368,18.2990808 1.14639409,14.7601278 0.926307229,14.213354 C-0.787154393,10.5105699 -0.125888852,5.98259958 2.93020311,2.9270991 C6.83146881,-0.9756997 13.1697694,-0.9756997 17.0710351,2.9270991 C20.9803405,6.8359285 20.9723008,13.1680512 17.0710351,17.0698449 Z"></path></g></svg>
</a>
</div>
</div>
<div class="iInf pSml">
<time class="aTtmp iTtmp pbl" data-text="<?php echo get_the_date('M j'); ?>" datetime="<?php echo get_the_date('c'); ?>" title="Published: <?php echo get_the_date(); ?>"></time>
<div class="pLbls" data-text="in">
<!-- Display the main category and first tag -->
<?php
$category = get_the_category();
if (!empty($category)) {
echo '<a aria-label="' . esc_attr($category[0]->name) . '" data-text="' . esc_html($category[0]->name) . '" href="' . esc_url(get_category_link($category[0]->term_id)) . '" rel="category"></a>';
}
$post_tags = get_the_tags();
if (!empty($post_tags)) {
echo '<a aria-label="' . esc_attr($post_tags[0]->name) . '" data-text="' . esc_html($post_tags[0]->name) . '" href="' . esc_url(get_tag_link($post_tags[0]->term_id)) . '" rel="tag"></a>';
}
?>
</div>
</div>
<div class="iCtnt">
<div class="iInr">
<h3 class="iTtl aTtl"><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h3>
<div class="pSnpt">
<?php echo wp_trim_words(get_the_excerpt(), 15, '...'); ?>
</div>
</div>
</div>
</article>
<?php endwhile;
wp_reset_postdata();
else : ?>
<p>No trending posts available.</p>
<?php endif; ?>
</div>
</div>Thank you for responding. Yes, exactly, I am talking about Person schema. Here how Rank math can include it:
// Example structure I used previously
$video_schema = [
"@context" => "https://schema.org",
"@type" => "VideoObject",
"name" => $video_title,
"thumbnailUrl" => $thumbnail_url,
"uploadDate" => $upload_date,
"contentUrl" => $content_url,
"description" => $video_description,
"duration" => $video_duration,
"author" => [
"@type" => "Person",
"name" => $author_name,
"url" => $author_url
]
];I tested this version on Rich Result Test by Google and it is showing Valid without any warning. I was using this schema when using Yoast, but that was manual. Now after moving on to Rank math, it becomes easy to enable Video schema directly from the editor. But this was missing:
"author" => [
"@type" => "Person",
"name" => $author_name,
"url" => $author_url
]As you mentioned about Organization, yes Organization type is already exists in the webpage, just the author {Person} is missing.
As per schema.org’s standards, the author property should be added under the Organization and Person schema
Rankmath supportIf possible, then add the author property under Organization and Person schema as you mentioned. Google just need a author name to show the name in the Search results. This way, people can directly find who uploaded the video on a perticular website.
Same issue. Unable to load the YOAST when editing post in the Block Editor. PHP version8.2.22 (Supports 64bit values)
Thank you. But output also includes the #post_excerpt like:
<p class="pDesc">#post_excerpt This is AIO SEO description.</p>
For now, i have solved it using replace method.
// If Yoast SEO and Rank Math descriptions are not available, check for All in One SEO description
if (empty($post_description) && function_exists('aioseo')) {
$metaData = aioseo()->meta->metaData->getMetaData($post_id);
$post_description = $metaData->description;
// Remove #post_excerpt if it is present
$post_description = str_replace('#post_excerpt ', '', $post_description);
}