Tagged: 

Viewing 14 posts - 1 through 14 (of 14 total)
  • Author
    Posts
  • #1001394

    Hi,

    I use this snippet from here in latest ENFOLD version

    add_filter('avia_load_shortcodes', 'avia_include_shortcode_template', 15, 1);
    function avia_include_shortcode_template($paths)
    {
      $template_url = get_stylesheet_directory();
          array_unshift($paths, $template_url.'/shortcodes/');
    
      return $paths;
    }

    so far, works fine.

    But:
    when you use the regular ALB element “simple slider” and add a caption like that:

    View post on imgur.com

    then the output of the caption headline is wrong, the h2 tag gets lost:

    View post on imgur.com

    … instead of looking like this, which is right, when you disable the snippet from the documentation mentioned above:

    View post on imgur.com

    My site is not yet online, so perhaps you can follow up this issue by adding the snippet from the documentation by your own.
    I disabled all other plugins, to avoid any conflicts.

    NOTE:
    I do not use a child theme, I use the parent theme with that snippet and created a “shortcodes” folder in the parent’s root
    Maybe a path problem, because I use the parent theme?

    Any updates on the snippet possible please?
    Thanks.

    #1001739

    Hey Gitte,
    In order to create custom shortcode elements you need to add the “shortcodes” folder in the child theme path and add the function into the child theme functions.php
    Please install the official Child Theme and then recreate the steps above.

    Best regards,
    Mike

    #1001844

    Hi,

    I have made too many changes to the theme, so that a child has not worked any more some time ago.
    So I work ONLY with the parent theme, documenting the changes I made in a list – worked for me.

    So please see again my question above, regarding the parent theme – no child!
    Thanks.

    #1001884

    Hi,
    OK, can you explain which element you are editing or adding, and can you link to a copy of it to test with via DropBox?
    If you are keeping a list of your changes and manually making the changes after each update, why not edit the shortcode element directly in the parent theme folder?
    \enfold\config-templatebuilder\avia-shortcodes\[element folder]

    But I’m very certain that moving the customized shortcode elements, using the function, will only work with a child theme. But I will be happy to test on my localhost if you link to your edited element via DropBox.

    Best regards,
    Mike

    #1001892

    1. I use the “simple slider” element:

    View post on imgur.com

    2. adding 1 image to it:

    View post on imgur.com

    3. the settings of this image are:

    View post on imgur.com

    4. Result without the code snippet from documentation in parent’s functions.php:

    add_filter('avia_load_shortcodes', 'avia_include_shortcode_template', 15, 1);
    function avia_include_shortcode_template($paths)
    {
      $template_url = get_stylesheet_directory();
          array_unshift($paths, $template_url.'/shortcodes/');
    
      return $paths;
    }

    View post on imgur.com

    5. when I add the mentioned code snippets to parent’s function.php, then the image caption looks like this: the headline is not right “interpreted”:

    View post on imgur.com

    6. Source code:

    View post on imgur.com

    #1001906

    Hi,
    Thank you for the great step-by-step instructions of what you are trying to do.
    But, I believe there is a misunderstand on what the code snippet does, because there is no reason for you to use it for your project, because from your explanation you are not customizing the code of the element.

    The reason to use the code snippet is when you have changed the code of a element for a special need, and you don’t want to lose the custom code changes when the theme is updated. You don’t seem to be doing this.
    If you have made custom code changes to the slideshow.php please share it via DropBox.

    Best regards,
    Mike

    #1002023

    I need the code snippet for example for adding other ALB elements like those from https://www.spiderflystudios.com/resources/spiderfly-enfold-elements/ mentioned somewhere else here in the forum. That’s the reason for why I need this snippet in my functions.php

    Please refer also to @guenther website here:

    On the other hand I need a correct working of the “simple slider” element where the caption headline is displayed right, no matter what else I am doing with any other things.

    The fact is, that the code snippet from your documentation interferes with the correct display of a caption headline when using the “simple slider” element like shown in the screenshots above. I do not want to change anything with that element, just the right display of the headline.

    #1002036

    Hi,
    Thank you that makes sense, ok, so I downloaded some of @Guenther files, “Both Full-Sliders and Easy-Slider with h-tag choice at caption” & “White Space Separator with ID Option
    and added them to \enfold\shortcodes\ in the parent theme directory, then I added the function to the bottom of my functions.php:

    
    	add_filter('avia_load_shortcodes', 'avia_include_shortcode_template', 15, 1);
    	function avia_include_shortcode_template($paths){
    	 $template_url = get_stylesheet_directory();
    	 array_unshift($paths, $template_url.'/shortcodes/');
    	 return $paths;
    	}

    and to my surprise they worked fine.
    I then tried repeating the steps above using the Easy Slider and “Both Full-Sliders and Easy-Slider with h-tag choice at caption” with no issues.
    Then I removed the files in the \enfold\shortcodes\ but left the function in place, and again I found no issues, the h2 was in place.
    2018-08-26_163304
    I then created a new page and followed your steps above again with only the function in the parent theme functions.php and no added files, but I couldn’t reproduce your error
    2018-08-26_163726
    So I’m not sure what is causing the error for you, perhaps try creating a new test install with no plugins or scripts and see if you can reproduce the error?

    Best regards,
    Mike

    #1002199

    I haven’t yet added anything from Guenther’s site :-) That was just an intention for me for the future!!
    At the moment I just work with a clean ENFOLD and its original elements (“simple slider”).
    The only thing that I have done is adding the documentation’s code snippet

    add_filter('avia_load_shortcodes', 'avia_include_shortcode_template', 15, 1);
    function avia_include_shortcode_template($paths)
    {
      $template_url = get_stylesheet_directory();
          array_unshift($paths, $template_url.'/shortcodes/');
    
      return $paths;
    }

    to ENFOLD’s function.php and adding the “simple slider” ALB element to a page – nothing else, no tweaks, just the original ENFOLD.
    And yes, i have created a clean test install with the medical demo – no plugin, no scripts, nothing.
    The problem might be the code snippet from documentation – perhaps a path problem in it, because I use it with the parent theme, not a child theme.

    #1002213

    Hi,

    If you place your custom shortcodes in the parent theme directory (wp-content/themes/enfold/config-templatebuilder/avia-shortcodes/) you don’t need this code. You can simply remove it. The code is only required if the template builder must also check other directories (i.e. the child theme directory) for custom shortcodes. 

    If you want to test this you can i.e. use this code: https://pastebin.com/raw/XfUGF2Jn
    Jut copy it into a plain text file and save this file as testshortcode.php (make sure the file extension is .php). Then upload it to the wp-content/themes/enfold/config-templatebuilder/avia-shortcodes/ directory. Then go to the advanced layout builder and you’ll notice a new “Content Element” called “Testshortcode”. 

    Best regards,
    Dude

    #1002266

    and of course – read carefully.

    Please upload all 4 files to your child-themes/shortcodes folder because the av-helper-slideshow.php rules the things for all 3 sliders. If one left original it has a wrong markup.

    : because the av-helper-slideshow.php rules the things for all 3 sliders
    : and If one left original it has a wrong markup.

    so you can replace them in parent theme as well – but you will loose those changes on next update of your parent theme.
    And – i think you have to pull the replacement files into the right folders ( you don’t need to do that on child-theme)
    slideshow – slideshow_fullscreen – slideshow_fullsize
    the av-helper-slideshow is on shortcodes folder

    #1002269

    but thinking about the code – why does it not work if there is on enfold/shortcodes the substitutes ?
    the : $template_url = get_stylesheet_directory();
    should work on parent theme as well – or am i wrong.
    I guess the whole fault is that all 4 files have to be in there!

    #1002579

    Hi,

    Probably yes. Tbh I didn’t test this myself because it simply doesn’t make any sense to use this code with the parent theme shortcode directory.

    Best regards,
    Dude

    #1002813

    yes – your are absolutely right – but it has to work – and on parent update these files are not lost.

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