trying to hide a “0” value from a HTML display

enter image description hereIs there any way to hide an HTML field based on the displayed value of "0" I have an ecomm site that displays Quantity available with a numeric value. I only want to display the number if it is above "0" The values are populated from data base upload to the site. The "0" value is NOT an input field. so most codes I see have the solution with some sort of input condition code.

My site displays this: Call for Availability.0 If item has QTY above "0" it displays this: Qty On Hand: 1708 I need to remove the "0" and only display Call for Availability.

I have researched similar request on this forum and found all have answers using an input field. The problem is the "0" is not an input. It is an code generated inventory amount.

I have tried CSS to hide the value, but that hides ALL the values including above "0".

I can insert any form of code needed. Java, PHP, json, etc…

Here is a sample of actual code I have:

<div id="availabilityInfo" class="availabilityInfo">  <span class="availability-header">[product_Header-availability]</span> <span id="availability" class="product_availability availability-item">[availability]</span>  <span style="display: inline;" id="product_inventory">[stock] <span class="freeshipping availability-item"><!--[freeshipping]--></span>  </span></div> 

The [STOCK] tag is what brings in the qty value of "0"

Code snippet to display ID gives critical error

Based on this post, I added the code snippet below to my WordPress site, as to display the ID in the Posts section of each post. However, it returns "critical error". Any idea what is wrong with this code?

add_filter( 'manage_posts_columns', 'column_register_wpse_101322' ); add_filter( 'manage_posts_custom_column', 'column_display_wpse_101322', 10, 3 );  function column_register_wpse_101322( $  columns ) {     $  columns['uid'] = 'ID';     return $  columns; }  function column_display_wpse_101322( $  empty, $  column_name, $  post_id ) {     if ('uid' != $  column_name) {return $  empty;}     return "$  post_id"; } 

display text generated via custom get query string

I’m trying to display some text on my page, generating it via get query string, e.g. calling this url: mysite.com/page/?letter=exampletext

If I understand correctly in such cases it is needed to "add them to the public query variables available to WP_Query" (stated here https://developer.wordpress.org/reference/functions/get_query_var/), so I followed directions adding the following code to my page template:

<?php  function queries( $  qvars ) {     $  qvars[] = 'letter';     return $  qvars;     } add_filter( 'query_vars', 'queries' );  $  text = get_query_var( 'letter' ); echo "letter is: ".$  text; ?> 

unfortunately this is not working as expected, since it only diplays the exlicit part of the string ("letter is: ").

What am I missing? Thanks everyone

Display related posts without a plugin

I’m trying to display the related posts using functions.php:

function posts_related($  related){ if (is_single()) { global $  post; // Build basic custom query arguments $  custom_query = new WP_Query( array(         'posts_per_page' => 8, // Number of related posts to display        'post__not_in' => array($  post->ID), // Ensure that the current post is not displayed        'orderby' => 'rand', // Randomize the results ));  // Run the loop and output data for the results if ( $  custom_query->have_posts() ) : while ( $  custom_query->have_posts() ) : $  custom_query->the_post();   if ( has_post_thumbnail()   ) {                   $  permalink = the_permalink();                  $  post_thumbnail = the_post_thumbnail('medium');                  $  title = the_title();                                         $  related .= '<a href="' . $  permalink .  '"><img src="' . $  post_thumbnail . '/></a>';                               }            $  related .=  '<a href="' .  $  permalink . '"><b>' . $  title . '</b></a>';      endwhile;   else :      $  related .= '<p>Nothing to show.</p>'; endif; // Reset postdata }          echo '<pre>'; var_dump( has_post_thumbnail() ); echo '</pre>';       return $  related;  }    //wp_reset_postdata();  add_filter( "the_content", "posts_related", 99 ); add_theme_support( 'post-thumbnails' ); set_post_thumbnail_size( 100, 50, true ); 

But I’m not being able to handle the output properly. I need it to display below the post (single post).

WooCommerce – Display Product image and name on Orders page

I used the solution here (linked below). It works great. However, it glitches when displaying an order containing a product that has since been deleted. Is there a way to modify the code so that on products that have been deleted it just shows nothing instead of a huge paragraph of gibberish? Just curious!

Original solution was by @meloman : Display order items names in WooCommerce admin orders list

display childs without parent

The following code displays the parent plus his children on the specific parent- and children-category pages as "filter-buttons". But in this list I do not want to display the parent, (because the parent is already displayed as "ALL"). How can I display list with only the childre/ without the parent?

Thank you for any further help.

<?php $ categories = get_the_category(); foreach($ categories as $ key => $ category) { $ url = get_term_link((int)$ category->term_id,'category'); $ categories[$ key] = "<pre><a href=\"{$ url}\">{$ category->name}</a></pre>"; } echo "" . implode("\n",$ categories) . ""; ?>

display an input string many times

I’d like to create a function that add 2 to an integer as much as we want. It would look like that:

>>> n = 3  >>> add_two(n) Would you like to add a two to n ? Yes The new n is 5 Would you like to add a two to n ? Yes the new n is 7 Would you like to add a two to n ? No 

Can anyone help me please ? I don’t how I can print the sentence without recalling the function.

How to display all posts in a category at the end of a single post?

The "work" page for my portfolio is simply all the posts in the "work" category. They are displayed as a thumbnail grid. Here.

<?php get_header(); ?>  <div class="grid work thumb-wrap clearfix"> <?php if ( have_posts() ) : while ( have_posts() ) : the_post();?>                               <a class="thumb" href="<?php the_permalink(); ?>">             <img src="http://www.nathanspence.com/wp-content/uploads/<?php echo get_post_meta($  post->ID, 'thumb', true); ?>"/>             <div class="post-excerpt">                 <h2><?php echo get_the_title($  ID); ?></h2>                 <div class="sub-title"><?php echo get_post_meta($  post->ID, 'project-name', true); ?></div>             </div>               </a>                               <?php endwhile; ?>         <?php endif; ?>  </div><!--end of "thumb-wrap"-->  <div class="push"></div>      </div><!--end of "page-wrap"-->   <?php get_footer(); ?> 

I want to duplicate this at the end of each single post. Here.

<?php get_header(); ?>  <div class="page-content">  <?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>   <article class="work post-content ready-to-column clearfix">                      <header class="post-header column-left">         <h1><?php echo get_the_title($  ID); ?></h1>         <h2><?php echo get_post_meta($  post->ID, 'project-name', true); ?></h2>         <div class="project-info"><?php echo get_post_meta($  post->ID, 'project-info', true); ?></div>                        </header>          <div class="column-right">     <?php the_content(); ?>                                   </div><!---end of "right-column flex-column"--->               </article>      <?php endwhile; else: ?>     <p>Sorry, this post does not exist</p> <?php endif; ?>          <div class="grid work thumb-wrap clearfix"> <?php if ( have_posts() ) : while ( have_posts() ) : the_post();?>                               <a class="thumb" href="<?php the_permalink(); ?>">             <img src="http://www.nathanspence.com/wp-content/uploads/<?php echo get_post_meta($  post->ID, 'thumb', true); ?>"/>             <div class="post-excerpt">                 <h2><?php echo get_the_title($  ID); ?></h2>                 <div class="sub-title"><?php echo get_post_meta($  post->ID, 'project-name', true); ?></div>             </div>               </a>                               <?php endwhile; ?>         <?php endif; ?>  </div><!--end of "thumb-wrap"-->  <div class="push"></div>      </div><!--end of "page-wrap"-->   <?php get_footer(); ?>  

As you can see, simply pasting it in just shows the current posts thumbnail. Any idea how I can do this?