Forum Replies Created

Viewing 15 replies - 1 through 15 (of 45 total)
  • Thread Starter stevehoo

    (@stevehoo)

    And, in the furtherance of science, as I didn’t find it elsewhere. The yourls shortner, shortlink

    add_filter( 'rank_math/opengraph/url', function( $url ) {
        global $post;
        $og_url = get_post_meta($post->ID, '_yourls_url', true ); // Change post_meta_key with your the meta key from your site.
        if ( ! $og_url ) {
            return $url;
        }
        return $og_url;
    });
    Thread Starter stevehoo

    (@stevehoo)

    And… This is much better, as it strips the shortcode, but leaves the content inbetween.

    add_filter( 'rank_math/frontend/description', function( $description ) {
    $description = preg_replace("~(?:\[/?)[^/\]]+/?\]~s", '', $description);
        return $description;
    });
    Thread Starter stevehoo

    (@stevehoo)

    This has worked for me:

    add_filter( 'rank_math/frontend/description', function( $description ) {
    	return strip_shortcodes($description);
    });
    Thread Starter stevehoo

    (@stevehoo)

    My bad, having actually checked to see if it works… It does not.

    See https://i.imgur.com/EzlkjTs.jpg

    I’ve added to my functions.php
    add_filter( ‘rank_math/paper/auto_generated_description/apply_shortcode’, ‘__return_true’ );

    But still seeing shortcodes in my descriptions.

    • This reply was modified 1 year, 3 months ago by stevehoo.
    Thread Starter stevehoo

    (@stevehoo)

    Thank you for the better explanation. As, I searched and found this filter, added it, but saw no change on the backend and decided it wasn’t working, or not what I needed. I neglected to check on the front.

    I hope that my question, your answer and this will aid others who look for the same problem and solution.

    Thread Starter stevehoo

    (@stevehoo)

    Genius and witchcraft : -)
    Thank you, very much.
    Works perfectly.

    Thread Starter stevehoo

    (@stevehoo)

    As I said in my original post, Term ID fails. All are skipped.

    My steps are exactly as in the linked how to. It works fine if I search on names (so long as they’re unchanged from the export). But, not Term ID, nor slug.

    This is a simple import / export, nothing changed, just a simple test.

    My steps:
    Step 2
    New Import: Taxonomies | Categories | Tags > Product tags
    Update existing items & skip new items.
    Step 3
    Nothing here, all defaults.
    Step 4
    Field mapping: Name > {Itemname[1]}, Description > {description[1]}
    Step 4
    Search existing item > Term ID
    Update existing items fields > Update all data

    Confirm and update > all my items are skipped : -(
    Log
    [02:27:14] Record #1
    [02:27:14] SKIPPED : Skip New Items
    [02:27:14] Record #2
    [02:27:14] SKIPPED : Skip New Items
    [02:27:14] Record #3
    [02:27:14] SKIPPED : Skip New Items…

    I’ve tried Field mapping {termid[1]}, but this, too, fails when I search existing item > Term ID. As said, the only way to update is by searching based on > Name
    Log
    [02:38:52] Record #1
    [02:38:52] Existing item found #48
    [02:38:53] taxonomy #48 Successfully Imported
    [02:38:53] Record #2
    [02:38:53] Existing item found #49
    [02:38:53] taxonomy #49 Successfully Imported
    [02:38:53] Record #3
    As above, this update import was by name : -(

    Thread Starter stevehoo

    (@stevehoo)

    Thread Starter stevehoo

    (@stevehoo)

    Ah, my bad it’s a plugin. Put it in a folder, upload it to my plugins folder and activate it.

    But, it’s not doing what I want. Indeed, I can now edit images sizes in the Customiser > Woocomerce > Product Images. But, my first clue this wasn’t going to do what I want was that the size I could change was 300, not 324. This size of 300 I believe is from WordPress > Settings > Media, which is 300.

    And changing 300 to 500 did nothing.

    I want to change the 324 pixels in this picture:
    https://imgur.com/a/mHEDsPw

    • This reply was modified 3 years, 5 months ago by stevehoo.
    • This reply was modified 3 years, 5 months ago by stevehoo.
    Thread Starter stevehoo

    (@stevehoo)

    lol. Thank you, Con. But, what do I do with it?

    For others…
    I’ve tried everything, I think. This plugin seemed the best:
    https://wordpress.org/plugins/simple-image-sizes/
    However, Woocommerce writes over everything and it didn’t work for me nor another.
    https://wordpress.org/support/topic/doesnt-work-with-woocommerce-6/

    Ah-Ha!

    Thank you for confirming I am not mad.

    Thread Starter stevehoo

    (@stevehoo)

    I’m up to date in WordPress, Woocommerce and Storefront. I find that Woocommeerce > Settings > Display has GONE! I Google and find that it’s moved to Customiser > Woocomerce > Product Images. But, it’s not! Apparently, Storefront has set this for me. Because it knows best?

    I really want to be able to set product image sizes to vary per category or attributes – at my discretion. Even on the same page. I thought I could use these Gutenberg blocks, one to show portrait pictures at a smaller width, while these panoramas – long landscapes would be very wide. Thus, they would end up the same screen area. You can see my issue on my portfolio here: https://www.witchphotographer.com

    There must be some way of specifying which out of the image srcset I want to use, for portraits or for landscapes? I don’t mind calling with CSS, but would have prefered to have that power in a Gutenberg block ;-/

    • This reply was modified 3 years, 5 months ago by stevehoo.
    Thread Starter stevehoo

    (@stevehoo)

    For completeness, I also use variations widthxheight for Google Merchant Feed to show the size of the picture. Obviously, this is better than telling a prospective customer about the size of the postal tube. Here is the filter, footsteps in the snow.

    `function lw_woocommerce_gpf_description( $description, $product_id, $variation_id = null ) {
    global $post;
    if ( ! is_null( $variation_id ) ) {
    $ID = $variation_id;
    } else {
    $ID = $product_id;
    }
    $save_post = $post;
    $post = get_post( $ID );
    if ( ! empty( $post->post_parent ) ) {
    $post = get_post( $post->post_parent );
    }
    setup_postdata( $post );
    $yoastdesc = get_post_meta($post->ID, ‘_yoast_wpseo_metadesc’, true);
    $width = get_post_meta( $variation_id, ‘_width’, true);
    $height = get_post_meta( $variation_id, ‘_height’, true);
    $result = $width . ‘ x ‘ . $height . ‘cm Hyper-detailed giclée on glossy fine art paper. ‘ . $yoastdesc;
    $post = $save_post;
    return $result;
    }
    add_filter( ‘woocommerce_gpf_description’, ‘lw_woocommerce_gpf_description’, 10, 3 );

    Thread Starter stevehoo

    (@stevehoo)

    Thank you, that is a clear explanation. Indeed, I use Storefront, too.

    I like the point of making the attribute the size. This would travel nicely through the cart and orders.

    But, each picture varies in size (though tubes are a constant). My continuing problem, therefore, is that each picture, each variation in size is unique. Though I’ve simplified to large, medium, small, tiny. I would end with 160 pictures x 4 size variations = 640 individual attributes. Where now I have a mere four (large down to tiny).

    So, I think unique variation attributes would be unwieldy.

    Further, I export to csv where from the width x height of the variation, I can calculate a price per cm/sq. All very elegant.

    I need to store the four sizes (med_width x med_height) of the pictures in a custom field in that variation. Then, I can continue to export variations to csv to do my price calculations.

    I will also need to (re) write a shortcode/plugin to write the table of sizes to the description (or short product description).

    TL/DR
    I need two sizes fields within each product variation. One for the packaged, postal size, one for the actual flat, product size. Is there an available plugin which would add field to each variation?

    Thread Starter stevehoo

    (@stevehoo)

    Bridgnorth Hustain the Lusty Viking £6.21 – £43.78
    Picture sizes
    Large 68.4 x 32 cm £43.78 1 Add to Cart
    Medium 49.2 x 23 cm £22.63 1 Add to Cart
    Small 32 x 10.8 cm £9.87 1 Add to Cart
    Tiny 23 x 10.8 cm £6.21 1 Add to Cart

    Currently, I have the above as a plugin, which displays the sizes of the pictures – all looks good. (I use the dimensions to calculate area/cost)

    But, effectively, you’re saying I should take the poster dimensions from a custom field e.g. large_length, large_width. And hide the variations’ sizes, which should be the dimensions of the rolled picture or an envelope, which is then used to calculate the postage.

    I’d have to rewrite the plugin. Seems a lot of work for, what I see as what must be a common, simple problem.

    Thank you for your answer, but surely this is such a common problem, there must be nearly everybody who has a variation with sizes packed and unpacked.

    Perhaps there is a plugin which adds to each variation, the packed (or unpacked) sizes. That is, another dimensions/weight row.

    I was hoping that shipping classes would be useful. That I could specify the size and weight there, and use that to link to the variations since there is only one size of tube, one size of envelope – in my case.

    Or, within the (Royal Mail) calculator the ‘box sizes’ would be useful. But seems they are not.

    Again, I feel like there is something, so ubiquitous here, that I’m missing the bleedin’ obvious 😉

    Be happy for ever,
    Steve

    • This reply was modified 4 years, 5 months ago by stevehoo.
    • This reply was modified 4 years, 5 months ago by stevehoo.
Viewing 15 replies - 1 through 15 (of 45 total)