Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
  • #171135


    I use the Template for a “One Page” site and there for it would be very helpful to have the ability to add “Anker nodes” or “Div with IDs” to the page.
    Sadly there is no Shortcode Template for the “Avia Layout Builder” for that. This is why I started to create one my self. But I’m not able a full accomplish it.

    I need to know how I could avoid the additional Markup in the Frontend.

    <main role="main" itemprop="mainContentOfPage" class="template-page content  twelve alpha units">
    <div class="post-entry post-entry-type-page post-entry-2251">
    <div class="entry-content-wrapper clearfix">
    <div id="myAnker" class="anker"><!-- <a name='myAnker' /> --></div>

    As this Markup adds a lot of CSS (Margin, Padding), too.

    I’ve created an Icon for it:
    Anker Tag Icon

    And I added the necessary PHP file:

     * Anker
     * Creates a div with "id" for an anker
    // Don't load directly
    if ( !defined('ABSPATH') ) { die('-1'); }
    if ( !class_exists( 'avia_sc_a_div' ) ) 
    	class avia_sc_a_div extends aviaShortcodeTemplate{
    			 * Create the config array for the shortcode button
    			function shortcode_insert_button()
    				$this->config['name']		= __('Anker Div', 'avia_framework' );
    				$this->config['tab']		= __('Content Elements', 'avia_framework' );
    				$this->config['icon']		= AviaBuilder::$path['imagesURL']."sc-a-div.png";
    				$this->config['order']		= 1;
    				$this->config['target']		= 'avia-target-insert';
    				$this->config['shortcode'] 	= 'av_a_div';
    				$this->config['modal_data'] = array('modal_class' => 'flexscreen');
    				$this->config['tooltip'] 	= __('Creates a div with id and an anker with id', 'avia_framework' );
    			 * Popup Elements
    			 * If this function is defined in a child class the element automatically gets an edit button, that, when pressed
    			 * opens a modal window that allows to edit the element properties
    			 * @return void
    			function popup_elements()
    				$this->elements = array(
    							"name" 	=> __("Div ID & Anker Name", 'avia_framework' ),
    							"desc" 	=> __("Enter the ID value here.", 'avia_framework' ),
    				            "id" 	=> "adivid",
    				            "type" 	=> "input",
    				            "std"	=> "anker"),
    			 * Editor Element - this function defines the visual appearance of an element on the AviaBuilder Canvas
    			 * Most common usage is to define some markup in the $params['innerHtml'] which is then inserted into the drag and drop container
    			 * Less often used: $params['data'] to add data attributes, $params['class'] to modify the className
    			 * @param array $params this array holds the default values for $content and $args. 
    			 * @return $params the return array usually holds an innerHtml key that holds item specific markup.
    			function editor_element($params)
    				$params['innerHtml']  	= "<div class='avia-a-div'>".trim( $params['adivid'] )."</div>";
    				$params['class']		= "";
    				return $params;
    			 * Frontend Shortcode Handler
    			 * @param array $atts array of attributes
    			 * @param string $content text within enclosing form of shortcode element 
    			 * @param string $shortcodename the shortcode found, when == callback name
    			 * @return string $output returns the modified html string 
    			function shortcode_handler($atts, $content = "", $shortcodename = "", $meta = "")
    			    extract(shortcode_atts(array('adivid' => 'anker'), $atts));
    				$adid = trim($adivid);
            		$output  = "";
            		$output .= "<div id='{$adid}' class='anker'><!-- <a name='{$adid}' /> --></div>";
            		return $output;

    What is the right framework entry to remove the additional Markup on all nested levels?

    Greez WrYBiT


    Hi wrybit!

    You can use the “Section” element and the “Section ID” option field ( ) to create “one page” sites.



    Wow, thanks for your quick Feedback. :)
    But this also adds additional hight to that Block.

    shortcodes.css (116): .avia-section { min-height: 100px; }
    layout.css (1009): .content, .sidebar { min-height: 1px; }
    grid.css (32): .container_wrap { border-top-width: 1px; }
    grid.css (39): .unit, .units { min-height: 1px; }

    Strangely that creates 99px hight in total. I aim to have 0px :)

    Now I could:

    1. A) Add all IDs to the CSS file and hardcode remove that space. But than it becomes a bit inflexible.
    2. B) Add the possibility to add a class to that section that “fixes” that css. But I don’t know how.
    3. C) Go for the solution above. And add a special Anker element for that. But There I have to much markup, too.

    What would you suggest?

    Greez Jens

    • This reply was modified 4 years ago by  Jens.


    You can add following code to the child theme functions.php


    This code will activate an additional option field for each layout builder element which enables you to add one or more css classes to the element container.



    Perfekt! Thanks a lot.
    That did the job.

    Why not add a GUI to the enfond module to “configure” those framework flags?

    Anyway, have a awesome weekend (or better rest of the sunday).

    Greez Jens

Viewing 5 posts - 1 through 5 (of 5 total)

The topic ‘Add a "Anker Shortcode Template" To Avia Layout Builder’ is closed to new replies.