Change behavior of “Insert into Post” based on attachment metadata

In case it’s helpful to anyone else, here’s what my code looked like to achieve this. I didn’t end up saving the attachment data at all, per tbuteler’s suggestion, but rather than using $_REQUEST I found I could use the $attachment array directly: function my_attachment_fields_to_edit( $form_fields, $post ) { $supported_exts = supported_types(); // array of … Read more

Tinymce – How to hook before or after live shortcodes rendering?

Well, yes, you can do that: //replace live edited content to display html editor.on(‘BeforeSetcontent’, function(event){ event.content = tinymce_to_html( event.content ); }); //Transform your html content to raw content editor.on(‘GetContent’, function(event){ event.content = html_to_tinymce( event.content ); }); Let’s explain that: Under the hood, tinymce use a plain-text editor to store content, use in forms, etc etc. … Read more

All shortcodes not working on custom theme

So I finally found a solution!!! After many weeks of searching and trying different solutions, it was just a matter of removing “get_” from a reference of “the_content” in my page.php I changed this <?php function sup($text){ $true = preg_replace(‘#(\d+)(st|th|nd|rd)#’, ‘$1<sup class=”super”>$2</sup>’, $text); return $true; } echo sup(get_the_content()); ?> To this <?php function sup($text){ $true … Read more

How can I define a custom template for woocommerce [products] shortcode? [closed]

Open your theme’s function.php and add following add_action( ‘woocommerce_shortcode_before_products_loop’, ‘roka_before_products_shortcode_loop’, 1, 10 ); add_action( ‘woocommerce_shortcode_after_products_loop’, ‘roka_after_products_shortcode_loop’, 0, 10 ); function roka_before_products_shortcode_loop( $atts ) { $GLOBALS[ ‘roka_woocommerce_loop_template’ ] = ( isset( $atts[ ‘class’ ] ) ? $atts[ ‘class’ ] : ” ); } function roka_after_products_shortcode_loop( $atts ) { $GLOBALS[ ‘roka_woocommerce_loop_template’ ] = ”; } Then override … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)