Tagged: seo
-
AuthorPosts
-
October 27, 2016 at 5:05 pm #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
VincentOctober 31, 2016 at 3:21 pm #706219Hey 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,
YigitNovember 1, 2016 at 11:07 am #706645Hi 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
VincentNovember 1, 2016 at 2:43 pm #706720Hi,
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,
YigitNovember 1, 2016 at 8:49 pm #706848Hi 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
November 5, 2016 at 3:37 am #708515November 5, 2016 at 3:05 pm #708698Hi 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
VincentNovember 7, 2016 at 3:23 pm #709264Hi,
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,
YigitNovember 7, 2016 at 10:47 pm #709513Hi 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>'; } }
November 7, 2016 at 11:01 pm #709538Hi!
Yes. Sorry, i realized i did not make it clear. You should remove the old code and add the new one instead.
Best regards,
YigitNovember 8, 2016 at 12:36 pm #709743Hi 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
VincentNovember 9, 2016 at 11:36 am #710170Hi!
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,
IsmaelNovember 9, 2016 at 1:18 pm #710202Hi 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
VincentNovember 9, 2016 at 3:43 pm #710261Hi 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,
YigitNovember 9, 2016 at 4:28 pm #710297Hi 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
VincentNovember 9, 2016 at 4:39 pm #710311Hi!
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!
YigitNovember 9, 2016 at 5:20 pm #710338Hi,
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.
November 9, 2016 at 5:45 pm #710361Hey!
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!
YigitNovember 9, 2016 at 6:14 pm #710386Hi 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
VincentNovember 10, 2016 at 9:20 am #710589Hey!
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,
IsmaelNovember 10, 2016 at 11:03 am #710632Hi 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
VincentNovember 13, 2016 at 2:21 am #711519Hey!
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,
IsmaelNovember 24, 2016 at 5:07 pm #716509Hi 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.
November 28, 2016 at 5:29 pm #717901Hi 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,
YigitNovember 28, 2016 at 8:51 pm #717966Hi 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
VincentNovember 28, 2016 at 9:17 pm #717979 -
AuthorPosts
- You must be logged in to reply to this topic.