Limit Gutenberg blocks available to users to choose from

In the functions.php file I added add_filter( ‘allowed_block_types_all’, ‘func_allowed_block_types’ ); function func_allowed_block_types( $allowed_blocks ) { return array( ‘core/embed’ ); } Then in my plugin I added this JS to the javascript file to enable only the embed blocks I wanted (Twitter, youTube and Vimeo) wp.domReady( function() { const allowedEmbedBlocks = [ ‘twitter’,’youtube’, ‘vimeo’ ]; wp.blocks.getBlockType( … Read more

Custom URL for all posts in WordPress

Create a page with a custom page template, then create a custom WP_Query object to return your last posts. You can get something like: <?php /* Template Name: Blog Page */ get_header(); $args = array( ‘post_type’ => ‘any’, #all post types ‘posts_per_page’ => 10 #get 10 posts ); $query = new WP_Query( $args ); if($query->have_posts()): … Read more

Detect archive and category page

There are Conditional Tags for this: is_archive() and is_category() respectively. For a custom post type archives you could use is_post_type_archive(). There are many conditional tags available, see above linked codex page. To determine the blog archive you have to additionally check for the post type post, take a look at this question and the answers … Read more

wordpress blog in subdirectory or subdomain

The first option (/blog/) is the easiest: create a new blank page called “Blog” navigate to “Settings > Reading” and choose this new page as the value in the “Posts Page” drop-down Now, when you navigate to the new “Blog” page (which should be at /blog/ unless there is something unusual about your setup), all … Read more

How do I put a wordpress blog into my html site?

Either install wordpress in a subdomain (blog.yoursite.com or sub folder (yoursite.com/blog) Design the WordPress site exactly like your current website to get a consistent design. Or make your entire website in WordPress. WordPress can be used for many other things than blogging.

Display sidebar if blog

There is no conditional tag for the blog page. You have to use both is_home() and is_front_page() to detect this page When you use is_home() and is_front_page(), you have to use them in the right order to avoid bugs and to test every user configuration: <?php if ( is_front_page() && is_home() ) { // blog … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)