I've created a custom block to show my featured post, showing the posts is not the problem but I'm stuck in the first stage. My created block is not showing up the the admin page builder section. I have placed the file inside the "blocks" folder. Bellow I've added my code could you please let me know what I am doing wrong.
<?php
if(!class_exists('AQ_Featured_Block')) {
class AQ_Featured_Block extends AQ_Block {
function __construct() {
$block_options = array (
'name' => 'Featured Carousel',
'size' => 'span12',
);
parent::__construct('aq_featured_block', $block_options);
}
function form( $instance ) {
$defaults = array(
'title' => 'Featured Post',
'subtitle' => 'Optional Subtitle',
'post_type' => 'all',
'categories' => 'all',
'posts' => 3,
'block_bg_color' => '#2E3641',
'block_text_color' => '#000'
);
// set default values (if not yet defined)
$instance = wp_parse_args((array)$instance, $defaults);
extract($instance);
?>
<p class="description note">
<?php _e('Use this block to show the featured posts') ?>
</p>
<?php
}
function block($instance) {
// default key/values array
$defaults = array(
'title' => '', // the name of the member
'position' => '', // job position
);
// set default values (if not yet defined)
$instance = wp_parse_args($instance, $defaults);
// import each array key as variable with defined values
extract($instance);
?>
<h1>My Test Featured Block</h1>
<?php
}
}
}
if(class_exists('AQ_Page_Builder')) {
//register the blocks
aq_register_block('AQ_Featured_Block');
}
?>
Could anyone please tell me do I need to do anything else to register the block so it will show up in the admin section.
Hello there,
I've created a custom block to show my featured post, showing the posts is not the problem but I'm stuck in the first stage. My created block is not showing up the the admin page builder section. I have placed the file inside the "blocks" folder. Bellow I've added my code could you please let me know what I am doing wrong.
Could anyone please tell me do I need to do anything else to register the block so it will show up in the admin section.
Thanks in advance.