17 Jan Using Visual Composer to Design Your Theme
First off, I’m a huge fan of WP Bakery’s Visual Composer. Anything that could make laying a page out easier for a client is a huge plus. So, just to be clear, I’m completely biased when it comes to Visual Composer 😉
Last year while making a theme for a client, I realized that instead of making theme options( where the client could add their logo, ect..), why not just let Visual Composer do the dirty work? That way the end user could customize their header or footer with out knowing any code and be able to customize it further than theme options.
First, I had to add a custom post type called Theme Blocks(‘post_type=block’).
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 | /// REGISTER Theme BLOCKS POST TYPE ///////////////////////////////////////////// function create_blocks_post_type() { register_post_type( 'blocks', array( 'labels' => array( 'name' => __( 'Theme Blocks' ), 'singular_name' => __( 'Theme Block' ) ), 'public' => true, 'capability_type' => 'post', 'menu_position' => 5, 'rewrite' => array('slug' => 'blocks'), 'supports' => array('title','editor','author') ) ); } add_action( 'init', 'create_blocks_post_type' ); |
Then in the backend of WP, you need to allow Visual Composer to load under that post type. You can find that under Visual Composer settings screen.
Next, I added the following code to my footer and header files in my theme:
1 2 3 4 | <?php // Load Theme Block $page_id = get_page_by_title( 'Header' ,'','blocks'); $page_data = get_page( $page_id ); echo apply_filters('the_content', $page_data->post_content); ?> |
Now if the client wishes to change the complete layout of their Header, they can simply design it in Visual Composer’s interface.
I also added a shortcode to my functions file to allow theme blocks to be called from Ubermenu. This allowed me to create submenu’s with all kinds of widgets and layout styles.
Here is the shortcode for pulling a theme block or any page:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 | function block_insertPage($atts, $content = null) { $output = NULL; extract(shortcode_atts(array( "page" => '' ), $atts)); if (!empty($page)) { $page_id = get_page_by_title( $page ,'','blocks'); $page_data = get_page( $page_id ); //Next 2 lines, enables custom CSS to load $block_css = get_post_meta( $page_data->ID, '_wpb_shortcodes_custom_css', true ); echo '<style type="text/css">'. $block_css .'</style>'; $output = apply_filters('the_content', $page_data->post_content); } return $output; } add_shortcode('block', 'block_insertPage'); |
Homepage
Posted at 08:17h, 12 March… [Trackback]
[…] Read More Infos here: jeniuxmedia.com/2017/01/17/using-visual-composer-to-design-your-theme/ […]
1warm-hearted
Posted at 12:52h, 08 January1closeted
702 gay chat number
Posted at 10:52h, 14 Januarygay sex chat online https://bjsgaychatroom.info/
free gay dating skwerts
Posted at 14:27h, 14 Januarygay dating sites cape cod https://gaypridee.com/
gay phont chat
Posted at 17:18h, 14 Januaryfree gay bays chat https://gaytgpost.com/
gay chat roullrtte
Posted at 21:39h, 14 Januarygay chat apps for pc https://gay-buddies.com/
victim met killer on gay dating site new yorlk
Posted at 20:44h, 15 Januaryadam for adam gay dating https://speedgaydate.com/
cashman casino slots free
Posted at 15:36h, 28 Januarybig fish free slots games https://2-free-slots.com/
play ginger wild slots
Posted at 19:43h, 28 Januarywow equipment slots https://freeonlneslotmachine.com/
ceaser slots
Posted at 01:53h, 29 Januaryamerican buffalo slots https://candylandslotmachine.com/
free casino slots games
Posted at 05:05h, 29 Januarylucky slots on facebook https://pennyslotmachines.org/
dragon slots
Posted at 08:32h, 29 Januaryscatter slots topless https://slotmachinesworld.com/
konami slots
Posted at 17:46h, 03 Februarynasty slots https://slotmachinesforum.net/
free slots for pc
Posted at 20:27h, 03 Februaryhollywood slots https://slot-machine-sale.com/
penny slots 4u
Posted at 01:55h, 04 Februarymy konami slots for pc https://beat-slot-machines.com/
slots of montana
Posted at 04:15h, 04 Februaryslots garden casino https://download-slot-machines.com/
triple seven slots free
Posted at 07:46h, 04 Februaryslots free single https://411slotmachine.com/
free spins casino slots
Posted at 12:42h, 04 Februarykanomi slots https://www-slotmachines.com/
fortnite weapon slots
Posted at 13:17h, 04 Februaryceasars free slots https://slotmachinegameinfo.com/
monica crowley dissertation
Posted at 17:46h, 10 Februarydissertation writing service in uk https://buydissertationhelp.com/
writing the doctoral dissertation
Posted at 15:29h, 11 Februarytips for writing dissertation https://dissertationwriting-service.com/
dissertation proposal sample
Posted at 19:04h, 11 Februarybest dissertation writing services https://help-with-dissertations.com/
help writing dissertation proposal
Posted at 21:42h, 11 Februaryapa dissertation format https://mydissertationwritinghelp.com/
dissertation writing services near me
Posted at 03:21h, 12 Februarycheap dissertation help in chicago https://dissertations-writing.org/
dissertation assistance
Posted at 06:47h, 12 Februarydoctoral dissertation writing https://helpon-doctoral-dissertations.net/