Ask your WordPress questions! Pay money and get answers fast! Comodo Trusted Site Seal
Official PayPal Seal

Edit Single.php WordPress

  • SOLVED

I have been trying to edit a theme and remove all the unwanted scripts. I am having problems with my single.php template:


<?php get_header(); ?>

<div id="content">
<?php

if (have_posts()) :
while (have_posts()) : the_post();

$html_content = get_the_content_with_formatting();
$html_content = reduce_width_height($html_content, 650);
$tags = array("img", "object", "br");
$portfolio_single = get_post_meta(get_the_ID(), "air_portfolio_single", true);
$air_article_navigation = get_post_meta(get_the_ID(), "air_article_navigation", true);

if ($portfolio_single == "yes")
{
$only_text = strip_single_tags($tags, $html_content);

$images = get_all_img_urls($html_content);
$alts = get_all_img_alts($html_content);


$link_text = get_post_meta(get_the_ID(), "air_link-text", true);
if ($link_text == "") $link_text = "View Online &raquo;";
$link_url = get_post_meta(get_the_ID(), "air_link-url", true);
$air_services = get_post_meta(get_the_ID(), "air_services", true);
$services = explode(",",$air_services);
$video_link = get_post_meta(get_the_ID(), "air_video_link", true);
?>

<?php } else { ?>

<div id="sidebar"><?php dynamic_sidebar( 'default' ); ?></div>

<div id="inner-content">
<div class="post-entry">
<div class="post-meta">

<h2 class="title"><?php the_title(); ?></h2>

<span>by </span><?php the_author_link(); ?> <span>on </span><?php the_time('M j, Y') ?><?php if (comments_open()) { ?><span> - </span><?php comments_popup_link('No Comments', '1 Comment', '% Comments'); ?><?php } ?>

</div><!--END post-meta-->

<?php the_content(); ?>

</div><!--END post-entry-->

<?php comments_template(); ?>

</div><!--END inner-content-->

<?php } endwhile; else : ?>
<h2 class="center">Not Found</h2>
<p class="center">Sorry, but you are looking for something that isn't here.</p>
<?php endif; ?>

</div><!--END content-->

</div><!--END wrapper-->

<?php get_footer(); ?>



It breaks everytime I try to remove this part:


$html_content = get_the_content_with_formatting();
$html_content = reduce_width_height($html_content, 650);
$tags = array("img", "object", "br");
$portfolio_single = get_post_meta(get_the_ID(), "air_portfolio_single", true);
$air_article_navigation = get_post_meta(get_the_ID(), "air_article_navigation", true);

if ($portfolio_single == "yes")
{
$only_text = strip_single_tags($tags, $html_content);

$images = get_all_img_urls($html_content);
$alts = get_all_img_alts($html_content);


$link_text = get_post_meta(get_the_ID(), "air_link-text", true);
if ($link_text == "") $link_text = "View Online &raquo;";
$link_url = get_post_meta(get_the_ID(), "air_link-url", true);
$air_services = get_post_meta(get_the_ID(), "air_services", true);
$services = explode(",",$air_services);
$video_link = get_post_meta(get_the_ID(), "air_video_link", true);


Please can someone remove this part and tidy up the template so that it doesn't cause any errors?

Answers (2)

2011-04-19

AdamGold answers:


<?php get_header(); ?>



<div id="content">

<?php



if (have_posts()) :

while (have_posts()) : the_post();


?>


<div id="sidebar"><?php dynamic_sidebar( 'default' ); ?></div>



<div id="inner-content">

<div class="post-entry">

<div class="post-meta">



<h2 class="title"><?php the_title(); ?></h2>



<span>by </span><?php the_author_link(); ?> <span>on </span><?php the_time('M j, Y') ?><?php if (comments_open()) { ?><span> - </span><?php comments_popup_link('No Comments', '1 Comment', '% Comments'); ?><?php } ?>



</div><!--END post-meta-->



<?php the_content(); ?>



</div><!--END post-entry-->



<?php comments_template(); ?>



</div><!--END inner-content-->



<?php endwhile; else : ?>

<h2 class="center">Not Found</h2>

<p class="center">Sorry, but you are looking for something that isn't here.</p>

<?php endif; ?>



</div><!--END content-->



</div><!--END wrapper-->



<?php get_footer(); ?>

2011-04-19

Jens Filipsson answers:

<?php get_header(); ?>

<div id="content">

<?php if (have_posts()) : while (have_posts()) : the_post(); ?>


<div id="sidebar"><?php dynamic_sidebar( 'default' ); ?></div>



<div id="inner-content">

<div class="post-entry">

<div class="post-meta">



<h2 class="title"><?php the_title(); ?></h2>



<span>by </span><?php the_author_link(); ?> <span>on </span><?php the_time('M j, Y') ?><?php if (comments_open()) { ?><span> - </span><?php comments_popup_link('No Comments', '1 Comment', '% Comments'); ?><?php } ?>



</div><!--END post-meta-->



<?php the_content(); ?>



</div><!--END post-entry-->



<?php comments_template(); ?>



</div><!--END inner-content-->



<?php endwhile; else : ?>

<h2 class="center">Not Found</h2>

<p class="center">Sorry, but you are looking for something that isn't here.</p>

<?php endif; ?>



</div><!--END content-->



</div><!--END wrapper-->



<?php get_footer(); ?>