timothy12
Forum Replies Created
-
@maybellyne Thanks for your reply and the suggestion for the developer portal. I will think about it. For now, I’ve found a solution that works, but it is not the best one. That would be the adepted query.
This snippet shows all posts with their yoast primary category. What do I have to add to get only the posts with the primary category ‘Prezi’ or ‘Kahoot’?
$primary_term = get_post_meta(get_the_ID(), '_yoast_wpseo_primary_category', true);
$the_query = new WP_Query(array(
'post_type' => 'post',
'posts_per_page' => 3,
'post_status' => 'publish',
'category_name' => $primary_term,
'orderby' => 'rand',
'order' => 'asc',
));Forum: Fixing WordPress
In reply to: Different post views with same template & cssI had some trouble finding the “extra” closing div, but I’ve found it. I still find it weird that the error with the pagination didn’t occur on each page, while all of them are using the same template (parts).
Thanks for your tips and checking my thoughts @rickymccallum87 !Forum: Fixing WordPress
In reply to: Different post views with same template & css@rickymccallum87 Thans for your reply! I’m going to try the validator. I’ve found some typing errors indeed and fixed those. I’m trying to understand the messags, but not all of them become clear already so I share those with you. Here are my thoughts.
This is the new source code without the typing errors.
<div id="content"> <div class="insidebox">
<article id="post-372" class="post-372 post type-post status-publish format-standard has-post-thumbnail hentry category-docs category-klassenmanagement tag-kennismaken tag-nieuwe-klas tag-start-schooljaar tag-voorstellen tag-wennen tag-werkblad">
<h1>Werkblad kennismaken</h1> <!-- post-label: datum & auteur --> <div class="post-label"> <div class="publication-date">5 augustus 2019</div><!-- /.publication-date --> <div class="info-divider">|</div><!-- /.info-divider --> <div class="author">Meester Erik</div><!-- /.author --> </div><!-- /.post-label -->
<!-- inhoud post --> <div class="post-content">
<p>Wenochtend. Stoeltjespassen. Het heeft verschillende namen, maar het moment dat je kennis gaat maken met je nieuwe klas, kent iedereen.</p>
<span id="more-372"></span>
<p>Het blad waarop kinderen dingen over zichzelf invullen, ontbreekt op zo’n moment natuurlijk niet. Ontelbare vriendenboekjes zijn er online te vinden, zo ook op deze pagina.</p>
<figure class="wp-block-image"><img decoding="async" src="https://www.meestererik.nl/wp-content/uploads/2025/06/werkblad-kennismaken.jpg" alt=""/></figure>
<h3 class="wp-block-heading">Download</h3>
<div class="downloadbox"><div class="downloadbox-item"><div class="icon-type"><span class="icon-get_app"></span></div><div class="download-content"><a href="https://www.meestererik.nl/wp-content/uploads/2019/08/werkblad-kennismaking.pdf" target="_blank" rel="noreferrer noopener">Werkblad voorstellen</a></div></div></div><!-- /.downloadbox -->
</div><!-- /.post-content -->
<!-- post-label: categorieën, tags & edit --> <div class="post-label"> <div id="post-categories"><ul class="post-categories"> <li><a href="https://www.meestererik.nl/docs" rel="category tag">Docs</a></li> <li><a href="https://www.meestererik.nl/klassenmanagement" rel="category tag">Klassenmanagement</a></li></ul></div><!-- /#post-categories --><div id="post-tags"><a href="https://www.meestererik.nl/tag/kennismaken" rel="tag">kennismaken</a><a href="https://www.meestererik.nl/tag/nieuwe-klas" rel="tag">nieuwe klas</a><a href="https://www.meestererik.nl/tag/start-schooljaar" rel="tag">start schooljaar</a><a href="https://www.meestererik.nl/tag/voorstellen" rel="tag">voorstellen</a><a href="https://www.meestererik.nl/tag/wennen" rel="tag">wennen</a><a href="https://www.meestererik.nl/tag/werkblad" rel="tag">werkblad</a></div></div><!-- /#post-tags --><div id="post-edit"><a class="post-edit-link" href="https://www.meestererik.nl/wp-admin/post.php?post=372&action=edit">Bewerk post <span class="screen-reader-text">Werkblad kennismaken</span></a></div><!-- /#post-edit --> </div><!-- /.post-label -->
<div id="post-socials"> <div class="widget-box"><div class="a2a_kit a2a_kit_size_32 addtoany_list"><a class="a2a_button_facebook" href="https://www.addtoany.com/add_to/facebook?linkurl=https%3A%2F%2Fwww.meestererik.nl%2Fwerkblad-kennismaken&linkname=Meester%20Erik%20%7C%20Werkblad%20kennismaken" title="Facebook" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_linkedin" href="https://www.addtoany.com/add_to/linkedin?linkurl=https%3A%2F%2Fwww.meestererik.nl%2Fwerkblad-kennismaken&linkname=Meester%20Erik%20%7C%20Werkblad%20kennismaken" title="LinkedIn" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_pinterest" href="https://www.addtoany.com/add_to/pinterest?linkurl=https%3A%2F%2Fwww.meestererik.nl%2Fwerkblad-kennismaken&linkname=Meester%20Erik%20%7C%20Werkblad%20kennismaken" title="Pinterest" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_whatsapp" href="https://www.addtoany.com/add_to/whatsapp?linkurl=https%3A%2F%2Fwww.meestererik.nl%2Fwerkblad-kennismaken&linkname=Meester%20Erik%20%7C%20Werkblad%20kennismaken" title="WhatsApp" rel="nofollow noopener" target="_blank"></a></div></div> </div><!-- /#post-socials -->
<div id="post-navigation">
<div class="post-navigation post-next"> <a href="https://www.meestererik.nl/sporen" rel="next"><div class="icon-chevron-left"></div><div class="post-title">Sporen</div></a> </div><!-- /.post-next -->
<div class="post-navigation post-prev"> <a href="https://www.meestererik.nl/vertelpantomime-kapitein-roodbaard" rel="prev"><div class="post-title">Vertelpantomime – Kapitein Roodbaard</div><div class="icon-chevron-right"></div></a> </div><!-- /.post-prev -->
</div><!-- /#post-navigation -->
</article><!-- #post-372 --> </div><!-- /.insidebox --> </div><!-- /#content -->Messages 1, 2 and 3, are caused by the fact that I copied the snipped out of the source code where the problem occurs. The missing elements are in the header.php of the site.
Message 4: I don’t know what is meant by trailing slash on void elements.
Message 5: What is meant by the open elements? Are that the
<article>in message 6? and first div in the sourcecode?Message 7: Because of the div (message 5)
<article>is expected to be closed, but isn’t (see message 6). But it’s because of that same div, the position of</article>is considered to be weird.Message 8: There is a </div> to many in the coding: the div of message 5. Due to that div, the closing div of message 8 is considered to be one to many. (But the closing div of message 5 is causing a lot of trouble.)
I hope you can follow my thougths and that can you explain the things I don’t understand, especially message 4.
Kind regards!Forum: Fixing WordPress
In reply to: Get items of wp_list_commentsI’m going to give it a try!
Forum: Fixing WordPress
In reply to: Get items of wp_list_comments@sirlouen Thanks for your quick reply and the link you’ve shared in it. I’ve seen the page, but for me it’s not exactly clear how to use it. In the examples at the page I didn’t see how the echo avatar for example. I’m not so much in to coding, but when I’ve got an idea how to start, I will find my way and can add extra code.
With the following code snippet I got it working as I wanted. Thanks for your tip! The option B also works when there is just one single category selected. It automatically becomes the primary category,
<?php
$primary_term_id = yoast_get_primary_term_id( 'category', $post_id );
$term = get_term( $primary_term_id ); // Get the term object to access its name
if ( $term->name == 'Prezi' || $term->name == 'Kahoot' ) {
echo "Lolly.";
} else {
echo "Zuurstok";
}
?>Forum: Fixing WordPress
In reply to: Echo content based on primary categoryYou were right. With the following code snippet I got it working as I wanted. Thanks for your tip! The option B also works when there is just one single category selected. It automatically becomes the primary category,
<?php
$primary_term_id = yoast_get_primary_term_id( 'category', $post_id );
$term = get_term( $primary_term_id ); // Get the term object to access its name
if ( $term->name == 'Prezi' || $term->name == 'Kahoot' ) {
echo "A.";
} else {
echo "C";
}
?>Forum: Fixing WordPress
In reply to: Echo content based on primary categoryI will copy my my question and replace it in the Yoast SEO section.
About your comment, you think I should replace theget_post_metabyget_term?Forum: Fixing WordPress
In reply to: Echo content based on primary category@sirlouen Thanks for your quick reply. Do you think i’ve to copy the post to the Yoast plugin support or can my thread moved toward that forum?
Forum: Fixing WordPress
In reply to: Content-none template part disables other template parts?Hi @t-p ,
Thanks for your reply. The plugin (Searchwp Modal Seach Form) as well as the theme (_s / underscores) are free to use. So in my opinion no commercial aspect in this case,
What do you mean by the theme/plugin could not be found?
Thanks for your help so far!Forum: Fixing WordPress
In reply to: Display parent category only in post summaryI do now! I’ve found this code snippet that does what it needs to do!
category_parent); if (!empty($parent)) {echo '' . $parent;} else {echo '' . $category[0]->cat_name;} ?>Kind regards,
TimothyForum: Fixing WordPress
In reply to: Display parent category only in post summaryHi @simrankoushal ,
Thanks for your reply. That is exactly what I’m looking foor. I know now how to display all categories or all categories with the parent in front of it. But how to display “Docs” ( my parent) only, I’ve no idea how to realise that.Forum: Fixing WordPress
In reply to: Error including template partThanks for helping me out. The other forum(s) you’ve mentionned, I didn’t know that until now. Those can be a big help in the future too. Like you ‘ve been last days.
Forum: Fixing WordPress
In reply to: Display parent category only in post summaryI’ve used your code snippet here, but now the parent is displayed in front of all the other categories. I would like to see the parent category alone.