Closed. This question needs details or clarity. It is not currently accepting answers. Want to improve this question? Add details and clarify the problem by editing this post. Closed 2 years ago. Improve this question This is what I get from my page and i can’t make some changes. Answer Use wp_strip_all…
Tag: wordpress
WordPress: passing $query to separate template file
I have the following code: homepage.php loop-feed-work.php But when I view my homepage, I get the following error: Fatal error: Uncaught Error: Call to a member function have_posts() on null in ******/loop-feed-work.php:1 Could this be because the query is in a different template file? Answer That’s exa…
Append post title before publishing the wordpress post
I want to append my wordpress titles to have some static text in them before publishing. As my posts are directly posting to social media when they are published, I want this to happen before …
WP Widget Categories How to add a description of the number of articles to the widget?
I need to create custom categories widget for WordPress. It should look something like this. I found in this topic how to create custom categories but I can’t understand how to add word – “…
Check if str_replace Should Execute First to Avoid Duplicate Strings
Each time we save our ACF form, this snippet adds additional tags around the registered trademark symbol. Our goal is for it to do it just once, so we need to check for the tags first but don’t know how, as we’re quite new to PHP. Answer You should check first if string contains and if it does jus…
Get taxonomy name
I’m trying to modify a theme that has custom posts with custom taxonomies. At the bottom of the posts it displays a list of other posts (as in “you might also like…”) What I’m trying to do is to filter the posts that are displayed in that area so they match the category of the cu…
Hide element via css when another element is present on the page
I want to hide an element if one element is already present on the page. If element with the id: is present on the page, then hide following element: So I’ve found a solution how to do this via js. but I need to this via .css, if possible Answer Yes you can kind of do this. Here’s an example,
Hide element when another element is present on the page
I want to hide an element if one element is already present on the page. If element with the id: is present on the page, then hide following element: I want to achieve is either through a function or .css, it doesn’t matter. Answer Just do it with JavaScript.
Add and wrap product categories WordPress/Woocommerce in product loop
I use this snippet for display product categories in product loop on Shop and archives pages: I want this: To achieve this I use jQuery: How can I modify my PHP snippet to avoid using jQuery? Answer You could just append the corresponding tag before & after your foreach loop: Then you don’t need to …
What hook for product image replacement in WooCommerce shop page
What function is called when WooCommerce returns image for products in shop page? I would like to replace image with something else. Answer To find out, you need look at content-product.php template source code from line 36 to 42: So when looking at woocommerce_template_loop_product_thumbnail() involved hooke…