Answer by Michael for Show 5 posts and than 3 posts offset with pagination
under settings - reading, set 'blog pages show at most' to 8then use conditional statements based on the current post number in the loop;<?php if (have_posts()) : ?><?php while (have_posts())...
View ArticleAnswer by Michael for Closing the loop...featured image variable based on...
try using: $featured_img_url = get_the_post_thumbnail_url($queried_post->ID, 'full');
View ArticleAnswer by Michael for Can I show all the template files that are being used...
this would add a column with the page template file name into the 'Pages' in the dashboard:// ONLY WORDPRESS DEFAULT PAGESadd_filter('manage_page_posts_columns', 'custom_admin_columns_head',...
View ArticleAnswer by Michael for How to get the number of Pages in a single Post...
have a look at https://codex.wordpress.org/Global_Variables#Inside_the_Loop_variableswithin the loop, the global variables related to the <!--nextpage--> tag are:$page - the actual sub...
View ArticleAnswer by Michael for Remove a specific category ID from related post
from looking at https://developer.wordpress.org/reference/functions/wp_get_post_terms/and https://developer.wordpress.org/reference/classes/wp_term_query/__construct/ for corresponding parameters, i.e....
View ArticleAnswer by Michael for exclude category from get_posts?
as 'get_posts()' uses the 'WP_Query()' parameters, i would assume that this should work:$laargsM = array('cat' => 7,'posts_per_page' => 300,'orderby' => 'title','order' =>...
View ArticleAnswer by Michael for Uncode theme, create author page and author link under...
before making edits, please consider to create a child theme for your customization; https://developer.wordpress.org/themes/advanced-topics/child-themes/to show a link to the author's page...
View ArticleAnswer by Michael for How to display featured image description and title?
this might work:$post_thumbnail_id = get_post_thumbnail_id($post->ID);$thumbnail_image = get_posts(array('p' => $post_thumbnail_id, 'post_type' => 'attachment'));if ($thumbnail_image...
View ArticleAnswer by Michael for Continue or break the while loop
'break' is the right keyword...code structure below, no custom query needed if used in a standard template.<?php $posts_per_first_section = 6; //how many posts you want to show in the first...
View ArticleAnswer by Michael for How to hide empty pagination button when no previous page
<nav class="pagination" role="navigation"><?php if( get_previous_posts_link() ) { ?><div id="prv" class="button pag-btn nav-next"><?php previous_posts_link( 'Previous' );...
View ArticleAnswer by Michael for Change logo url based on WP user role
try this filter for the logo url link; adapt your landing page links:function user_defined_logo_url( $html ) {$cur_user = wp_get_current_user();$user_role = $cur_user->roles[0];$logo_url = esc_url(...
View ArticleAnswer by Michael for In category.php I need to get the next 10/previous 10...
if the only difference in the category archives is the images, you can work without a custom query.in this case you could use (as suggested here...
View ArticleAnswer by Michael for Get custom title if category
change this one line in your code:<h1 class="article-title entry-title">How To <?php the_title(); ?> Free</h1>to:CORRECTION:<h1 class="article-title entry-title"><?php if(...
View ArticleAnswer by Michael for Pagination in category.php not functioning
if your aim is to restrict the category archive to your post_type 'video' and to 6 posts per page, do not edit category.php, rather use...
View ArticleAnswer by Michael for Don't show a tag on a post if it is the only post with...
you can try using a filter function (added into functions.php of your (child) theme), specific to your taxonomy 'topic':(based on https://developer.wordpress.org/reference/functions/get_the_term_list/...
View ArticleAnswer by Michael for Adding register & login in Wordpress website
integrating some of the suggested functions into your code:<?php $c_user = wp_get_current_user(); if( !is_user_logged_in( $c_user->ID ) ) : echo '<a href="' . esc_url( wp_login_url() ) . '"...
View ArticleAnswer by Michael for str_replace remove words from title
the_title() will directly output the title - for your purpose in a string manipulation, you need to use get_the_title()https://developer.wordpress.org/reference/functions/get_the_title/you also have...
View ArticleAnswer by Michael for Infinite looping next post link within a certain...
based on the docu:the $in_same_term parameter in https://developer.wordpress.org/reference/functions/next_post_link/the categories' parameters in WP_Query...
View ArticleAnswer by Michael for include specific Pages to wp_list_pages with filter
the corresponding hook would be https://developer.wordpress.org/reference/hooks/widget_pages_args/example code:add_filter( 'widget_pages_args','include_special_pages' );function include_special_pages(...
View ArticleAnswer by Michael for My custom post type not show category
the $args need to onclude 'show_in_rest' => truefrom https://developer.wordpress.org/reference/functions/register_taxonomy/'show_in_rest'(bool) Whether to include the taxonomy in the REST API. Set...
View Article