Category: WordPress

With 208 articles also related to:

Aleš Sýkora wrote:

Get all child terms of parent taxonomy term in WordPress

April 7, 2022 in Custom Code, WordPress

I have my taxonomy with multiple levels. Here is an example: ProductsJackpotsSlotsTablesCompanyleadershipnewsalerts Sometimes, you want to display only child terms of parent taxonomy. In this case, I need to display all child terms of products term. What do I need to prepare? I need taxonomy ID from WordPress admin, and prepare a query. Here is…

Continue reading

Aleš Sýkora wrote:

Disable WordPress Autor archives

November 28, 2023 in Custom Code, WordPress

Don’t need to use Author archives in WordPress? Don’t forget that those pages are being generated automatically. So you need to set up redirect if you don’t need them. You can use following codes in functions.php or in custom mu-plugin, or my preffered way is using Advanced scripts. Redirect Author archives to homepage If you…

Continue reading

Aleš Sýkora wrote:

Load Gutenberg Styles only if page has blocks

November 28, 2023 in Custom Code, Oxygen Builder, Plugins, WordPress

Trying to speed up your site? You may want to disable Gutenberg block style libraries on pages and posts which doesn’t have any blocks. Add this code to your custom snippets and test it. It should disable loading of Gutenberg styles when not needed. It works with Oxygen Builder and Advanced scripts – I have…

Continue reading

Aleš Sýkora wrote:

Get ACF taxonomy field for current post in Query

April 5, 2022 in ACF, Oxygen Builder, Plugins, WordPress

For a situation where you need to display ACF taxonomy field for current terms assigned to the post in the WP Query, you may need the code below. Why to use ACF taxonomy field? It’s easy. I am using this for SEO purposes. How? I am creating website for language school. My taxonomy is called…

Continue reading

Aleš Sýkora wrote:

Display only parent posts with repeater dynamic query in Oxygen builder

November 28, 2023 in Oxygen Builder, Plugins, WordPress

If you need to display only parent pages or posts, you just need to put post_parent = 0 parameter to your dynamic query in Oxygen builder. So it will work like normal WordPress query:

Continue reading

Aleš Sýkora wrote:

Get first term of current post in WordPress query

March 24, 2022 in Custom Code, Oxygen Builder, Plugins, WordPress

If you want to display only one first term assigned to your post, add this code. It will add a link to the category with CSS class with category slug, so you can style it separately from other categories. This snippet will get all terms assigned to the post with get_the_terms function. You can also…

Continue reading

Aleš Sýkora wrote:

Query all posts from category with category__in instead of tax_query in Oxygen Advanced Query builder

November 28, 2023 in Custom Code, Oxygen Builder, Plugins, WordPress

If you want query some posts from one category, you don’t need to build the tax_query. You can use simpler solution, the category__in parameter. For example, you need to show 3 latest posts from media-mentions category. So go to the administration and find your taxonomy id. Mine is 13 so I will use it like…

Continue reading

Aleš Sýkora wrote:

Display WooCommerce variation price as main price in Oxygen Builder

December 6, 2023 in Custom Code, Oxygen Builder, Plugins, WooCommerce, WordPress

To display the variation price as the main price within Oxygen Builder and WooCommerce, you need the JS snippet.

Continue reading

Aleš Sýkora wrote:

Get all post attached images IDs in WordPress

March 22, 2022 in Custom Code, WordPress

If you need to get IDs of all images attached of current post, add this code to your page (you can use the code block if you use Oxygen builder): You can change the return to print_r($ids); if you need to show the values of array on frontend.

Continue reading

Aleš Sýkora wrote:

Display all custom fields meta and Taxonomies and terms of current post in WordPress

November 28, 2023 in Custom Code, WordPress

If you want to know everything about your current post, you will need to dump all custom fields and all asigned taxonomies and their terms. Display all post Meta’s This code will create list of custom fields assigned to the current post: Display all taxonomies and terms This code will create list like this:

Continue reading