Closed redgluten closed 9 years ago
@redgluten Have you included and registered your custom block?
something like this.
require_once ('blocks/yourblock.php');
aq_register_block('Your_Block_Class');
post your block code as well ill take a look! :)
where should i put the require_once
?
Here’s my code:
<?php
/** A simple agenda block **/
// AGENDA BLOCK
if( ! class_exists( 'Agenda_Block' ) ) :
class Agenda_Block extends AQ_Block {
//set and create block
function __construct() {
$block_options = array(
'name' => 'Agenda',
'size' => 'span6',
);
//create the block
parent::__construct('Agenda_Block', $block_options);
}
function form($instance) {
$defaults = array(
'text' => '',
);
$instance = wp_parse_args($instance, $defaults);
extract($instance);
?>
<p class="description">
<label for="<?php echo $this->get_field_id('title') ?>">
Title (optional)
<input id="<?php echo $this->get_field_id('title') ?>" class="input-full" type="text" value="<?php echo $title ?>" name="<?php echo $this->get_field_name('title') ?>">
</label>
</p>
<p class="description">
<label for="<?php echo $this->get_field_id('text') ?>">
Content
<textarea id="<?php echo $this->get_field_id('text') ?>" class="textarea-full" name="<?php echo $this->get_field_name('text') ?>" rows="5"><?php echo $text ?></textarea>
</label>
</p>
<?php
}
function block($instance) {
extract($instance);
echo do_shortcode(htmlspecialchars_decode($text));
}
}
aq_register_block('Agenda_Block');
endif;
Ok nevermind I've found where to call for the new file (block_init.php
in my case). I was thinking that there was an automatic loading as there is no mention of require_once
on the wiki page. Maybe add it? Thanks a lot!
I've followed the instructions to try and create a new block but it won't appear in the "Page builder" admin panel. I'm using the exact same code given in the wiki. Is there some file naming convention that I'm supposed to follow?