Create a folder if it doesn’t already exist

I’ve run into a few cases with WordPress installs with Bluehost where I’ve encountered errors with my WordPress theme because the uploads folder wp-content/uploads was not present. Apparently the Bluehost cPanel WordPress installer does not create this folder, though HostGator does. So I need to add code to my theme that checks for the folder … Read more

How to Insert ad unit code into your WordPress site

You can use plugins, themes, or widgets to place ads in WordPress. #wordpress There are several ways to place AdSense ad unit code into your WordPress site. Below, you’ll find information about some ways to do this. Tip: Make sure that you’ve already created the ad units that you need in your AdSense account. Plugins If you’re not familiar with coding, but … Read more

How to Insert ad code into the AMP version of your WordPress site

Accelerated Mobile Pages (AMP) is an open source initiative to enable a better web, with sites that are fast, beautiful, and monetize well. Learn more about how AMP can help publishers. Creating an AMP version of your WordPress site To create an AMP version of your site, we recommend you use the AMP for WordPress plugin. AMP for WordPress … Read more

How to Setting up ads (Google Adsense) on my wordpress website

Are you a WordPress user looking to monetize your site with AdSense? There are several ways to place AdSense ad code into your WordPress site. Connecting your WordPress site If you’re new to AdSense, one of your first tasks is to connect your site to AdSense. We highly recommend you use Site Kit for WordPress by Google. … Read more

Integrating slick.js into wordpress

Adjusted some of your code. This should work: [php]<?php /** * Block Name: Testimonials * * This is the template that displays the testimonials loop block. */ $argType = get_field(‘loop_argument_type’); if ($argType == "count") : $args = array( ‘orderby’ => ‘title’, ‘post_type’ => ‘testimonials’, ‘posts_per_page’ => get_field(‘testimonial_count’) ); else : $testimonials = get_field(‘select_testimonials’); $args = … Read more

Restrict Gutenberg Blocks to Single Use

For anyone who needs this too, here is how you restrict a block for single use only: [php]// A Sample Block acf_register_block(array( ‘name’ => ‘blockname’, ‘title’ => __(‘Block Name’,’slug’), ‘description’ => __(‘A translatable description’,’slug’), ‘render_callback’ => ‘theme_block_render’, ‘category’ => ’embed’, //the block category (optional) ‘align’ => ‘wide’, // default value for width ‘mode’ => ‘auto’, … Read more

How to make a dropdown list control that fetches names of custom posts types

If creating a dropdown list (select) for the edit() function of a Gutenberg block, registered post types can be retrieved with getPostTypes() via useSelect() in JavaScript. An example of this is the dropdown in the Query Block to select a Post Type. Below is a simplified example that uses a <SelectControl/> to display a list of all viewable post types, and enables a selected postType … Read more