One PHP block works, the second doesn’t!
-
I’m using a pod template with lots of fields to render out my posts. In the markup below (taken from my template), the first
<?php echo urlencode( $partner_link_url ); ?>
link works, but the second doesn’t, and I can’t for the life of me work out what the problem is! The outputted HTML markup appears to be valid. Anyone have any ideas!?<?php $pod = pods( 'partner', get_the_id() ); $partner_link_url = $pod->get_field( 'partner_link' ); // call your taxonomy as a pod because when you extend it, it makes it a pod object $mytax = pods( 'partner_category' ); $tax_category = $mytax->field( 'partner_category.name' ); // Get terms for post using typical wordpress terms loop $terms = get_the_terms( $post->ID , 'partner_category' ); // Loop over each item since it's an array foreach ( $terms as $term ) { //do a typical fetch to get your pod fields $mytax->fetch( $term->term_id ); $tax_sidebar_background_colour = $mytax->get_field( 'sidebar_background_colour' ); $tax_icon = $mytax->get_field( 'icon' ); } ?> <div id="partner"> <div class="container"> <div class="row"> [if post_thumbnail_url] <div class="col-lg-12 col-md-12 col-sm-12 col-xs-12"> <h1>SortMyCash {@category_text_for_title} with <img src="{@post_thumbnail_url.medium}" alt="Partner logo - {@page_title}" /></h1> </div> [else] <div class="col-lg-12 col-md-12 col-sm-12 col-xs-12"> <h1><div class="fa <?php echo $tax_icon; ?>"></div> {@page_title}</h1> <p>{@post_content}</p> </div> [/if] </div> </div> <div class="container"> <div class="row"> <div class="col-lg-12 col-md-12 col-sm-12 col-xs-12"><br /></div><!-- SPACER --> </div> </div> <div class="container fullwidth-layout"> <div class="row"> <div class="partner-full-width col-lg-12 mb-4"> <div class="box drop-shadow header-banner" style="background-color:#e2e2e2;"> [vc_row][vc_column width="3/4"][vc_custom_heading text="{@header_banner_title}" font_container="tag:h2|text_align:left|color:%23707070" use_theme_fonts="yes"][vc_empty_space][vc_column_text]{@header_banner_text}[/vc_column_text][/vc_column][vc_column width="1/4"][vc_empty_space height="40px"][vc_btn title="{@header_banner_button_text}" style="3d" color="sky" size="lg" align="center" i_align="right" i_icon_fontawesome="{@header_banner_button_icon}" button_block="true" add_icon="true" link="url:<?php echo urlencode( $partner_link_url ); ?>|target:_blank"][/vc_column][/vc_row] </div> </div> </div> </div> [if fullwidth_layout] <div class="container fullwidth-layout"> <div class="row"> <div class="partner-full-width col-lg-12 mb-4"> <div class="box drop-shadow integration-section" style="background-color:{@integration_section_bgcolour};"> {@integration_section} </div> </div> </div> </div> <div class="container"> <div class="row"> <div class="partner-left col-lg-12"> <div class="box drop-shadow"> <h4 class="body-heading">{@body_heading}</h4> <div class="body-intro-text">{@body_intro_text}</div> <div class="body-main-text">{@body_main_text}</div> <div class="body-signoff-text">{@body_signoff_text}</div> </div> </div> </div> </div> <div class="container"> <div class="row"> <div class="partner-left col-lg-12"> </div> </div> </div> [else] <div class="container"> <div class="row"> <div class="partner-left col-lg-8"> <div class="box drop-shadow"> [if body_heading] <h4 class="body-heading">{@body_heading}</h4> [/if] [if body_intro_text] <div class="body-intro-text">{@body_intro_text}</div> [/if] [if body_main_text] <div class="body-main-text">{@body_main_text}</div> [/if] [if body_signoff_text] <div class="body-signoff-text">{@body_signoff_text}</div> [/if] </div> [if qualifications_text] <div class="qualifications-text">{@qualifications_text}</div> [/if] </div> <div class="partner-right col-lg-4"> [if right_intro_text] <div class="box drop-shadow right-intro-text" style="background-color:{@right_intro_section_bgcolour};margin-bottom:20px;"> {@right_intro_text} </div> [/if] <div class="box drop-shadow" style="background-color:{@integration_section_bgcolour};"> [if right_heading] <h4 class="right-heading">{@right_heading}</h4> [/if] <div class="integration-section"> [vc_empty_space height="10px"] {@integration_section} [if integration_is_clickthrough] [vc_btn title="{@integration_section_button_text}" style="3d" color="sky" size="lg" align="center" i_align="right" i_icon_fontawesome="{@header_banner_button_icon}" button_block="true" add_icon="true" link="url:<?php echo urlencode( $partner_link_url ); ?>|target:_blank"] [else] aaaaa [/if] </div> </div> </div> </div> </div> [/if] </div>
The page I need help with: [log in to see the link]
Viewing 5 replies - 1 through 5 (of 5 total)
Viewing 5 replies - 1 through 5 (of 5 total)
- The topic ‘One PHP block works, the second doesn’t!’ is closed to new replies.