Forum Replies Created

Viewing 6 replies - 1 through 6 (of 6 total)
  • Thread Starter pbadam

    (@pbadam)

    Thanks for the tip!

    I worked out on your reference link and the below code fixed it:

    	public static function get_stock_status() {
    		global $product;
    		return $product->is_in_stock() ? printf( '<span class="green1">'. esc_html__( 'In Stock', 'metro' ).'</span>') : printf( '<span class="red1">'. esc_html__( 'Out of Stock', 'metro' ).'</span>');
    	}

    And of course, gave the respective color to the class in css.

    • This reply was modified 3 years, 8 months ago by pbadam.
    Thread Starter pbadam

    (@pbadam)

    That’s a great idea, thanks..
    Basically, this code changes the color of the stock availibility status text
    .single-product-top-1 .product_meta-area .product-meta-content {
    color: red;
    }
    But using this, all availability text changes to red… If you use the postid code you shared above, you can change the color for individual products but you have to manually set the color for each product…

    But the specific question is how to directly link the color to the stock availability.. when the stock drops to 0, the ‘out of stock’ text should automatically become red, when the stock is available the ‘in stock’ text should automatically be green.

    Is there a code that can achieve the same?

    Also, in functions.php there is this code.. which controls the text: can it be edited to change the color?

    public static function get_stock_status() {
    global $product;
    return $product->is_in_stock() ? esc_html__( ‘In Stock’, ‘metro’ ) : esc_html__( ‘Out of Stock’, ‘metro’ );
    }

    • This reply was modified 3 years, 8 months ago by pbadam.
    Thread Starter pbadam

    (@pbadam)

    ok, I didn’t like any of the plugins so the final solution was a custom menu for every product…

    Thread Starter pbadam

    (@pbadam)

    thank you.. i worked it out!

    Thread Starter pbadam

    (@pbadam)

    thank you!

    pbadam

    (@pbadam)

    ok now this error is persisting
    I have wordpress 4.0 I didn’t upgrade to 4.0.1 just so there will be no adverse impact.
    The next gen plugin is latest – this did not fix the issue

    I am creating a slideshow gallery with the [show thumbnails] option.. But in the thumbnails view if I go to next page, I still get this
    Default Gallery Type Template…
    Default Gallery Type Template
    This is the default gallery type template, located in:
    …/plugins/nextgen-gallery/products/photocrati_nextgen/modules/nextgen_gallery_display/templates/index.php.

    If you’re seeing this, it’s because the gallery type you selected has not provided a template of it’s own.

Viewing 6 replies - 1 through 6 (of 6 total)