wp enqueue style on specific page templates

If you plan to do a lot of WP development you should bookmark this page: http://codex.wordpress.org/Conditional_Tags The other answer works but the conditional relies upon your page slug (myurl.com/this-is-the-slug) never changing. A more reliable method (IMO), and one that fits this case, would be to use the is_page_template(‘example-template.php’) conditional check instead.

How do I edit this code so that it also adds specific meta data into the user and subsequent CPT being created?

You would use these functions for adding meta: add_user_meta adds user meta add_post_meta adds post meta Notice that wp_insert_post will also return the post ID of the post created ( or a WP_Error object if it failed ). You can then use that in add_post_meta. See https://developer.wordpress.org/reference/functions/wp_insert_post/ Note though that tags/categories are not meta, they … Read more

Problem with Google Page Speed because of custom font

It’s a common issue. Since Google PageSpeed flags layout shifts caused by fonts, using font-display: swap is a good move. Because you’ve installed the font via the WP backend Typography / Styles, you’ll need to override or add CSS to the font face rule so it includes font-display: swap. For example: @font-face { font-family: ‘YourCustomFont’; … Read more

How to keep prev/next nav on posts in same taxonomy

There’s a decent stack of functions here: next_post_link() get_next_post_link() get_adjacent_post_link() get_adjacent_post() Unfortunately, within this stack of functions, there aren’t any filters that are intended to change the $in_same_term parameter. Probably the best approach would be to create a child theme and override the single.php file within the child theme, and change the parameters of next_post_link() … Read more

WordPress update bug

Your website is not really broken. As far as I know, what I see when I look on your source code is some HTML code read as plain text. It means WordPress is interpreting HTML as if it was just random text. For example, on your front-office, some HTML is published and readable (We should … Read more

No src and sizes attributes present on WordPress thumbnail images; the smallest image size is loaded irregardless of viewport size

WordPress Responsive Images Without Imagick No, you do not need Imagick to get WordPress responsive images (srcset and sizes) working. As of WordPress 4.4+, if your theme has post-thumbnails enabled and you are using core functions like the_post_thumbnail() or wp_get_attachment_image(), WordPress will automatically include srcset and sizes attributes (assuming multiple image sizes exist). The GD … Read more

WordPress Error uploading image: 401 API Python Script

When you’re using Basic Authentication, you can’t just pass the {username}:{password} string; you need to base64-encode it. libcurl docs on Basic Auth So your line ‘Authorization’: ‘Basic ‘ + WP_USER + ‘:’ + WP_APPLICATION_PASSWORD should be more like ‘Authorization’: ‘Basic ‘ + base64( WP_USER + ‘:’ + WP_APPLICATION_PASSWORD ) (I don’t know how Python does … Read more

InnerBlocks adds any block and saves, but the editor doesn’t show child blocks on reload

Turns out the parent block was locking the template. I added some code to lock InnerBlocks only when we a new child block is added. for (let i = 1; i <= parseInt(numChildren); i++) { defaultChildren.push( [“accordion/child”, { className: ‘accordion-‘ + i }, [[“core/paragraph”,{content:’Accordion ‘ + i,}]] ] ); } const onChangeNumChildren = (newNumChildren) => … Read more