Viewing 8 posts - 1 through 8 (of 8 total)
  • Author
    Posts
  • #428316

    In order to create dynamic content I am using custom post types (blocks) to add my content in. When rendered, each block will be wrapped in a div like so: <div class="ux-block">(post content)</div>

    In this case I am adding a new block with a ‘color section’ element from the advanced layout editor.

    I am displaying the block content by inserting a shortcode [block id="myblock"]. The shortcode loads the post body and outputs to the page. I am inserting the shortcode via a ‘code block’ element and checking ‘Deactivate schema.org markup’ . The problem is, it seems the post content is being processed and wrapped in a load of enfold stuff:

    <div class="container"><div class="template-page content av-content-full alpha units"><div class="post-entry post-entry-type-page post-entry-2"><div class="entry-content-wrapper clearfix"><div class="ux_block ">(no content here)</div></div></div><!-- close content main div --></div></div>

    Also, the actual post content has been moved out of the wrapper – where I have wrote (no content here) above, the content as below is missing:
    <div id="av_section_1" class="avia-section main_color avia-section-default avia-no-shadow avia-bg-style-scroll container_wrap fullsize" style="background-color: #282828; ">......</div>

    Could it be that when my block plugin is returning the post content, enfold is wrapping the content? If so, how can I return the raw post content.

    Could it be something else?

    #429054

    Hi notjusttravel!

    Are you echoing the content? If so then try returning it instead.

    It’s bordering on custom work but paste the code your using here and we’ll take a look.

    Regards,
    Elliott

    • This reply was modified 10 years, 2 months ago by Elliott.
    #429068

    Hey, 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');
    #429775

    Hey!

    Does it work in the default editor?

    Regards,
    Elliott

    #429787

    I 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, 2 months ago by notjusttravel.
    #430390

    Hi!

    Our fullwidth elements such as color sections are going to break the HTML and create their own. This is necessary for them to play nice with sidebars.

    For what your trying to do I don’t think using color sections or other full width elements is going to work.

    Cheers!
    Elliott

    #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, 2 months ago by notjusttravel.
    #431025

    Hey!

    What if you use the code block element then enclose the html codes inside a pre or code tag? Can you please provide a screenshot of how you want to the page or section to look like?

    Regards,
    Ismael

Viewing 8 posts - 1 through 8 (of 8 total)
  • You must be logged in to reply to this topic.