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.
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
That doesn’t seem to work. I get – [avia_codeblock_placeholder uid=”1″] when I add this to a post.
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
Does that plugin allow me to add specific code to specific posts?
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
Managed to find a workaround. I created a custom widget and add a widget element and it does the trick :)
Thanks.