admin管理员组

文章数量:1323524

I got an auction theme (adifier) and i'm trying to add a button to a specific ads category.

Tried a few codes but none seem to work, probably i don't know how to alter it properly. I got the category 3D Design where users should download the files that are uploaded from account page (where I should add another button with upload (I got I plugin with the upload button but don't know how to add it on the account page) ). Thanks in advance for any kind of help!

add_action( 'adifier_single_product_description', 'extra_button_on_product_page', 9 );
function extra_button_on_product_page() {
    global $post, $product;
    if ( has_term( 'accessories1-3d-design', 'product_cat' ) ) {
        echo '<a class="button" href="www.test">Extra Button</a>';`

    add_action( 'adifier_3d-design_description', 'extra_button_on_product_category_description', 9 );
function extra_button_on_product_category_description() {
    if ( is_product_category('accessories1') ) {
        echo '<a class="button" href="www.test">Extra Button</a>';
    }
}

I got an auction theme (adifier) and i'm trying to add a button to a specific ads category.

Tried a few codes but none seem to work, probably i don't know how to alter it properly. I got the category 3D Design where users should download the files that are uploaded from account page (where I should add another button with upload (I got I plugin with the upload button but don't know how to add it on the account page) ). Thanks in advance for any kind of help!

add_action( 'adifier_single_product_description', 'extra_button_on_product_page', 9 );
function extra_button_on_product_page() {
    global $post, $product;
    if ( has_term( 'accessories1-3d-design', 'product_cat' ) ) {
        echo '<a class="button" href="www.test">Extra Button</a>';`

    add_action( 'adifier_3d-design_description', 'extra_button_on_product_category_description', 9 );
function extra_button_on_product_category_description() {
    if ( is_product_category('accessories1') ) {
        echo '<a class="button" href="www.test">Extra Button</a>';
    }
}
Share Improve this question edited Sep 7, 2020 at 14:42 fuxia 107k38 gold badges255 silver badges459 bronze badges asked Sep 7, 2020 at 11:04 Claudiu DumboClaudiu Dumbo 1
Add a comment  | 

2 Answers 2

Reset to default 0

You have added asterisk after the code. Here is the perfect code.

add_action( 'adifier_single_product_description', 'extra_button_on_product_page', 9 );
function extra_button_on_product_page() {
    global $post, $product;
    if ( has_term( 'accessories1-3d-design', 'product_cat' ) ) {
        echo '<a class="button" href="www.test">Extra Button</a>';

    add_action( 'adifier_3d-design_description', 'extra_button_on_product_category_description', 9 );
    function extra_button_on_product_category_description() {
        if ( is_product_category('accessories1') ) {
            echo '<a class="button" href="www.test">Extra Button</a>';
    }
}

Maybe this is the reason you are facing problem.

Those are 2 different codes that are supposed to do the same thing. I have tried like this too but no succes. In exchange i have installed woocommerce on a different host and with the next code i manage to make it work.

add_action('woocommerce_after_add_to_cart_button','cmk_additional_button');

function cmk_additional_button() { echo 'Download'; }

But i still don t know how to make it work on my adifier plugin. Sure is because of the location. My theme has instead of categoryy/products ...ads/categories. Next ...how can i access the account page? Thanks everyone!

本文标签: theme developmentAdding a button to wpaution plugin