Viewing 10 posts - 1 through 10 (of 10 total)
  • Author
    Posts
  • #1175484

    Hi there,

    we have created our own shortcodes and added a new breakpoint for the screen_options_visibility function like this:

    protected function screen_options_visibility( array $element )
    		{
    			$template = array(
    							
    							array(
    									'type' 				=> 'heading',
    									'name'              => __( 'Element Visibility', 'avia_framework' ),
    									'desc'              => __( 'Set the visibility for this element, based on the device screensize.', 'avia_framework' ),
    							),
    							
    							array(	
    									'desc'              => __( 'Hide on very large screens (wider than 1280px - eg: Large Desktop)', 'avia_framework' ),
    									'id'                => 'av-desktopl-hide',
    									'std'               => '',
    									'container_class'   => 'av-multi-checkbox',
    									'type'              => 'checkbox'
    								),
    								
    							array(	
    									'desc'              => __( 'Hide on large screens (wider than 990px - eg: Desktop)', 'avia_framework' ),
    									'id'                => 'av-desktop-hide',
    									'std'               => '',
    									'container_class'   => 'av-multi-checkbox',
    									'type'              => 'checkbox'
    								),

    With 4.7 this has been moved to popup-templates.class.php so that our breakpoint does not work anymore. We have been using this on quite a few pages and we have been missing that breakpoint for Enfold a lot in the past, so I would very much like to get this working again. Any idea how to do that with 4.7?

    Thanks a million in advance
    Michael

    #1176291

    Hey Michael,

    Thank you for inquiry.

    You will now have to include the visibility options (screen_options_visibility) within the Advanced tab, and include it in the screen_options_toggle container. Please check the popup_elements function in the existing shortcodes.

    array(
    						'type' 	=> 'tab',
    						'name'  => __( 'Advanced', 'avia_framework' ),
    						'nodescription' => true
    					),
    
    					array(
    							'type' 	=> 'toggle_container',
    							'nodescription' => true
    						),
    
    						array(	
    								'type'				=> 'template',
    								'template_id'		=> 'screen_options_toggle',
    								'templates_include'	=> array(
    															$this->popup_key( 'advanced_table_responsive' ),
    															'screen_options_visibility'
    														)
    							),
    
    						array(	
    								'type'			=> 'template',
    								'template_id'	=> 'developer_options_toggle',
    								'args'			=> array( 'sc' => $this )
    							),
    
    					array(
    							'type' 	=> 'toggle_container_close',
    							'nodescription' => true
    						),
    
    				array(
    						'type' 	=> 'tab_close',
    						'nodescription' => true
    					),
    

    Best regards,
    Ismael

    #1176655

    Hi Ismael,
    thank you for that hint. If I understood you correctly, should it work like this in the shortcode:

    array(	
    								'type'				=> 'template',
    								'template_id'		=> 'screen_options_toggle',
    								'templates_include'	=> array(
    															$this->popup_key( 'new_breakpoint' ),
    															'screen_options_visibility'
    														)
    							),

    and then later in the same file

    protected function register_dynamic_templates()
    		{
    			global $avia_config;
    // existing code goes here.................................................
                              /**
    			 * Advanced Tab
    			 * ===========
    			 */
    			
    			$c = array(
    						array(	
    									'desc'              => __( 'Hide on very large screens (wider than 1280px - eg: Large Desktop)', 'avia_framework' ),
    									'id'                => 'av-desktopl-hide',
    									'std'               => '',
    									'container_class'   => 'av-multi-checkbox',
    									'type'              => 'checkbox'
    								),
    				);
    			AviaPopupTemplates()->register_dynamic_template( $this->popup_key( 'new_breakpoint' ), $c );
    		}

    The entry shows up in the shortcode popup but it isn’t applied. What am I missing? Naturally I have the correct CSS in place like this:

    @media only screen and (min-width: 1280px){
    
    .responsive.av-no-preview #top #wrap_all .av-desktopl-hide,
    .responsive.av-no-preview #top #wrap_all .av-desktopl-font-size-hidden,
    .responsive.av-no-preview #top #wrap_all .av-desktopl-font-size-title-hidden{display:none;}
    }
    }
    
    @media only screen and (min-width: 990px)  and (max-width: 1279px) {
    .responsive.av-no-preview #top #wrap_all .av-desktop-hide,
    .responsive.av-no-preview #top #wrap_all .av-desktop-font-size-hidden,
    .responsive.av-no-preview #top #wrap_all .av-desktop-font-size-title-hidden{display:none;}
    }

    Thanks for your valuable input.
    Cheers, Michael

    #1177100

    Hi,

    Thank you for the update.

    You don’t need to register them again. The popup_elements function will automatically register everything inside the elements array including the screen visibility options template. Please check the existing shortcode files and look for the popup_elements function so that you can recognize the pattern. For example, in the codeblock.php shortcode file, the following block of code inside the pop_elements function creates the Advanced tab and the toggles including the Responsive > Element Visibility and the Developer Settings.

    array(
    						'type' 	=> 'tab',
    						'name'  => __( 'Advanced', 'avia_framework' ),
    						'nodescription' => true
    					),
    
    					array(
    							'type' 	=> 'toggle_container',
    							'nodescription' => true
    						),
    
    						array(	
    								'type'			=> 'template',
    								'template_id'	=> $this->popup_key( 'layout_settings' )
    							),
    
    						array(	
    								'type'			=> 'template',
    								'template_id'	=> 'screen_options_toggle'
    							),
    
    						array(	
    								'type'			=> 'template',
    								'template_id'	=> 'developer_options_toggle',
    								'args'			=> array( 'sc' => $this )
    							),
    
    					array(
    							'type' 	=> 'toggle_container_close',
    							'nodescription' => true
    						),
    

    Best regards,
    Ismael

    #1177149

    Hi Ismael,
    I seem to be slow-witted, sorry for that. I understand that the popup_elements registers everything in it and pulls e.g. the screen_options_visibility from the template file (/config-templatebuilder/avia-template-builder/php/popup-templates.class.php). Before 4,7 the array was defined directly in the shortcode, now we would need to edit that template in popup-templates.class.php, which is out of our reach in a child theme, isn’t it.
    Or are we talking at cross purposes?

    #1177568

    Hi,

    I didn’t notice that you added a new option in the element visibility options. If you want to override the default options, look for the screen_options_toggle template inside the popup_elements function. This part:

    array(	
    								'type'			=> 'template',
    								'template_id'	=> 'screen_options_toggle'
    							),
    

    Replace it with:

    array(	
    								'type'			=> 'template',
    								'template_id'	=> $this->popup_key( 'screen_options_toggle' )
    							),
    

    Now, in the register_dynamic_templates function, add the new options like so:

    			$c = array(		
    				array(
    						'type' 				=> 'heading',
    						'name'              => __( 'Element Visibility', 'avia_framework' ),
    						'desc'              => __( 'Set the visibility for this element, based on the device screensize.', 'avia_framework' ),
    				),
    
    array(	
    									'desc'              => __( 'Hide on very large screens (wider than 1280px - eg: Large Desktop)', 'avia_framework' ),
    									'id'                => 'av-desktopl-hide',
    									'std'               => '',
    									'container_class'   => 'av-multi-checkbox',
    									'type'              => 'checkbox'
    								),
    
    				array(	
    						'desc'              => __( 'Hide on large screens (wider than 990px - eg: Desktop)', 'avia_framework' ),
    						'id'                => 'av-desktop-hide',
    						'std'               => '',
    						'container_class'   => 'av-multi-checkbox',
    						'type'              => 'checkbox'
    					),
    
    				array(	
    
    						'desc'              => __( 'Hide on medium sized screens (between 768px and 989px - eg: Tablet Landscape)', 'avia_framework' ),
    						'id'                => 'av-medium-hide',
    						'std'               => '',
    						'container_class'   => 'av-multi-checkbox',
    						'type'              => 'checkbox'
    					),
    
    				array(	
    
    						'desc'              => __( 'Hide on small screens (between 480px and 767px - eg: Tablet Portrait)', 'avia_framework' ),
    						'id'                => 'av-small-hide',
    						'std'               => '',
    						'container_class'   => 'av-multi-checkbox',
    						'type'              => 'checkbox'
    					),
    
    				array(	
    
    						'desc'              => __( 'Hide on very small screens (smaller than 479px - eg: Smartphone Portrait)', 'avia_framework' ),
    						'id'                => 'av-mini-hide',
    						'std'               => '',
    						'container_class'   => 'av-multi-checkbox',
    						'type'              => 'checkbox'
    					),
    			);
    
    			$template = array(
    				array(
    					'type'          => 'template',
    					'template_id'	=> 'toggle',
    					'title'			=> __( 'Responsive', 'avia_framework' ),
    					'content'		=> $c,
    					'nodescription'	=> true
    				)
    			);
    
    			AviaPopupTemplates()->register_dynamic_template( $this->popup_key( 'screen_options_toggle' ), $template );
    

    Best regards,
    Ismael

    #1177599

    Hi Ismael,

    thank a lot. Yes, that new options is the reason we’re doing his. And your code works great now. From your first post I assumed we could just add that one bit, but I understand now that we have to replace the whole array.

    This only leaves the other two files, that would have to be edited: /includes/helper-privacy.php (line 1786) and /config-templatebuilder/avia-template-builder/php/generic-helper.class.php (line 928).

    Any chance you have an update safe way of editing those up your sleeve ;-)

    Cheers,
    Michael

    #1177964

    Hi,

    You’re welcome!

    Why do you need to edit the /includes/helper-privacy.php and generic-helper.class.php files? Are you trying to override the privacy option? You may need to copy the whole av_privacy_class in your child theme because you can’t override it just by copying the helper-privacy.php file.

    If you have any additional questions at this time we kindly ask that you open them up in a separate thread. The longer threads get in the forum, they become more difficult to support as they tend to drift off topic and they also make it troublesome for users trying to search for solutions. Keeping threads relevant to their original inquiry ensures that we can keep better track of what has been resolved and that users can more effectively find answers to similar issues they might be experiencing.

    Thanks!

    Best regards,
    Ismael

    #1177970

    Hi Ismael,
    the new breakpoint that we added only works, if we add “av-desktopl-hide=” in /includes/helper-privacy.php line 1786:

    $sc_content .= “[av_heading tag='h3' padding='10' heading='{$heading}' color='' style='blockquote modern-quote' custom_font='' size='' subheading_active='' subheading_size='15' custom_class='' admin_preview_bg='' av-desktopl-hide='' av-desktop-hide='' av-medium-hide='' av-small-hide='' av-mini-hide='' av-medium-font-size-title='' av-small-font-size-title='' av-mini-font-size-title='' av-medium-font-size='' av-small-font-size='' av-mini-font-size='' margin='10px,0,0,0'][/av_heading]“;

    and add “av-desktopl-hide” to /includes/helper-privacy.php (line 1786)

    $displays = array( ‘av-desktopl-hide’, ‘av-desktop-hide’, ‘av-medium-hide’, ‘av-small-hide’, ‘av-mini-hide’ );

    You said “You may need to copy the whole av_privacy_class in your child theme.”
    I’ll see if can figure that out – unless you want to give me one last advice on how to accomplish that and then I am gone (and happy).
    Thanks,
    Michael

    • This reply was modified 4 years, 2 months ago by 0rca. Reason: Having trouble with the code tags.. :-(
    #1178547

    Hi,

    the new breakpoint that we added only works, if we add “av-desktopl-hide=” in /includes/helper-privacy.php line 1786:

    Sorry for the delay. That is the markup of the privacy tabs. Are you trying to hide it?

    You said “You may need to copy the whole av_privacy_class in your child theme.”

    You have to copy the whole av_privacy_class and AviaHelper classes without the class_exists wrapper in the child theme’s functions.php file or in any file of your choosing. Make sure to include or require the file properly.

    // https://www.php.net/manual/en/function.require-once.php

    Best regards,
    Ismael

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