Tagged: 

Viewing 26 posts - 1 through 26 (of 26 total)
  • Author
    Posts
  • #704933

    Hi Enfold Support,

    I want to make the shop categories more SEO friendly by adding a further text field below the subcategories on a category page. This will allow for us to write good SEO and user-friendly content without being too long above the categories.

    Basically, it means we can have a small text content field at the top of the page and at the bottom of the page we can have longer relevant content.

    Please, will you show me how to do this?

    Thanks
    Vincent

    #706219

    Hey Vincent,

    Sorry for the late reply!

    Could you please elaborate on the changes you would like to make? If you could post screenshots that would definitely help us understand better. You can upload your screenshots on imgur.com or Dropbox public folder and post the links here.

    Best regards,
    Yigit

    #706645

    Hi Yigit,
    Thank you for the reply and much appreciated.
    I have enclosed a screenshot of where I would like the text box http://imgur.com/a/HyYBZ
    Basically, this will allow the product categories to be search engine friendly by adding more relevant text below the product subcategory thumbnails.
    The problem Enfold has at the moment is the only place to p[ut the content is above the subcategories. The problem with this is you can only have a little text. Too much and it pushes the content down and looks unattractive.

    It would be better to have the text in both places above and below – one for the H1 content and one below for the H2 content.

    Thanks
    Vincent

    #706720

    Hi,

    Please try adding following code to Functions.php file in Appearance > Editor

    add_action ('woocommerce_after_shop_loop', 'avia_product_text');
    function avia_product_text() {
    	if(is_shop() || is_tax('product_cat')) {
    	   echo '<h2 class="product-extra-title">My title here</h2><h3 class="product-extra-desc">More content here</h3>';
    	}
    }

    You can adjust the HTML and add your content as needed. It will be displayed only on shop overview page

    Best regards,
    Yigit

    #706848

    Hi Yigit,
    Thanks for your reply. Unfortunately, this is only displaying on the main shop category page and not the product categories or subcategories which is where I want it. Also, all it did was add a title below the product on the shop[ page and not a text field.

    Also, it should be H2 not H1.

    Can you please assist and tell me how I can get the extra field in the product categories, please? What I would like is the following:

    A. H2 title below the products on the product categories only.
    B. Below the H2 title there should be an extra field for content.

    The above would make it very SEO friendly.

    Thanks again for your help

    Vincent

    #708515

    Hey!

    We modified the code a bit. Please try it again.

    Regards,
    Ismael

    #708698

    Hi Ismael, Yigit,
    Thank you for the update. Almost there. This is what has happened:

    1. It now appears on all categories – good
    2. It now appears next to a subcategory rather than below which is not good – see screenshot. http://imgur.com/2XI5yT6
    3. There is no place to edit the title or content – it is missing from the edit control panel fields.

    Request the following:
    A. That the second field title and content appear below the category/subcategory contents.
    B. that there is a field to edit the contents and add the necessary text.

    Thank you
    Vincent

    #709264

    Hi,

    1- Great!
    2- Please add following code to Quick CSS

    .product-extra-title {
        clear: both;
    }

    3- How would you like to edit the text? Will it depend on the product category? If so, please use the code as following

    add_action ('woocommerce_after_shop_loop', 'avia_product_text');
    function avia_product_text() {
    	if(is_shop() || is_tax('product_cat') && is_product_category( 'cool' )) {
    	   echo '<h2 class="product-extra-title">My title here</h2><h3 class="product-extra-desc">More content here</h3>';
    	}
    }

    Best regards,
    Yigit

    #709513

    Hi Yigit,

    I added your Point-3 to functions.php and it crashed the entire site (white screen). I undid it via FTP. There is something in there it doesn’t like.

    Was Is supposed to replace this code?

    /* --------------------------------------------------------------
    ## >= Additional Text Field Below Category Overview 
    ----------------------------------------------------------------- */
    add_action ('woocommerce_after_shop_loop', 'avia_product_text');
    function avia_product_text() {
    	if(is_shop() || is_tax('product_cat')) {
    	   echo '<h2 class="product-extra-title">My title here</h2><h3 class="product-extra-desc">More content here</h3>';
    	}
    }
    
    #709538

    Hi!

    Yes. Sorry, i realized i did not make it clear. You should remove the old code and add the new one instead.

    Best regards,
    Yigit

    #709743

    Hi Yigit,

    Here is the update:

    1. Applied your CSS to custom area.
    2. Applied the updated php to functions.php and all it did was remove the new category fields again which Ismael’s code above had managed to bring back.
    3. The main category page (shop) has an extra field now but not editable and the other subcategory fields are all missing.
    4. Basically, everything got lost except for the main shop page that has an uneditable extra field.

    What is needed?
    1. An extra field below the subcategories that is directly below and not justified.
    2. The field should have an H2 as the title
    3. The field should be able to have content – text that will make it more SEO friendly.
    4. It doesn’t matter about the main /shop page the more important ones are all the subcategories.
    4. The field should be editable to add that content.

    BTW: I did come across a paid plugin here: https://codecanyon.net/item/seo-category-and-tag-descriptions-for-woocommerce/13731099 but I don’t know if it will work or not with Enfold and didn’t want to take the risk and its breaks everything. This is why I opted to ask you if there was a solution.

    Thank you
    Vincent

    #710170

    Hi!

    Please replace the method in the functions.php file with the following code:

    /* --------------------------------------------------------------
    ## >= Additional Text Field Below Category Overview
    ----------------------------------------------------------------- */
    add_action ('woocommerce_after_shop_loop', 'avia_product_text');
    function avia_product_text() {
    	global $post;
    	$args  = array( 'taxonomy' => 'product_cat',);
    	$terms = wp_get_post_terms($post->ID,'product_cat', $args);
    	$obj   = get_queried_object();
    	$desc  = '';
    	$title = '';
    
    	$count = count($terms);
    	if ($count > 0) {
    
    	   foreach ($terms as $term) {
    			if($term->name == $obj->name) {
    				$desc  = $term->description;
    				$title = $term->name;
    			}
    	   }
    
    	}
    
    	if(is_shop() || is_tax('product_cat')) {
    	   echo '<div class="product_extra_container">';
    	   echo '<h2 class="product-extra-title">'.$title.'</h2><h3 class="product-extra-desc">'.$desc.'</h3>';
    	   echo '</div>';
    	}
    }

    This will output the product category title and description below the product items automatically.

    Regards,
    Ismael

    #710202

    Hi Ismael,

    That had the effect of pulling the content from the top main field, making it bold and putting it flush with the subcategories. There was nowhere to edit it either. See screenshot of what happened: http://imgur.com/a/ybwgB

    Thanks
    Vincent

    #710261

    Hi Vincent,

    Please try using this plugin – https://www.advancedcustomfields.com/ and create custom fields and choose to display those fields on your product categories if you would like to manually edit the text you would like to output.

    Best regards,
    Yigit

    #710297

    Hi Yigit,

    Thanks for your reply – so, do I delete the code above and then install that plugin? The code is above is not working anyway and content in the wrong position. Or do ,leave the code above in?

    Thanks
    Vincent

    #710311

    Hi!

    You can remove the code posted above and install the plugin, create custom fields and choose to display them on your product category pages. Then code would need to be adjusted to output your custom fields on category pages.

    Cheers!
    Yigit

    #710338

    Hi,

    I created a WYSIWYG field just to test it with that plugin and used the following format:

    1. Taxonomy Term | is equal to | Product Categories
    2. Position (Normal after content)
    3. Unchecked everything under Hide on Screen
    4. I then found a very small and narrow editing box in the product category backend. There was no place for title so I added some useless content.
    5. I then clicked publish
    6. Nothing displaying on the product category page.

    The problem is that the field is there but not showing on category page.

    Us the above correct?

    Vincent

    • This reply was modified 8 years, 1 month ago by Vincent.
    #710361

    Hey!

    This code should be edited – https://kriesi.at/support/topic/create-extra-text-field/#post-706720 and you should choose to echo your custom fields by referring to this post – https://www.advancedcustomfields.com/resources/get_field/

    Cheers!
    Yigit

    #710386

    Hi Yigit,
    How do you mean this code should be edited? Edited to what exactly?

    add_action ('woocommerce_after_shop_loop', 'avia_product_text');
    function avia_product_text() {
    	if(is_shop() || is_tax('product_cat')) {
    	   echo '<h2 class="product-extra-title">My title here</h2><h3 class="product-extra-desc">More content here</h3>';
    	}
    }

    I’m afraid I’m not following you. Previously, when I used that code it never worked and I tried it again and it still does not work.

    Thanks
    Vincent

    #710589

    Hey!

    My bad. I forgot to include the css code that’s why the container is flush to the right of the product items. Please remove every modifications that we provided here. Let’s start again by adding this code in the functions.php file:

    /* --------------------------------------------------------------
    ## >= Additional Text Field Below Category Overview
    ----------------------------------------------------------------- */
    add_action ('woocommerce_after_shop_loop', 'avia_product_text');
    function avia_product_text() {
    	global $post;
    	$args  = array( 'taxonomy' => 'product_cat',);
    	$terms = wp_get_post_terms($post->ID,'product_cat', $args);
    	$obj   = get_queried_object();
    	$desc  = '';
    	$title = '';
    
    	$count = count($terms);
    	if ($count > 0) {
    
    	   foreach ($terms as $term) {
    			if($term->name == $obj->name) {
    				$desc  = $term->description;
    				$title = $term->name;
    			}
    	   }
    
    	}
    
    	if(is_shop() || is_tax('product_cat')) {
    	   echo '<div class="product_extra_container">';
    	   echo '<h2 class="product-extra-title">'.$title.'</h2><h3 class="product-extra-desc">'.$desc.'</h3>';
    	   echo '</div>';
    	}
    }

    And then go to the Quick CSS field, add this code:

    .product_extra_container {
       display: block;
       clear: both;
    }

    You can modify the title and description by editing the product categories in the Products > Categories panel.

    Best regards,
    Ismael

    #710632

    Hi Ismael,

    Thank you for that, it is now sitting flush below the products, which is what I wanted. However, the following issues have popped up!

    1. The font is all bold letters
    2. There is nowhere to edit the content as the extra field does not show in the category editing panel.
    3. This is only working on sub product categories and not product categories. It should be working on both. For example:
    a. …..com/shop/shoes/ – it does not work.
    b. …..com/shop/shoes/mens-slippers/ – it does work.

    Thanks
    Vincent

    #711519

    Hey!

    It is working properly on our installation. Did you add the css code? Please post the login details here so that we can check it.

    2. There is nowhere to edit the content as the extra field does not show in the category editing panel.

    Edit the category then look for the Description field.

    Best regards,
    Ismael

    #716509

    Hi Ismael,
    It is not working and I have entered it exactly as you have said. All it does is duplicate the content in the top default field and leaves nowhere to edit the new field.
    Furthermore, it is not showing in the main shop categories, only shop subcategories.

    ALSO: This has caused an issue with the site. On the categories in the H! title cannot be seen at all and on the front end it is there but cannot be highlighted as it appears to be ‘stuck’ for want of a better word. Unfortunately, I have had this code in too long for me to perform a rollback. Can you please look at this?

    I have included the logins below, thanks for your help.

    #717901

    Hi Vincent,

    Even though i am logged in, i am seeing coming soon page. Can you please disable it temporarily?
    Also, please consider to hire a freelance developer if you urgently need to have this fixed.

    Best regards,
    Yigit

    #717966

    Hi Yigit,

    Thanks for all of your help, however, I think I am going to give this plugin a try https://codecanyon.net/item/seo-category-and-tag-descriptions-for-woocommerce/13731099

    Using the code above back and forth has caused the site to crash several times and make it buggy.

    Thanks again
    Vincent

    #717979

    Hi!

    Please contact plugin author and ask if they have any experience with Enfold to be on the safe side. If there is anything we can do, please feel free to let us know!

    Best regards,
    Yigit

Viewing 26 posts - 1 through 26 (of 26 total)
  • You must be logged in to reply to this topic.