Forum Replies Created

Viewing 15 replies - 31 through 45 (of 151 total)
  • Thread Starter marseem

    (@waseemsannib)

    Than you Archana,

    Yes I fixed this by installing read more wp plugin which I don’t want. I thought by adding a tag of read more in classic editor will fix this issue automatically without installing any plugin but it seems that not working. Is there any method to fix this without installing a plugin?

    Thread Starter marseem

    (@waseemsannib)

    Unfortunately, I couldn’t resolve this issue. I hope somebody could help me with this.

    Thread Starter marseem

    (@waseemsannib)

    Thank you, I’m trying to do this, so far no luck. Thanks for your help

    Thread Starter marseem

    (@waseemsannib)

    I tried as you suggested, however the snippet doesn’t work.

    echo '<a . __('Link to Relevant Doll', 'txtdomain').'</a>';

    add_action('woocommerce_product_options_inventory_product_data', function() {

    woocommerce_wp_text_input([

    'id' => '_Relevant_Doll',

    'label' => __('Relevant Doll', 'txtdomain'),

    'wrapper_class' => 'show_if_simple'

    ]);

    });

    add_action('woocommerce_process_product_meta', function($post_id) {

    $product = wc_get_product($post_id);

    $num_package = isset($_POST['_Relevant_Doll']) ? $_POST['_Relevant_Doll'] : '';

    $product->update_meta_data('_Relevant_Doll', sanitize_text_field($num_package));

    $product->save();

    });

    add_action('woocommerce_product_meta_start', function() {

    global $post;

    $product = wc_get_product($post->ID);

    $num_package = $product->get_meta('_Relevant_Doll');

    if (!empty($num_package)) {

    printf('<div class="custom-sku">%s: %s</div>', __('Relevant Doll', 'txtdomain'), $num_package);?

    }

    echo '<a . __('Link to Relevant Doll', 'txtdomain').'</a>';

    });
    Thread Starter marseem

    (@waseemsannib)

    I replaced the code to be as the following:

    add_action('woocommerce_product_options_inventory_product_data', function() {

    woocommerce_wp_text_input([

    'id' => '_Relevant_Doll',

    'label' => __('Relevant Doll', 'txtdomain'),

    'wrapper_class' => 'show_if_simple'

    ]);

    });

    add_action('woocommerce_process_product_meta', function($post_id) {

    $product = wc_get_product($post_id);

    $num_package = isset($_POST['_Relevant_Doll']) ? $_POST['_Relevant_Doll'] : '';

    $product->update_meta_data('_Relevant_Doll', sanitize_text_field($num_package));

    $product->save();

    });

    add_action('woocommerce_product_meta_start', function() {

    global $post;

    $product = wc_get_product($post->ID);

    $num_package = $product->get_meta('_Relevant_Doll');

    if (!empty($num_package)) {

    printf('<div class="custom-sku">%s: %s</div>', __('Relevant Doll', 'txtdomain'), $num_package);?

    }

    'label' => '<a . __('Relevant Doll', 'txtdomain').'</a>',

    });

    It seems the link works only backend not in frontend.

    https://ibb.co/10Fb7QM
    https://ibb.co/BGtJrtR

    What do you suggest?

    • This reply was modified 8 months ago by marseem.
    Thread Starter marseem

    (@waseemsannib)

    Please see the screenshot:

    https://ibb.co/jvv1jM1

    Thread Starter marseem

    (@waseemsannib)

    My main goal is to show the related product title in inventory area (meta box) above SKU to be clickable and redirect to the related product page. What is the best solution for this do you think?

    Thank you again

    Thread Starter marseem

    (@waseemsannib)

    Hello bcworkz,

    I have found a code that could show the text in the meta box. I have changed the phrase to relevant doll and I added the title of the related doll, however how can I make this title clickable to redirect to the related doll page? I don’t know if I’m trying to resolve this issue with the wrong method.

    The problem with this code is it shows the text but not like tag label that could be clickable to reach the related products. It is just text above the SKU. How to force this product title text to be clickable as a tag?

    Thank you

    add_action('woocommerce_product_options_inventory_product_data', function() {

    woocommerce_wp_text_input([

    'id' => '_Relevant_Doll',

    'label' => __('Relevant Doll', 'txtdomain'),

    'wrapper_class' => 'show_if_simple'

    ]);

    });

    add_action('woocommerce_process_product_meta', function($post_id) {

    $product = wc_get_product($post_id);

    $num_package = isset($_POST['_Relevant_Doll']) ? $_POST['_Relevant_Doll'] : '';

    $product->update_meta_data('_Relevant_Doll', sanitize_text_field($num_package));

    $product->save();

    });

    add_action('woocommerce_product_meta_start', function() {

    global $post;

    $product = wc_get_product($post->ID);

    $num_package = $product->get_meta('_Relevant_Doll');

    if (!empty($num_package)) {

    printf('<div class="custom-sku">%s: %s</div>', __('Relevant Doll', 'txtdomain'), $num_package);

    }

    });
    Thread Starter marseem

    (@waseemsannib)

    Thank you bcworkz,

    I understood that there are no CSS code. It is still not clear to me. I wonder whether you understood my issue. Could you recommend to me exactly what I should do to insert a new field line under the tag that includes the target product title to be clickable to redirect the user to the relevant product?
    For instance, Lucas and Clara, each of them mentions the other. So the user needs to click on Clara’s title on Lucas’ page to go to Clara’s page and vice versa. So how do you suggest creating this feature? because the tag should be one word linked to both which is not what I need exactly.
    I have a child theme. I can add a function filter in the theme file if you can provide me with one.

    I don’t know if you got my point.
    Waiting for your recommendation

    Thread Starter marseem

    (@waseemsannib)

    Thank you bcworkz for the suggestion. I just need to know where I add this code? In theme function or this CSS code?

    Thread Starter marseem

    (@waseemsannib)

    I need php code could fix this issue

    Thread Starter marseem

    (@waseemsannib)

    Thank you for your support.

    I have removed the image and uploaded a new one and now it seems work very good.

    Thank you again for your support

    Thread Starter marseem

    (@waseemsannib)

    I forgot to say that I have already cleared caches even with no luck.

    Thread Starter marseem

    (@waseemsannib)

    Thanks for the support. Now it worked.

    Thread Starter marseem

    (@waseemsannib)

    The following code didn’t display the image:

    .header .my-account-link .fa:before.header .my-account-link .fa:before {background-image: url(https://www.marseem.com/wp-content/uploads/2024/06/silhouette_37947.png); content: “”;}}

Viewing 15 replies - 31 through 45 (of 151 total)