Jump to content

Archived

This topic is now archived and is closed to further replies.

glennyboy

Cannot echo pp-section-pad

Recommended Posts

glennyboy

Hi

 

This is perplexing me.

 

I cannot output 'pp-section-pad' as a class in any php. I know that hyphens are not allowed/written as a minus, but when writing a class I don't see why this would be a problem. The following code for example outputs a only empty <div></div>

 

<?php if(get_field('custom_column_1')){?>
<div class="pl-section-pad fix"><?php echo $content; ?></div>
 <?php } else { ?>
<!-- do nothing -->
<?php } ?>

I noted exactly the same behaviour in PLNext Box by Simon_P. The padding class does not echo. Perhaps DMS itself is stopping the echo?

 

Interested for input.

 

Glennyboy

 

 

 

Share this post


Link to post
Share on other sites
Simon

where are you putting that code?

You really dont need to open and close php tags on every line, thats a bad habit and makes your code really hard to read and harder to debug.

Also you dont need the else if there is nothing to do in that else.
 

$content = 'bannana';
if( $content ) {
printf( '<div class="pl-section-pad fix">%s</div>', $content );
}

OUTPUT

<div class="pl-section-pad fix">bannana</div>

Share this post


Link to post
Share on other sites
glennyboy

Hi Simon_P

 

I use PHP a fair bit, but I'm no expert and am learning all the time :-) I find this echo format an easier way of outputting large blocks of formatted  HTML though.

 

Anyway even with printf the class still doesn't output. All I get is the same as before:-

<div class>

I don't know why but if I use a class with 2 hyphens it outputs fine, but 3 simply doesn't work.

 

Here is a full output of my code. What it does is use custom repeater fields to output a repeater of Pagelines column blocks so it's more dynamic from the Wordpress Admin end:-

<?php if( have_rows('custom_column_repeater') ): ?>
 
<div class="row grid-row">
 
	<?php while( have_rows('custom_column_repeater') ): the_row(); 
 
		// vars
		$content = get_sub_field('custom_column_repeater_content');
		$span = get_sub_field('custom_column_repeater_span');
		$pad = get_sub_field('custom_column_repeater_span');
		?>
 
<section data-object="PLColumn" data-sid="plcolumn" class="pl-section span<?php echo $span; ?> offset0 force-start-row pl-bg-cover section-plcolumn" style="">
<div class="pl-section-pad fix">		
<div class="pl-sortable-column pl-sortable-area editor-row ">
<div class="row grid-row">
<section class="pl-section span12 offset0 pl-bg-cover section-pl-nextbox">
<?php //echo '<div class="mysection-pad fix">' . $content . '</div>';?>	
<?php if( $content ) {
printf( '<div class="pl-section-pad fix">%s</div>', $content );
} ?>
</section>
</div>			
<span class="pl-column-forcer"></span>
</div>
</div>
</section>
 
<?php endwhile; ?>
 
</div>
 
<?php endif;?>

You'll see that I've echoed out the line above your replaced code that uses an alternate class 'mysection-pad' which added in the same padding classes as 'pp-section-pad'.

 

If you want to update my less succinct code please feel free.

 

Thanks

Glennyboy

Share this post


Link to post
Share on other sites

  • Similar Content

    • Lisa Haran
      By Lisa Haran+
      Hi 
      I have a map here http://www.iloveoffset.com/maps/
      I want to add several pointer locations to the map, but when I do they do not appear.
      On this map there are 2 pointer locations and as you can there is only one visible.
      Earlier today I added 7 and could only see 4 so there is something odd going on.
      My theme is up to date
    • clj182
      By clj182+
      Hello,
      I've been having trouble unlocking the template section for past couple of weeks. When I try clicking nothing happens. 
      I've deleted my custom css and removed plugins. Im down to having only the following plugins:
      Akismet
      Contact Form 7
      DMS Professional Tools
      Pagelines Updater
      WooCommerce
      It was working fine before i have no idea what's going on with it.
    • flourishdesignstudio
      By flourishdesignstudio+
      My DMS 2 site http://www.heart-stone.com/ will not save any new custom css... I can still edit templates and publish those but any custom css that I enter never saves.
      All WP files, themes, and plugins are up to date. 
      Any thought about what might be causing this?
    • flourishdesignstudio
      By flourishdesignstudio+
      Is there a way to edit the custom CSS via FTP? I know I can edit the custom code in the Chrome editor but is there a file path I can use to find and edit the CSS directly from our FTP?
      Thanks in advance for the help!
    • nizami
      By nizami+
      Using navbar section with correctly configured WP menu to display main navigation at https://elenaangel.com. 
      All fine in desktop viewport. Menu displays twice in hamburger mode. How to fix this please? 

×