Site logo

Archived topic

Custom Post Headers & Related Posts Footer Showing as broken php scripts

3 replies · Started by Chris on August 9, 2021

Viewing posts 1–4 of 4

Hi folks -

I'm a new user stepping in to assist a coworker who is unavailable for the foreseeable future. Please be kind, I have no idea what I'm doing trying to fix a broken site. I know just enough to be very dangerous, so I'm posting here after many failed attempts to figure out our sites issue.

All of the pages that have custom posts headers are not loading the header. We have the following php loaded to the site via elements:

<div id="custom-post-entry-header" class="custom-post-header grid-container">		
	<?php
	$categories = get_the_category();
	$separator = ' | ';
	$output = '';
	
	if ( ! empty( $categories ) ) {
		foreach( $categories as $category ) {
			$output .= '<a href="' . esc_url( get_category_link( $category->term_id ) ) . '" alt="' . esc_attr( sprintf( __( 'View all posts in %s', 'textdomain' ), $category->name ) ) . '">' . esc_html( $category->name ) . '</a>' . $separator;
		}
		
		echo trim( $output, $separator );
	}
	
	the_title( '<h1 class="entry-title" itemprop="headline">', '</h1>' );

	if ( has_excerpt() ) : // Only show custom excerpts not autoexcerpts ?>
		<p class="entry-subtitle"><?php echo get_the_excerpt(); ?></p>
	<?php endif; ?>
</div>

When a page is viewed part of the script is showing instead of the Post Header. You can see it here: https://nir-for-food.com/alcoholic-beverages/

Any help fixing this would be greatly appreciated.
Thanks!

Hi Leo - Thanks forgetting back to me so quickly. And I understand the limited support.

After Execute PHP I have the following error:

"Unable to execute PHP as DISALLOW_FILE_EDIT is defined."

Any help would be greatly appreciated. Thanks

chris

This archived topic is closed to new replies.