debug eroor | WordPress.org

Hi,

Looks like the IF condition syntax is incorrect in /wp-content/themes/moderne/single.php file that is triggering the error. If you have a backup of the file, try restoring it or fix the IF condition syntax near to the line number 26.

I don’t know how to…I have no knowledge of programming @emmtoor i am posting the code pls help

  • This reply was modified 4 days ago by oshin99.


<?php
/**
 * The template for displaying all single posts
 *
 * @link https://developer.wordpress.org/themes/basics/template-hierarchy/#single-post
 *
 * @package Moderne
 */

$singlelayout = get_theme_mod( 'moderne_single_layout', 'single1' ); 
get_header(); 
?>
	
	<?php // single with featured image above title
	if ( $singlelayout == 'single4')  : ?>

		<div id="primary" class="content-area col-lg-12">
			<main id="main" class="site-main <?php echo esc_attr($singlelayout); ?>"><?php get_template_part( 'template-parts/post/content', 'single2' ); ?></main>
		</div>
		
	<?php // single no sidebars and featured image below title
	elseif ( $singlelayout == 'single3')  : ?>

<?php
			
		 <div id="primary" class="content-area col-lg-12">
			<main id="main" class="site-main <?php echo esc_attr($singlelayout); ?>"><?php get_template_part( 'template-parts/post/content', 'single' ); ?></main> 
		</div>
		<?php // single left sidebar and featured image below title
	elseif ( $singlelayout == 'single2')  : ?>

		<div id="primary" class="content-area col-lg-8 order-lg-2">
			<main id="main" class="site-main <?php echo esc_attr($singlelayout); ?>"><?php get_template_part( 'template-parts/post/content', 'single' ); ?></main>
		</div>
		<div class="col-lg-4 order-3 order-lg-1">
			<?php get_template_part( 'template-parts/sidebars/sidebar', 'left' ); ?>       
		</div>	
		
	<?php // single right sidebar and featured image below title
	else : ?>

		<div id="primary" class="content-area col-lg-8">
			<main id="main" class="site-main <?php echo esc_attr($singlelayout); ?>">
			<?php get_template_part( 'template-parts/post/content', 'single' ); ?></main>
		</div>
		
		<div class="col-lg-4">
		<?php get_template_part( 'template-parts/sidebars/sidebar', 'right' ); ?>
		</div>
		
	<?php endif; ?>

<?php
get_footer();
  • This reply was modified 3 days, 23 hours ago by Yui.

I see that <?php tag on line 24 is not required. Try replacing the code with the following:

<?php
/**
* The template for displaying all single posts
*
* @link https://developer.wordpress.org/themes/basics/template-hierarchy/#single-post
*
* @package Moderne
*/

$singlelayout = get_theme_mod( ‘moderne_single_layout’, ‘single1’ );
get_header();
?>

<?php // single with featured image above title
if ( $singlelayout == ‘single4’) : ?>

<div id=”primary” class=”content-area col-lg-12″>
<main id=”main” class=”site-main <?php echo esc_attr($singlelayout); ?>”><?php get_template_part( ‘template-parts/post/content’, ‘single2’ ); ?></main>
</div>

<?php // single no sidebars and featured image below title
elseif ( $singlelayout == ‘single3’) : ?>

<div id=”primary” class=”content-area col-lg-12″>
<main id=”main” class=”site-main <?php echo esc_attr($singlelayout); ?>”><?php get_template_part( ‘template-parts/post/content’, ‘single’ ); ?></main>
</div>
<?php // single left sidebar and featured image below title
elseif ( $singlelayout == ‘single2’) : ?>

<div id=”primary” class=”content-area col-lg-8 order-lg-2″>
<main id=”main” class=”site-main <?php echo esc_attr($singlelayout); ?>”><?php get_template_part( ‘template-parts/post/content’, ‘single’ ); ?></main>
</div>
<div class=”col-lg-4 order-3 order-lg-1″>
<?php get_template_part( ‘template-parts/sidebars/sidebar’, ‘left’ ); ?>
</div>

<?php // single right sidebar and featured image below title
else : ?>

<div id=”primary” class=”content-area col-lg-8″>
<main id=”main” class=”site-main <?php echo esc_attr($singlelayout); ?>”>
<?php get_template_part( ‘template-parts/post/content’, ‘single’ ); ?></main>
</div>

<div class=”col-lg-4″>
<?php get_template_part( ‘template-parts/sidebars/sidebar’, ‘right’ ); ?>
</div>

<?php endif; ?>

<?php
get_footer();

omg! That’s such a trivial blunder. Thanks a lot. its been solved @emmtoor



Source link