Skip to content

Tag: wordpress

PHP 7.4.21 Strange Behaviour inside WordPress

I’m puzzled by the behaviour of PHP 7.4.21. Inside a Wordpress page I have this piece of code: the function the_field() is a function of ACF (Advanced Custom Fields) plugin and returns a string with the content the user has set inside the custom field. The strange behviour I’m referring to is that inside the ifs all the blocks of

WordPress: Content in foreach remains on page because it does not refresh on form submission | Reload array after form submission?

I have tried the javascript refresh options on submit (on the <form> but none of them work. If I put the javascript refresh with the submit function, then every time it refreshes, the item gets sent to the database (do not want that). What I have tried onsubmit=”location.reload()” onsubmit=”window.location.reload()” onsubmit=”setTimeout(function () { window.location.reload(); }, 10)” It currently renders an array

WordPress add_filter to element after hook

Is it possible add a filter to a hook after an HTML element thats after the hook? Example Template file: Or is it possible to add an element around the <a id=’logo’></a> ? Like: <div class=”logo_container”><a id=’logo’></a></div> Answer The short answer is “no”. Hooks run at the place that the developer decided to place them. Any code before them, unless

Can I pass wp permalinks to an svg file?

I’ve got an svg file for a hero image, and I want certain paths to be internal links. I’ve wrapped the paths in an anchor tag, and putting in static links works, but I’d like them to be dynamic so I can changed them in the wp admin. Is this possible? How can I send the permalink data to the

Uncaught Error: Call to a member function get_attributes() on null

Imports several thousand thumbnail images into existing products. For this purpose, I used the attribute that each product “featured-images” has, in which there is a link to the product. The code works fine and sets the thumbnails, but when I log into the admin system I get an error: Uncaught Error: Call to a member function get_attributes() on null. what’s

the_field – ACF not working in ‘while’ loop

Main string of code (that doesn’t work): <span class=”price-in-kune”><?php the_field(‘tariff_price_kn’) ?> kn</span> The ways i tried to solve this problem: put insted of the_field(‘tariff_price_kn’) – echo(‘hi’) – the code worked add $post_id -> the_field(‘tariff_price_kn’, $post_id) $currencyKune = get_field(‘tariff_price_kn’); And then echo $currencyKune P.S 3) i don’t know exactly where should i put $currencyKune = get_field(‘tariff_price_kn’), so i put it before

WordPress the_custom_logo doesn’t link on homepage

I’m using twentytwentyone-child theme and I want to link the custom_logo to the homepage even on the homepage. But I can’t find any setting for that? I read this: And it says: “Displays a custom logo, linked to home unless the theme supports removing the link on the home page.” But if I look into the site-branding.php of the