Viewing 7 posts - 1 through 7 (of 7 total)
  • Author
    Posts
  • #422348

    Hi, I don’t see the code block element when i’m editing a post instead of a page. How can I add it to a post?

    Thanks.

    #422389

    Hi!

    Try with the following shortcode:

    [av_codeblock wrapper_element='' wrapper_element_attributes='' escape_html='' deactivate_shortcode='' deactivate_wrapper='']CODE HERE[/av_codeblock]
    

    Regards,
    Josue

    #428139

    That doesn’t seem to work. I get – [avia_codeblock_placeholder uid=”1″] when I add this to a post.

    #428415

    Hi,

    Yes i saw that too on my local install. You’d need to activate ALB on that Post in order to use the Code Block element.

    Alternatively you could use a plugin like:
    https://wordpress.org/plugins/code-snippets/

    Regards,
    Josue

    #428424

    Does that plugin allow me to add specific code to specific posts?

    #428612

    I’m not sure. What kind of code do you want to add (JavaScript, CSS, PHP)?. You could do something like this in child theme functions.php:

    function add_code_to_specific_post() {
    if(is_single('32'){
    // CODE HERE
    }
    add_action('wp_footer', 'add_code_to_specific_post');

    That will add the code before the </body> tag and it will only add it to the Post 32 (ID).

    Regards,
    Josue

    • This reply was modified 9 years, 7 months ago by Josue.
    #428742

    Managed to find a workaround. I created a custom widget and add a widget element and it does the trick :)

    Thanks.

Viewing 7 posts - 1 through 7 (of 7 total)
  • The topic ‘How can I add a Code Block element in a post?’ is closed to new replies.