Add Custom Category Description When Empty

Under the woocommerce product category page, i've been trying to find a way to auto-generated a text to show in that default "short description" area, if i don't input any description when i was posting that category. For example , if the category name on this page is : ABC, if i did not input any category description, i want it could auto generate a short description based on this name ABC, i want it to be "We stock a …
Category: Web

How can get Woocommerce product single description

I get the description of the shortcode products but they all come as text. Can I make a separate paragraph or list for each? Following my code: functions.php add_shortcode( 'product_description', 'display_product_description' ); function display_product_description( $atts ){ $atts = shortcode_atts( array( 'id' => get_the_id(), ), $atts, 'product_description' ); global $product; if ( ! is_a( $product, 'WC_Product') ) $product = wc_get_product($atts['id']); return $product->get_description(); } echo do_shortcode("[product_description]"); Then I display with shortcode. If you ask why it brings the description, I make accordion …
Category: Web

Custom Tag Description unable to display just below and outside of the Loop

Hello StackExchange Team! In my wordpress tags for custom post type, the code <?php echo term_description();?> or outputs fine just outside and above the loop. The problem I am having is that the same tag_description is blank when placed outside and below the loop below. <?php $countries_location = ''; $countries_location = apply_filters('zeetume_site_location_ads', $countries_location, 'search'); if (get_query_var('paged')) { $paged = get_query_var('paged'); } else if (get_query_var('page')) { // This will occur if on front page. $paged = get_query_var('page'); } else { $paged …
Category: Web

Wordpress Show Parent Category Description for Sub-categories

I'm using the Category description, for the parent category, to display above the posts on the category.php page. But, this desc doesn't show on any sub-categories of this parent category, and there is no desc being added to each sub-category (there are over 270 cats in total, so duplicating desc from parents to subs would be tedious at best!) Is there way to show the Parent categories desc for the parent and all it's subcategories?
Category: Web

Add description to custom plugin setting

Using add_settings_field(); i am able to add my custom setting: add_settings_field('AUTOPLAY', 'Auto Play', 'printAutoPlayCheckbox', 'my_settings'); function printAutoPlayCheckbox() { $id = 'AUTOPLAY'; $name = 'my_settings' . "[$id]"; $options = get_option('my_settings'); echo '<input type="checkbox" id="' . $id . '" name="' . $name . '" ' . checked(1, isset($options[$id]), false) . '" />'; } Now i want to add a short description of this setting, something like that: How can i do that? I couldn't find it in the WordPress docs.
Category: Web

How to Get The Excerpt of the page that displays Blog Posts

I use a static page (Blog) to display the latest posts. I want to show the excerpt of that page next to the title. However, wen I use wp_kses_post( get_the_excerpt() ), I get the excerpt of the latest post from the post archive loop. I also tried with wp_kses_post( get_the_archive_description() ) but it also does not seem to work.. Any idea how this can be done?
Category: Web

how to hide empty fields of post category description?

I am creating one website from scratch, where I have to display Category description, how to hide the div, if there is no description written in backend for the post category? my codes are: <div class="row"> <div class="col-sm-8 mx-auto py-5"> <?php echo nl2br($qo->description) ?> </div> </div> I want to hide the entire row, if there is no description written in backend for the post category. Thanks.
Category: Web

How to hide description on categories and tags?

Does anybody know how I can hide the descriptions from view for the categories and tags for my website? I have searched for a while but can't find any solutions. I would like it so that when they are clicked it just shows the categories or posts available, no description visible. Can someone show me how to do this please? https://lawlessons.co.uk/ (when hovering the mouse over the category it brings up a description). https://lawlessons.co.uk/tag/contract-law-agreement-offer-and-acceptance (when opening a category it shows …
Category: Web

How to test If a post has a particular term

I want to display a different description for a post if it belongs to a specific product category in a filter. I've used the code below code to add the code but it is displaying for all products: function herara_filter_short_description( $desc ){ global $product; if ( is_single( $product->id ) ) { $desc = '<span class="sku_wrapper">SKU: <span class="sku">'. $product->get_sku() .'</span></span></BR><span class="material_wrapper">MATERIAL: <span class="material">'. $product->get_sku() .'</span></span>'; } return $desc; } add_filter( 'woocommerce_short_description', 'herara_filter_short_description' );
Category: Web

How to display category and tag descriptions in a post

I want to display the category name and description in every post automatically. I have been trying the method of wpbeginner and searching in other platforms but it's not working for me. I cannot find this function. For example, if I'm talking about tomatoes (the post), I want to display in it its information about vegetables (the category). Any idea about how to do it? Thanks.
Category: Web

Display site description instead of site name

I'm wondering how to display all the network sites in WP Multisite by displaying site description instead of site name. Below is the code provided by the expert in WP in this community. It's now displaying site name. What code should I change in order to make the list displaying all the sites with site description? function wpse365255_print_sites() { $args = array( 'number' => 10000, // if you've got more than 10,000 sites, //you can increase this 'public' => 1, …
Category: Web

add woocommerce archive description if exist

i want show category description on my archive product page i add this code to my template: <?php if ( category_description() ) ?> <div class="myproductdescription"><?php echo category_description(); ?></div> and add this css code to style.css: .myproductdescription{ position: relative; background-color: #fff; -webkit-transition: all .3s ease; -moz-transition: all .3s ease; -o-transition: all .3s ease; transition: all .3s ease; border-radius: 7px; box-shadow: 0 2px 2px 0 rgba(168, 172, 185, .3); padding: 15px; margin-bottom: 20px; line-height: 25px;} its work! but show box shadow and …
Category: Web

How to display featured image description and title?

I'm displaying a featured image (as a background) in a hero div, and using the caption to add some content from the Media Library automatically. I'd also like to use the image's description field and title, but can't find documentation on that. Here's what I have so far, which works as expected: <div class="hero"> <?php $thumb = wp_get_attachment_image_src( get_post_thumbnail_id($post->ID), 'full' );?> <div class="hero-image" style="background-image: url('<?php echo $thumb['0'];?>')"></div> <div class="hero-content"> <h1>NEED IMAGE DESCRIPTION HERE</h1> <p class="caption"><?php get_the_post_thumbnail_caption(); ?><?php the_post_thumbnail_caption(); ?></p> </div> …
Category: Web

Something adding an excessive meta description

I have a WordPress running with Woocommerce and a commercial theme. My problem is that something is adding an extra meta tag(og:description) and it is getting on my nerve since it's content which is completely irrelevant displays on social media while sharing our links. Here's the web address: http://pay4games.ir/ and here's the code : meta property="og:description" content="[rev_slider alias="index"] جدیدترین محصولات تومان۵۷۶,۰۰۰ STAR WARS JEDI FALLEN ORDER نمره ۴٫۰۰ از ۵ افزودن به علاقه مندی ها مقایسه افزودن به سبد تماس …
Category: Web

How to add a link to an external website in the description of a customizer control (with Kirki)?

I'm building a Wordpress theme and I use the Kirki Customizer framework to add controls and settings to the customiser. I added a description to some controls, using the following code: 'description' => esc_html__( 'Description here', 'kirki' ), Now I want to add a link in the description to an external website. I already tried inserting HTML, but that doesn't work; it just did just output the flat HTML code. It probably has sth to do with the esc_html__() thing, …
Category: Web

About

Geeks Mental is a community that publishes articles and tutorials about Web, Android, Data Science, new techniques and Linux security.