Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
  • #1237540


    We want to create some reusable items (Custom Post Type = Component) that can be pulled into Avia using the “Page Content” element.

    At the moment the drop down only allows you to pick from a Page to use as the content, whereas we want to select one of our “Component” CPT items

    is there a way to hook this “Page Content” list to include the CPT as wel

    ie currently there are 2 select boxes

    Single Entry
    — Page

    and then a list of pages in the second

    We want the “Single Entry” select box to also have “Component” as well as “Page” in the options, which will then populate the second list with a list of our Component items



    here’s a workaround in the meantime…
    (it’s basically a shortcode that runs a shortcode that pulls in content from another CPT post with Builder content)

    1) add a CPT eg “component”

    2) install the plugin Custom Content Shortcodes (CCS)

    3) enable the Meta Shortcodes option in CCS settings

    4) create a CCS Shortcode called “component” and add this code into the editor [content type=component name={NAME}]
    (this uses CCS content function to pull content/fields from another post)

    5) add this code to your functions.php to enable the Avia Builder in your CPT’s content editor

    // add Avia Builder to CPTs
    function avf_alb_supported_post_types_mod( array $supported_post_types )
      $supported_post_types[] = 'component';
      return $supported_post_types;
    add_filter('avf_alb_supported_post_types', 'avf_alb_supported_post_types_mod', 10, 1);

    you can now add this to HTML/text blocks etc in your pages, to pull in the content field from your CPT (ie our builder content)
    [component name="my-component"]

    (You could of course just use [content type=component name="my-component"] but I’ve added the proxy shortcode to keep it a little bit more readable)



    Thank you for sharing that info.

    If you want to include the new post type in the list, we have to modify the enfold\config-templatebuilder\avia-shortcodes\postcontent.php file and include the post type in the linkpicker element. Look for this code around line 72:

    						'name' 	=> __( 'Which Entry?', 'avia_framework' ),
    						'desc' 	=> __( 'Select the entry that should be displayed', 'avia_framework' ),
    						'id' 	=> 'link',
    						'type' 	=> 'linkpicker',
    						'std' 	=> 'page',
    						'fetchTMPL'	=> true,
    						'subtype'	=> array( __( 'Single Entry', 'avia_framework' ) => 'single' ),
    						'posttype'	=> array( 'page', 'portfolio' ),
    						'hierarchical'	=> 'yes',						//	'yes' ( =default) | 'no'
    						'post_status'	=> 'publish,private,draft'		//	array | string  (default = publish)

    In the posttype parameter or key, include the name of the new post type.

    'posttype'	=> array( 'page', 'portfolio' ),

    But please not that using a custom post type on the Page Content element might cause unintended behavior or layout issues in the page.

    Best regards,

Viewing 3 posts - 1 through 3 (of 3 total)
  • You must be logged in to reply to this topic.