How to support extra color options for shortcodes?

You have multiple options. A) Use inline-CSS: <button style=”background: <?php echo CHOSEN_COLOR_HERE (possibly validated) ?>;”> … </button> B) Write (ID-specific) CSS styles into your page. In your shortcode function, echo a <style> tag, for instance like so: <style> #shortcode-button-1 { background: <?php echo CHOSEN_COLOR_HERE (possibly validated) ?>; } #shortcode-button-2 { background: <?php echo CHOSEN_COLOR_HERE (possibly … Read more

Delete attachment with post

This is the right hook to do this: add_action(‘before_delete_post’, ‘delete_post_attachments’); function delete_post_attachments($post_id){ global $wpdb; global $post_type; if (!$post_type == ‘bkroadkill’) return; $args = array( ‘post_type’ => ‘attachment’, ‘post_status’ => ‘any’, ‘posts_per_page’ => -1, ‘post_parent’ => $post_id ); $attachments = new WP_Query($args); $attachment_ids = array(); if($attachments->have_posts()) : while($attachments->have_posts()) : $attachments->the_post(); $attachment_ids[] = get_the_id(); endwhile; endif; wp_reset_postdata(); … Read more

Custom page template in warp7 (Yootheme template)

The whole doco thing for Warp is confusing. You are supposed to use one of the styles configured under the theme, and you’ll find those in a folder such as: /wp-content/themes/yoo_avenue_wp/styles/red Add your /layouts folder under here, then copy in any file you want to override from the folder: /wp-content/themes/yoo_avenue_wp/warp/systems/wordpress/layouts These are then the files … Read more