Wordpress Comments Section Not Showing - php

I'm at a loss to for a solution to my comments section not showing on my single post page. I've noticed that this page is not displaying any of the code below the post and tags sections. Would someone be willing to look at the code in the admin for me? I imagine it could be something simple to identify, as the site is organized nicely.
This is the only way I think the problem could be solved.
UPDATE UPDATE UPDATE. Here's Single.php
<?php get_header(); ?>
<?php include ('page_header.php'); ?>
<?php include ('page_navigation.php'); ?>
<div id="page-content" class="clearfix">
<div id="content-container" class="clearfix">
<div id="main-content">
<?php if (have_posts()) : while (have_posts()) : the_post(); ?>
<?php if ( get_option('minimax_post_layout') == 'head-three' ) { ?>
<h2><?php the_title(); ?><em>Posted on <?php the_time('D, M d, Y') ?></em></h2>
<?php if ( has_post_thumbnail() ) { ?>
<div class="post-item-thumb-<?php echo get_option('minimax_post_layout'); ?>">
<?php the_post_thumbnail('thumb_post_3'); ?>
</div>
<?php } ?>
<?php } else { ?>
<?php if ( has_post_thumbnail() ) { ?>
<div class="post-item-thumb-<?php echo get_option('minimax_post_layout'); ?>">
<?php the_post_thumbnail('thumb_post_2'); ?>
</div>
<?php } ?>
<h2><?php the_title(); ?><em>Posted on <?php the_time('D, M d, Y') ?></em></h2>
<?php } ?>
<?php the_content(); ?>
<?php edit_post_link('Edit', '<br /><p>', '</p>'); ?>
<?php include ('post_related.php'); ?>
<div id="post-indexing"> <?php the_tags('<strong>Tagged as</strong> ',', ','+'); ?><br /><strong>Categorized as</strong> <?php the_category(', ','single'); ?></div>
<?php include ('post_author.php'); ?>
<?php comments_template(); ?>
<?php endwhile; else: ?>
<p><?php _e('Sorry, no pages matched your criteria.'); ?></p>
<?php endif; ?>
</div><!-- end main-content -->
<?php include ('sidebar_post.php'); ?>
</div><!-- end content-container -->
<?php include ('footer_columns_posts.php'); ?>
</div><!-- end page-content -->
<?php get_footer(); ?>
Also, here's the comments.php page:
<div id="comments">
<?php // Do not delete these lines
if (!empty($_SERVER['SCRIPT_FILENAME']) && 'comments.php' == basename($_SERVER['SCRIPT_FILENAME']))
die ('Please do not load this page directly. Thanks!');
if (!empty($post->post_password)) { // if there's a password
if ($_COOKIE['wp-postpass_' . COOKIEHASH] != $post->post_password) { // and it doesn't match the cookie
?>
<p class="nocomments">This post is password protected. Enter the password to view comments.</p>
<?php
return;
}
}
/* This variable is for alternating comment background */
$oddcomment = 'class="alt" ';
?>
<!-- You can start editing here. -->
<?php if ($comments) : ?>
<h2>Comments <span>(<?php comments_number('No Responses', 'One Response', '% Responses' );?
>)</span></h2>
<ul class="commentlist">
<?php wp_list_comments('avatar_size=60&type=comment'); ?>
</ul>
<?php else : // this is displayed if there are no comments so far ?>
<?php if ('open' == $post->comment_status) : ?>
<!-- If comments are open, but there are no comments. -->
<?php else : // comments are closed ?>
<!-- If comments are closed. -->
<?php endif; ?>
<?php endif; ?>
<?php if ('open' == $post->comment_status) : ?>
<div id="respond">
<h3><?php comment_form_title( 'Leave a Reply', 'Leave a Reply to %s' ); ?></h3>
<div class="cancel-comment-reply">
<?php cancel_comment_reply_link(); ?>
</div>
<?php if ( get_option('comment_registration') && !$user_ID ) : ?>
<p>You must be <a href="<?php echo get_option('siteurl'); ?>/wp-login.php?redirect_to=<?php echo
urlencode(get_permalink()); ?>">logged in</a> to post a comment.</p>
<?php else : ?>
<div id="post-comment" class="clearfix">
<form action="<?php echo get_option('siteurl'); ?>/wp-comments-post.php" method="post"
id="commentform">
<fieldset>
<?php if ( $user_ID ) : ?>
<p>Logged in as <a href="<?php echo get_option('siteurl'); ?>/wp-admin/profile.php"><?php echo
$user_identity; ?></a>. <a href="<?php echo get_option('siteurl'); ?>/wp-login.php?
action=logout" title="Log out of this account">Log out »</a></p>
<?php else : ?>
<label for="author"><?php if ($req) echo "* "; ?>Your name:</label>
<input type="text" name="author" id="author" value="<?php echo $comment_author; ?>" size="22"
tabindex="1" />
<label for="email"><?php if ($req) echo "* "; ?>Mail (will not be published):</label>
<input type="text" name="email" id="email" value="<?php echo $comment_author_email; ?>"
size="22" tabindex="2" />
<label for="url">Website</label>
<input type="text" name="url" id="url" value="<?php echo $comment_author_url; ?>" size="22"
tabindex="3" />
<?php endif; ?>
<!--<p><small><strong>XHTML:</strong> You can use these tags: <code><?php echo allowed_tags(); ?
></code></small></p>-->
<label for="comment" class="comment">Your comment:</label>
<textarea name="comment" id="comment" class="comment" cols="61%" rows="10"
tabindex="4"></textarea>
<input name="submit" type="submit" class="submit" alt="Submit Comment" id="submit" tabindex="5"
value="Submit Comment" />
<input type="hidden" class="hide" name="comment_post_ID" value="<?php echo $id; ?>" />
<?php comment_id_fields(); ?>
<?php do_action('comment_form', $post->ID); ?>
</fieldset>
</form>
</div><!-- end post-comment -->
</div>
<?php endif; // If registration required and not logged in ?>
<?php endif; // if you delete this the sky will fall on your head ?>
</div>
Here is post_author.php
<?php if ( get_option('minimax_author') == 'yes' ) { ?>
<div id="author-desc" class="clearfix">
<?php the_author_image(); ?>
<h4>About the Author</h4>
<?php the_author_description(); ?>
</div>
<?php } ?>

There isn't any function like the_author_image() in Wordpress. So, you have to remove
<?php the_author_image(); ?>
line from your post_author.php. If you want to show author image , Wordpress getting avatars from Gravatar. You can use get_avatar() to display author's Gravatar.
echo get_avatar(get_the_author_id());
In shortly, use this :
<?php echo get_avatar(get_the_author_id()); ?>
instead of this :
<?php the_author_image(); ?>

Related

splitting the paragraph into 2 sections in wordpress

I'm building a property section in WordPress that leaves me with a long and excruciating list of information when the code draws the data. This list should be divided into 2 sections to save more space on the page when on desktops, etc.
<a name="rooms"></a>
<h3><?php echo __("Property Details", "wppf"); ?></h3>
<?php foreach ($paragraphs as $paragraph) : ?>
<div class="clearfix">
<?php if ($paragraph['name'] != '') : ?>
<h4><?php echo $paragraph['name'] ?></h4>
<?php endif; ?>
<?php if ($paragraph['filesortorder'] != '') : ?>
<?php echo ($paragraph['filesortorder']); ?>
<?php endif; ?>
<p>
<?php if ($paragraph['dimensions'] != "") : ?>
<em><?php echo $paragraph['dimensions'] ?></em>
<br />
<?php endif; ?>
<?php echo $paragraph['description'] ?>
</p>
</div>
<?php endforeach; ?>
<?php foreach ($links as $link) : ?>
<div class="clearfix">
<a href="<?php echo $link['url']; ?>" target="_blank">
<?php echo (empty($link['name'])) ? $link['url'] : $link['name']; ?>
</a>
</div>
<?php endforeach; ?>
There is a maximum of 10 sections that it fills in and I want to split that into 2 groups of 5.
Something like...
if(count($paragraphs) > 5) {
$paragraphs2 = array_splice($paragraphs, 5);
}
Would let you split the paragraphs > 5 into another array.
You'd then just need to output those in your code as you see fit - something like:
<?php foreach ($paragraphs2 as $paragraph2) :?>
<div class="clearfix">
<?php if ($paragraph2['name']!=''):?>
<h4>
<?php echo $paragraph2['name'] ?>
</h4>
<?php endif; ?>
<?php if ($paragraph2['filesortorder']!=''):?>
<?php echo ($paragraph2['filesortorder']); ?>
<?php endif; ?>
<p>
<?php if ($paragraph2['dimensions']!=""):?>
<em>
<?php echo $paragraph2['dimensions'] ?>
</em>
<br />
<?php endif;?>
<?php echo $paragraph2['description'] ?>
</p>
</div>
<?php endforeach;?>
Should get you started to loop through and repeat the relevant display code.

How to show k2 items in k2 content module in 3 columns?

Joomla k2 component is power Joomla content system. k2 has a module that's called k2 content module and you can override the layout template of it.
I had this code for my k2 content module, this template file shows k2 items in 2 columns with even and odd classes and extra fields in it.
<?php
// no direct access
defined('_JEXEC') or die;
// includes placehold
$yt_temp = JFactory::getApplication()->getTemplate();
include (JPATH_BASE . '/templates/'.$yt_temp.'/includes/placehold.php');
?>
<div id="k2ModuleBox<?php echo $module->id; ?>" class="k2ItemsBlock<?php
if($params->get('moduleclass_sfx')) echo ' '.$params-
>get('moduleclass_sfx'); ?>">
<?php if($params->get('itemPreText')): ?>
<p class="modulePretext"><?php echo $params->get('itemPreText'); ?></p>
<?php endif; ?>
<?php if(count($items)): ?>
<ul class="product">
<?php foreach ($items as $key=>$item): ?>
<li class="<?php echo ($key%2) ? "odd" : "even"; if(count($items)==$key+1)
echo ' lastItem'; ?>">
<?php if($params->get('itemImage') || $params->get('itemIntroText')): ?>
<?php if($params->get('itemImage')): ?>
<div class="product-image">
<img src="<?php echo $item->image; ?>" alt="<?php echo
K2HelperUtilities::cleanHtml($item->title); ?>" />
</div>
<?php endif; ?>
<div class="main">
<?php if($params->get('itemTitle')): ?>
<p class="moduleItemTitle"><?php echo $item->title; ?></p>
<?php endif; ?>
<?php if($params->get('itemIntroText')): ?>
<div class="introtext">
<?php echo $item->introtext; ?>
</div>
<?php endif; ?>
<!-- end main-->
<?php if($params->get('itemExtraFields') && count($item->extra_fields)): ?
>
<div class="moduleItemExtraFields-energi">
<ul>
<?php foreach ($item->extra_fields as $extraField): ?>
<?php if($extraField->value != ''): ?>
<li class="type<?php echo ucfirst($extraField->type); ?>
group2">
<?php if($extraField->type == 'header'): ?>
<h4 class="moduleItemExtraFieldsHeader"><?php echo
$extraField->name; ?></h4>
<?php else: ?>
<span class="moduleItemExtraFieldsLabel"><?php echo
$extraField->name; ?></span>
<span class="moduleItemExtraFieldsValue"><?php echo
$extraField->value; ?></span>
<?php endif; ?>
<div class="clr"></div>
</li>
<?php endif; ?>
<?php endforeach; ?>
</ul>
</div>
<?php endif; ?>
</div>
<?php endif; ?>
<div class="clr"></div>
</li>
<?php endforeach; ?>
<li class="clearList"></li>
</ul>
<?php endif; ?>
</div>
I would like to show my articles in 3 columns with extra fields.
How to do this? If it's possible, help me to do it.
Thanks for your attention.

Joomla! Need to make linkable banner images with Camera Slideshow

Need to make linkable images with Camera Slideshow. url must be received from Url_A in material.
in _item.php
<div class="camera-item" data-src="<?php echo htmlspecialchars($images->image_intro); ?>">
I tried to do
<?php $urls = json_decode($item->urls); ?>
<a href="<?php echo $urls->urla;?>">
<div class="camera-item" data-src="<?php echo htmlspecialchars($images->image_intro); ?>">
</div></a>
but got error. Help to novice please! and sorry for bad english :)
21.08
Full code of _item.php with some changes
<?php
defined('_JEXEC') or die;
$images = json_decode($item->images);
$urls = json_decode($item->urls);
$slider_img = htmlspecialchars($images->image_intro);
?>
<div class="camera-item" rel="<?php echo $urls->urla;?>" data-src="<? echo $slider_img; ?>">
<?php if ($params->get('show_caption')): ?>
<div class="camera_caption <?php echo $params->get('captionEffect'); ?>">
<?php $item_heading = $params->get('item_heading', 'h4'); ?>
<?php if ($params->get('item_title')) : ?>
<<?php echo $item_heading; ?> class="slide-title<?php echo $params->get('moduleclass_sfx'); ?>">
<?php if ($params->get('link_titles') && $item->link != '') : ?>
<a href="<?php echo $item->link;?>">
<?php echo $item->title;?></a>
<?php else : ?>
<?php echo $item->title; ?>
<?php endif; ?>
</<?php echo $item_heading; ?>>
<?php endif; ?>
<?php if (!$params->get('intro_only')) :
echo $item->afterDisplayTitle;
endif; ?>
<?php echo $item->beforeDisplayContent; ?>
<?php echo $item->introtext; ?>
<?php if (isset($item->link) && $item->readmore != 0 && $params->get('readmore')) :
echo '<a class="readmore" href="'.$item->link.'">'.$item->linkText.'</a>';
endif; ?>
</div>
<?php endif; ?>
</div>
I got url to atribute rel but still can't make clickable images :(
In firebug
<div id="camera-slideshow" class="camera_wrap" style="height: 755px;">
<div class="camera_fakehover">
<div class="camera_src camerastarted camerasliding">
<div class="camera-item" data-src="images/slide1.jpg" rel="/index.php/urla"> </div>
<div class="camera-item" data-src="images/slide2.jpg" rel="/index.php/urla"> </div>
<div class="camera-item" data-src="images/slide3.jpg" rel=""> </div>
</div>
source code
<div class="camera-item" rel="/index.php/urla" data-src="images/slide1.jpg">
<div class="camera_caption fadeIn">
<div class="txt1">some text</div>
<div class="txt2">some text</div>
</div>
</div>

Request password on file_download with Advanced Custom Fields

So what I want is to request a password when downloading files that are dynamically uploaded via wordPress-plugin Advanced Custom Fields.
I can't get it working, and here's my code:
html:
<div class="documentWrap">
<?php while ( have_posts() ) : the_post(); ?>
<?php get_template_part( 'content', 'page'); ?>
<?php if(get_field('dokumentgrupp')): ?>
<?php while(has_sub_field('dokumentgrupp')): ?>
<div class="docGroup clearfix">
<h2><?php the_sub_field('gruppnamn'); ?></h2>
<?php if(get_sub_field('filer')): ?>
<?php while(has_sub_field('filer')): ?>
<ul>
<li>
<h3><?php the_sub_field('filnamn'); ?></h3>
ladda ner
<!div id="passWrap">
<div id="passBox">
<?php // if( get_field('password') ): ?>
<form method="post">
<input name="pass" type="password" action="download_pw.php">
<input type="submit" name="submit" value="ladda ner">
</form>
</div>
<?php //endif; ?>
</div>
</li>
</ul>
<?php endwhile; ?>
<?php endif; ?>
</div>
<?php endwhile; ?>
<?php endif; ?>
</div>
<?php endwhile; ?>
</div>
download_pw.php:
<?php
$pw = md5($_POST['pass']);
$valid_pw = md5(get_sub_field('password'););
$file_url = get_sub_field("fil_url");
if {$pw != $valid_pw) {
echo 'Tyvärr har du inte tillgång till denna fil';
}else{
header('Location: $file_url');
}
?>
If you are using this HTML on the front end, how about just using the built in password protection on the page/post showing the file?
Wordpress Codex: Using Password Protection
If that's not an option, how about trying something like this: https://wordpress.stackexchange.com/questions/37144/how-to-protect-uploads-if-user-is-not-logged-in

Change Layout of Joomla article list with custom php

Having spent a few days banging my head against a brick wall with this I need some help. I basically want to change the code here:
<div class="itemList">
<?php if(isset($this->leading) && count($this->leading)): ?>
<!-- Leading items -->
<div id="itemListLeading">
<?php foreach($this->leading as $key=>$item): ?>
<?php
// Define a CSS class for the last container on each row
if( (($key+1)%($this->params->get('num_leading_columns'))==0) || count($this->leading)<$this->params->get('num_leading_columns') )
$lastContainer= ' itemContainerLast';
else
$lastContainer='';
?>
<div class="itemContainer<?php echo $lastContainer; ?>"<?php echo (count($this->leading)==1) ? '' : ' style="width:'.number_format(100/$this->params->get('num_leading_columns'), 1).'%;"'; ?>>
<?php
// Load category_item.php by default
$this->item=$item;
echo $this->loadTemplate('item');
?>
</div>
<?php if(($key+1)%($this->params->get('num_leading_columns'))==0): ?>
<div class="clr"></div>
<?php endif; ?>
<?php endforeach; ?>
<div class="clr"></div>
</div>
<?php endif; ?>
<?php if(isset($this->primary) && count($this->primary)): ?>
<!-- Primary items -->
<div id="itemListPrimary">
<?php foreach($this->primary as $key=>$item): ?>
<?php
// Define a CSS class for the last container on each row
if( (($key+1)%($this->params->get('num_primary_columns'))==0) || count($this->primary)<$this->params->get('num_primary_columns') )
$lastContainer= ' itemContainerLast';
else
$lastContainer='';
?>
<div class="itemContainer<?php echo $lastContainer; ?>"<?php echo (count($this->primary)==1) ? '' : ' style="width:'.number_format(100/$this->params->get('num_primary_columns'), 1).'%;"'; ?>>
<?php
// Load category_item.php by default
$this->item=$item;
echo $this->loadTemplate('item');
?>
</div>
<?php if(($key+1)%($this->params->get('num_primary_columns'))==0): ?>
<div class="clr"></div>
<?php endif; ?>
<?php endforeach; ?>
<div class="clr"></div>
</div>
<?php endif; ?>
<?php if(isset($this->secondary) && count($this->secondary)): ?>
<!-- Secondary items -->
<div id="itemListSecondary">
<?php foreach($this->secondary as $key=>$item): ?>
<?php
// Define a CSS class for the last container on each row
if( (($key+1)%($this->params->get('num_secondary_columns'))==0) || count($this->secondary)<$this->params->get('num_secondary_columns') )
$lastContainer= ' itemContainerLast';
else
$lastContainer='';
?>
<div class="itemContainer<?php echo $lastContainer; ?>"<?php echo (count($this->secondary)==1) ? '' : ' style="width:'.number_format(100/$this->params->get('num_secondary_columns'), 1).'%;"'; ?>>
<?php
// Load category_item.php by default
$this->item=$item;
echo $this->loadTemplate('item');
?>
</div>
<?php if(($key+1)%($this->params->get('num_secondary_columns'))==0): ?>
<div class="clr"></div>
<?php endif; ?>
<?php endforeach; ?>
<div class="clr"></div>
</div>
<?php endif; ?>
<?php if(isset($this->links) && count($this->links)): ?>
<!-- Link items -->
<div id="itemListLinks">
<h4><?php echo JText::_('K2_MORE'); ?></h4>
<?php foreach($this->links as $key=>$item): ?>
<?php
// Define a CSS class for the last container on each row
if( (($key+1)%($this->params->get('num_links_columns'))==0) || count($this->links)<$this->params->get('num_links_columns') )
$lastContainer= ' itemContainerLast';
else
$lastContainer='';
?>
<div class="itemContainer<?php echo $lastContainer; ?>"<?php echo (count($this->links)==1) ? '' : ' style="width:'.number_format(100/$this->params->get('num_links_columns'), 1).'%;"'; ?>>
<?php
// Load category_item_links.php by default
$this->item=$item;
echo $this->loadTemplate('item_links');
?>
</div>
<?php if(($key+1)%($this->params->get('num_links_columns'))==0): ?>
<div class="clr"></div>
<?php endif; ?>
<?php endforeach; ?>
<div class="clr"></div>
</div>
<?php endif; ?>
</div>
So that 'leading' displays a certain number of articles, then 'primary' displays the next two, 'secondary' the next four and so on.
Any help on how to do that would be great
The file is located here:
/layouts/joomla/content/category_default.php
To override it place a copy here:
[YOUR_TEMPLATE]/html/layouts/joomla/content/
You can read more about Joomla layouts here:
Sharing layouts across views or extensions with JLayout

Categories