Shortcode for wpBakery Grid
-
This Plugin and the way it works is DopeAF and appreciate the developer for their hard work. My other solutions have discontinued and this might be the only other one left. The only thing I would like to have seen is the subtitle block on the back end under the title instead of above it on the page backend.
But, I needed a shortcode to place this on pages and post grid for WPBaker so I created this:
// Add Secondary Title Shortcode
function wpsecondarytitle_shortcode() {
ob_start();
get_secondary_title();
return ob_get_clean();
}
add_shortcode( ‘wpsecondarytitle’, ‘wpsecondarytitle_shortcode’ );Then just put [wpsecondarytitle] wherever you want it to show up. I put it as a text element inside of the gridBuilder in wpBakery.
then I got board, drunk, and lazy and decided I also wanted a column on the backend post list so I can visually see the subtitle, so I made this:
// Add the secondary title column to the Posts, Products, and Pages lists on the backend
function wpsecondarytitle_add_column($columns) {
$columns[‘secondary_title’] = ‘Secondary Title’;
return $columns;
}
add_filter(‘manage_post_posts_columns’, ‘wpsecondarytitle_add_column’);
add_filter(‘manage_product_posts_columns’, ‘wpsecondarytitle_add_column’);
add_filter(‘manage_page_posts_columns’, ‘wpsecondarytitle_add_column’);// Populate the secondary title column with the secondary title value
function wpsecondarytitle_populate_column($column_name, $post_id) {
if ($column_name == ‘secondary_title’) {
echo get_secondary_title($post_id);
}
}
add_action(‘manage_post_posts_custom_column’, ‘wpsecondarytitle_populate_column’, 10, 2);
add_action(‘manage_product_posts_custom_column’, ‘wpsecondarytitle_populate_column’, 10, 2);
add_action(‘manage_page_posts_custom_column’, ‘wpsecondarytitle_populate_column’, 10, 2);Maybe the developer Kolja Nolte will want to add this to his plugin to help others, maybe easily modify it for other uses. Being able to edit it from the post list page would be fun as well.
xoxo, LewisOne
The page I need help with: [log in to see the link]
- The topic ‘Shortcode for wpBakery Grid’ is closed to new replies.