Forum Replies Created
-
AuthorPosts
-
April 17, 2015 at 4:44 pm in reply to: Site content in custom post type 'Block' & using Shortcode to display on page. #430394
I understand that. What I want to do is insert raw code into a page. The ‘code block’ doesnt seem to do this.
If I was able to insert raw html in the advanced layout editor then there wouldnt be a problem. All of the available elements get processed someway or another.
-
This reply was modified 10 years, 3 months ago by
notjusttravel.
April 16, 2015 at 6:14 pm in reply to: Site content in custom post type 'Block' & using Shortcode to display on page. #429787I am using the Advanced layout editor in the Block post. If I insert the block content into a blank new page using the default editor the problem still exists.
In the block body I added a simple ‘Color section’ containing a ”Special Heading’ from the advanced layout editor. That is it. I have the created a new blank page and insert the shortcode: [block id=”test”]
Here is the output on the page. You can see how the ‘Color Section’ (id=av_section_1) has been pulled out of the <div class=”ux_block”> wrapper.
<div id="main" data-scroll-offset="116"> <div class="container_wrap container_wrap_first main_color fullsize"> <div class="container"> <main class="template-page content av-content-full alpha units" role="main" itemprop="mainContentOfPage"> <article class="post-entry post-entry-type-page post-entry-431" itemscope="itemscope" itemtype="https://schema.org/CreativeWork"> <div class="entry-content-wrapper clearfix"> <header class="entry-content-header"></header> <div class="entry-content" itemprop="text"> <div class="ux_block"> <a class="edit-link" href="(edit link goes here)">Edit Block</a> </div> </div> </div><!-- close content main div --> </article> </main> </div> </div> <div id="av_section_1" class="avia-section main_color avia-section-default avia-no-shadow avia-bg-style-scroll container_wrap fullsize"> <div class="container"> <div class="template-page content av-content-full alpha units"> <div class="post-entry post-entry-type-page post-entry-431"> <div class="entry-content-wrapper clearfix"> <div style="padding-bottom:10px;" class="av-special-heading av-special-heading-h3 "> <h3 class="av-special-heading-tag" itemprop="headline">Testing</h3> <div class="special-heading-border"> <div class="special-heading-inner-border"> </div> </div> </div> </div> </div> <footer class="entry-footer"></footer> </div><!--end post-entry--><!--end content--> </div><!--end container--> </div><!-- close default .container_wrap element -->
-
This reply was modified 10 years, 3 months ago by
notjusttravel.
April 15, 2015 at 5:12 pm in reply to: Site content in custom post type 'Block' & using Shortcode to display on page. #429068Hey, the shortcode code I am using to display the post content is below:
function block_shortcode($atts, $content = null) { extract( shortcode_atts( array( 'id' => '' ), $atts ) ); // get content by slug global $wpdb; $post_id = $wpdb->get_var("SELECT ID FROM $wpdb->posts WHERE post_name = '$id'"); if($post_id){ $html = get_post_field('post_content', $post_id, 'raw'); $customCSS = get_post_meta($post_id, 'custom_css_add', true); // add edit link for admins if (current_user_can('edit_posts')) { $edit_link = get_edit_post_link( $post_id ); $html = '<div class="ux_block"><a class="edit-link" href="'.$edit_link.'">Edit Block</a>'.$html.'</div>'; } if($customCSS != null) { $html = '<div class="'.$customCSS.'">'.$html.'</div>'; } $html = do_shortcode( $html ); } else{ $html = '<p><mark>UX Block <b>"'.$id.'"</b> not found! Wrong ID?</mark></p>'; } return $html; } add_shortcode('block', 'block_shortcode');
Thanks. I had to change it slightly though as this code also affected the mobile menu
#avia-menu li#menu-item-79 ul.sub-menu { left: -150px; }
-
This reply was modified 10 years, 3 months ago by
-
AuthorPosts