jason9j
Forum Replies Created
-
For the ‘wrap’ HTML function, I believe that CSS alone is insufficient, because I need a structural solution.
Themes define content width, usually you can choose boxed, full width boxed, or full width.
This creates issues with customizing an existing template if the desired design has 100% width sections, but centered content (ie. full width boxed). If you leave the global theme setting at full width boxed, any content you hook in there will be within that boxed container.
In order to customize sections that have a different full width background color, or a wide/100% image or bg image, yet still have properly boxed content in containers, there is no choice but to set the theme settings for that page to 100% width with no boxing. I can now add sections with a design that are allowed to go 100%.
Problem is, now the box/container has been taken away for everything else that the theme is presenting which I do not wish to touch. Even If I do wish to touch it, say, to alter the bg color for that particular existing section, I have no way to do so.
So that is why I’m searching for a function to wrap HTML as follows (using BootStrap as an example):
<div class="container-fluid my-class"> <div class="container">
Existing theme section content goes here.
</div> </div>
Now I have a fully hookable full width design with centered content (full width boxed), without everything I hook in being put in a box preventing 100% background design. The overall result to the visitor, however, will still be full width boxed. Sections on the page can now all have different 100% width background designs if needed.
If I can figure out a function for this, then themes can be customized without touching them. At the moment, I have to copy the page in question to a child theme, and add the HTML manually.
Hi – sorry for the late reply.
Yep, you’re right. I’ll try to use hooks as much as possible. It seems I was somewhat on the wrong track before.
A couple of questions I can’t find a definitive answer too – perhaps you might know – I might as well ask ?? –
1. Do you see any issues (security, rendering, etc) with using the ‘include’ php function to call a custom section (my own php/html layout named .php), inserted by hook into a theme template?
2. Is there a function/filter that can ‘wrap’ a hook area or section in HTML tags? For example, put
<div class="my-class">
at the beginning, and</div>
at the end? If I can track down such a function, I probably would never need to touch core the files.I haven’t been able to find a solid answer for those two things.
Thanks again.
- This reply was modified 3 years, 8 months ago by jason9j.
Excellent. You’ve been a huge help Stef. I’ll do some exploring and close the ticket after I’ve had a look around at the docs.
EDIT: I missed the code at the end of your post, sorry. Let me play around with that for a while…maybe that is the key. Thanks Stef.
Hi Stef – noted. I think in a lot of cases, you’re right. If I need to append something to a general place (eg. Related Products appended to the bottom of the page), then you’re right. And I’m actually glad you reminded me and made me think about whether hardcoding every element is even necessary. You’ve definitely helped me out here.
But if I need to create Bootstrap HTML structures so as to arrange parts for certain pages (single product, single post, etc), then I don’t see how hooks can help….but that could just be my inexperience.
To take a standard WordPress example:
Say I need a custom single blog post template. The top section of the page will have a feature image, a title, excerpt, meta, etc. To arrange that into the desired design and layout, that requires removing those elements from the template file copied to my child theme, and re-adding them within my desired structure. So editing the template file is the only way, I assume. Though I’d like to be wrong about this.So my biggest issue is actually how to call on those elements from the file, because although I know some coding, I am not familiar with PHP. I’ve just been trying to figure out the basic call syntax.
Using that basic WP example again, I need syntax/snippets to:
– Call on the post featured image
– Call on the post title
– Call on the post excerptI can’t seem to find a simple answer (ie. code snippets) to put these in my theme file (ie. paste it into my own Bootstrap column according to my design) etc.
Hi Stef – thanks for your reply. It led me to the get_template_part() documentation, which I’m reading about now.
There seem to be different levels of implementation, and similar related functions, and various opinions on it (upvotes/downvotes): https://developer.www.ads-software.com/reference/functions/get_template_part/
I need a base point for my understanding. To use a real-life, specific example, do you know what the syntax would look like to show product reviews inside my own div in the file content-single-product.php?
Thanks for your reply, bcworkz.
Your information is definitely handy for the things I’m doing now, when I can figure out how best to use it. At the moment, I just get a null message citing the code line.
I’m still trying to get to the bottom of it will post this to the WooCommerce forum – it slipped my mind to do this. Sorry about that.
While I’m here on the WordPress site, my same question applies to non-WooCommerce templates: If I want to create a single blog post template (ie.e my own HTML layout structures at the top for feature image, title, meta, etc), do you know which file is best to modify?
Thanks.
Forum: Plugins
In reply to: [WooCommerce-Ozpost] Support for Aramex Australia (Fastway) MyFastway APIThanks for that. Yeah I saw that about the same time you messaged here. Finally, someone sees an opportunity and takes it. I appreciate you taking the time to give me the heads up. Cheers.
Forum: Plugins
In reply to: [WooCommerce] WooCommerce feeding Google misleading priceHi Victoria – thanks for your reply.
Here is the screenshot of the snippet: https://snipboard.io/PMkwhC.jpg (it’s only small).
I’m currently using RankMath for any little SEO things like this, but I assume they are just using whatever pricing functions are provided by WC..? Also, I am referring to appearance in organic search results, not Google product feeds for Google Shopping, etc. So I am guessing that for variable products, WC makes the assumption that the lowest price should be displayed…?
To be honest, buying a premium extension every year for every little function has bloated my site and I have been in the process of simplifying it and getting the cost down to a more reasonable level.
I will be reserving the purchase of pro extensions for other, complex functions such as shipping, payment, security, backups, site building, etc – there are many of these non-native necessities already.
I’m hopeful that someone can recommend a basic functions.php snippet to me in order to simply feed the highest price to search engines.
Let me know if your team at WordPress or WooCommerce knows such a snippet. Thanks again.
Forum: Plugins
In reply to: [WooCommerce-Ozpost] Support for Aramex Australia (Fastway) MyFastway APIHey – no, nothing from any developer anywhere. Aramex Australia themselves appear to have no intention of providing this integration either. Blows my mind, given it is the most basic ecommerce requirement for using a shipping service – tell customers what the shipping cost is.
No one is interested anywhere…probably try to figure something else out.
Forum: Plugins
In reply to: [WooCommerce-Ozpost] Support for Aramex Australia (Fastway) MyFastway APIThanks Tassos.
Sorry to hear about Rod. Everything else sounds good.
Do let me know RE MyFastway/Aramex API as soon as you can, as this is what we need. With a highly functional shipping plugin for Australia and especially the newer Fastway API, you’ll pretty much have a monopoly.
Do you have an ETA for the Aramex situation? Thanks.
Update 2:
It seems I had to go to the extreme lengths of installing an SEO plugin, and use that to strip out the product and product-category bases. URLs look much better now, but I hate having to rely on a heavy plugin to do it.
My utter confusion remains as to the logic behind WP’s decisions here, but I need to move on…
We’ll see how this solution goes, as to whether I run into any significant downside…
- This reply was modified 4 years, 5 months ago by jason9j.
Update:
Regardless of the WP options provided, or what base I type in place of another, the problem still remains the source of my confusion:
If I go to a product, I’m at this URL:
site.com/shop/category/sub-category/product-name
OK, you say as the visitor. I see the URL. Click in the browser, delete ‘product-name’, because I’d like to see everything in that category.
That leads to a 404 error for site.com/shop/category/sub-category. Literally doesn’t exist.
The one WP recognises is site.com/product-category/sub-category/.
This is the confusion at the center of my original question.
Why would WP do this?? Why would they take something logical and turn it into a 404 error by default? Why would they purposely require the visitor to be sight-familiar with a completely different URL path for no reason?
To say ‘provide breadcrumbs’ is not an answer, as that would mean that there’s little point to a logical URL structure. Also not an answer is custom coding or a plugin, which – for something a critical as permalinks – relies on a 3rd party to flawlessly keep up with WP updates with no room for error. It is an unnecessary complication.
Do I need to manually set up 301 redirects for every single category to cover this scenario?
Anyone passing through this thread is welcome to let me know – much appreciated.
Thanks Stef. Yeah, I want to keep them the same though, as that makes the most sense. I’m investigating it now. It’s silly that I’d have to use ‘shop’ for shop base, and ‘store’ or something for product category base. I don’t understand WC logic in not allowing this.
Apparently setting the shop base and the product category base to the same thing will cause a 404 error. Looks like it’s going to be one of those things…