Skip to main content
deleted 84 characters in body
Source Link
fuxia
  • 107.1k
  • 38
  • 255
  • 459

folks-

A (probably) silly question from me today--I'veI've got a shortcode that's got HTML in an $output field that's lovely. I just want to add one paragraph to it at the bottom that's conditional on this statement:

But since I'm a relative newb, I can't quite figure out how to format a statement like that (if possible) into an existing $output field.

folks-

A (probably) silly question from me today--I've got a shortcode that's got HTML in an $output field that's lovely. I just want to add one paragraph to it at the bottom that's conditional on this statement:

But since I'm a relative newb, I can't quite figure out how to format a statement like that (if possible) into an existing $output field.

I've got a shortcode that's got HTML in an $output field that's lovely. I just want to add one paragraph to it at the bottom that's conditional on this statement:

I can't quite figure out how to format a statement like that (if possible) into an existing $output field.

Source Link

How to make a conditional statement within $output in shortcodes.php?

folks-

A (probably) silly question from me today--I've got a shortcode that's got HTML in an $output field that's lovely. I just want to add one paragraph to it at the bottom that's conditional on this statement:

<?php if ( get_post_meta( get_the_ID(), 'campus', true ) ) : ?> 

But since I'm a relative newb, I can't quite figure out how to format a statement like that (if possible) into an existing $output field.

Here's what the $output looks like at present, I want to add this condition on line 8 and basically have another paragraph tag with some content there that shows there only if the statement is true:

'<div class="w-blog-entry" style="padding:0;">
                                <div class="w-blog-entry-h">
                                <div class="l-subsection color_dark" style="background-image: url('.$the_thumbnail.'); background-position: center center; padding-top:0; padding-bottom:0; background-attachment: inherit;">
                                <div class="l-subsection-h">
                                    <div class="l-subsection-hh g-html i-cf" style="font-family:Century Gothic; text-shadow: 0px 2px 2px rgba(0, 0, 0, 0.3);">
                                        <a class="w-blog-entry-link" href="'.get_permalink(get_the_ID()).'"><h2 class="w-blog-entry-title" style="line-height:1em; margin-left:0; padding-left:4px; font-size:20px;"><span class="w-blog-entry-title-h" style="color:#fff;">'.get_post_meta( get_the_ID(), 'destination', true ).'<br><span style="font-size:0.6em; color:#f2f2f2;">'.get_post_meta( get_the_ID(), 'depart', true ).' <span style="text-transform: lowercase; font-size:0.8em;">to</span> '.get_post_meta( get_the_ID(), 'return', true ).'</span></span></h2></a>
                                        <p style="line-height:1.2em; padding-left:4px; font-size:0.9em;">'.get_post_meta( get_the_ID(), 'projectdesc', true ).'</p>                                      
                                    </div>
                                </div>
                            </div>
                                
                            </div>';
    }

    $output .=          '</div>
                    </div>
                </div>'

Is this possible, or do I have to make a whole other condition to the shortcode with two outputs?

Let me know if you need more context from the shortcode, I just didn't want to waste too much space if my original goal is possible.