Quantcast
Channel: User Michael - WordPress Development Stack Exchange
Browsing index pages (44 articles)
↧

Answer by Michael for add_filter on "the_excerpt" only works when post does...

I posted an article about this a while ago:function wp_trim_all_excerpt($text) { // Creates an excerpt if needed; and shortens the manual excerpt as well global $post; $raw_excerpt = $text; if ( '' ==...

View Article


Answer by Michael for How to add a shortcode function that returns the...

get_the_terms() will always return an array; but because you have only one 'project_category', you can simply use its first element:add_shortcode( 'return_taxonomy_slug',...

View Article


Answer by Michael for different sidebars depending on template...

One possiblilty:Keep the new code in sidebar.php in your child theme.In blog-page.php, change the line get_sidebar('blog-sidebar'); to do_action( 'storefront_sidebar' ); (as in an original...

View Article

Answer by Michael for Custom HTML in specific category single page and its...

A few changes to your code:Changed the action hook to wp_head.Removed the false 'pluggable' wrapping of your function.if ( ! function_exists( 'post_is_in_descendant_category' ) ) { function...

View Article

Answer 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


Answer 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 Article

Answer 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 Article

Answer 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 Article


Answer 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 Article


Answer 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 Article

Answer 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 Article

Answer 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 Article

Answer 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 Article


Answer 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 Article

Answer 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 Article


Answer 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 Article

Answer 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 Article


Answer 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 Article

Answer 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 Article

Answer 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 Article
Browsing index pages (44 articles)


Latest Images