how to add pop banner on page load on wordpress site? - php

I have the ad code.
<div id='div-gpt-ad-1373299297661-0-oop'>
<script type='text/javascript'>
googletag.display('div-gpt-ad-1373299297661-0-oop');
</script>
</div>
where should I add this to pop up on page load.
I added this code on the header.php file, under the <body> tag.
but it shows on the top of header.it should be pop up in the middle of the page.
header.php
<body <?php body_class();?> itemscope="itemscope" itemtype="http://schema.org/WebPage">
<!-- 450x450 -->
<!-- Overylay Banner -->
<div id='div-gpt-ad-1373299297661-0-oop'>
<script type='text/javascript'>
googletag.display('div-gpt-ad-1373299297661-0-oop');
</script>
</div>
<?php
if(of_get_option('full_or_boxed_layout')!= 'full_image_option'){
if(of_get_option('background_body_option')== 'big_image'){?>
<img alt="full screen background image" src="<?php echo of_get_option('background_large_image');?>" id="full-screen-background-image" />
<?php }}?>
<div id="content_nav">
<div id="nav">
<?php $top_menu = array('theme_location' => 'Top_Menu', 'container' => '', 'menu_class' => 'menu-top-menu-sf', 'menu_id' => '', 'fallback_cb' => false); wp_nav_menu($top_menu);?>
<?php $main_menu = array('theme_location' => 'Main_Menu', 'container' => '', 'menu_class' => '', 'menu_id' => '', 'fallback_cb' => false, 'link_after'=>'<span class="border-menu"></span>'); wp_nav_menu($main_menu);?>
</div>
</div>
<?php if(of_get_option('full_or_boxed_layout') == 'box_image_option'){ if(of_get_option('background_option') == 'background_image'){?>
<div class="full-background"><img src="<?php echo of_get_option('background_large_image');?>" alt="" /></div>
<?php }}?>
<div id="sb-site" class="<?php if(of_get_option('full_or_boxed_layout') == 'full_image_option'){echo "body_wraper_full";}else{echo "body_wraper_box";}?>">
<div>
</div>
<!-- Start header -->
<header class="header-wraper">
<div class="header_top_wrapper">
<?php $main_top = array('theme_location' => 'Top_Menu', 'container' => '', 'menu_class' => 'sf-top-menu', 'menu_id' => 'menu-top', 'fallback_cb' => false);?>
<div class="row <?php if($main_top == "" || !of_get_option('disable_top_menu')==0){echo "no-top";}?>">
<div class="six columns header-top-left-bar">
<a class="open toggle-lef sb-toggle-left navbar-left" href="#nav">
<div class="navicon-line"></div>
<div class="navicon-line"></div>
<div class="navicon-line"></div>
</a>
<?php if(!of_get_option('disable_top_menu')==1){?>
<div class="mainmenu">
<?php wp_nav_menu($main_top);?>
<div class="clearfix"></div>
</div>
<?php }?>
</div>
<div class="six columns header-top-right-bar">
<?php if(!of_get_option('disable_top_search')==1){?>
<div id="search_block_top">
<form id="searchbox" action="<?php echo home_url(); ?>" method="GET" role="search">
<p>
<input type="text" id="search_query_top" name="s" class="search_query ac_input" value="" placeholder="<?php _e('Search here', 'jelly_text_main'); ?>">
<a class="button_search" href="javascript:document.getElementById('searchbox').submit();"></a>
</p>
</form>
<span>Search</span>
<div class="clearfix"></div>
</div>
<?php }?>
<?php if(!of_get_option('disable_top_header_date')==1){?>
<div class="clock">
<i class="fa fa-clock-o"></i>
<div id="Date">
<?php
/*setlocale(LC_TIME, "pt_BR");
$currDate = strftime("%e %B, %Y, %H:%M");
echo $currDate;*/
?>
<?php echo date('l j F Y'); //setlocale(LC_TIME, "de_DE"); echo strftime('%A %d %B %Y');?></div>
<ul>
<li id="hours"></li>
<li class="point">:</li>
<li id="min"></li>
<li class="point">:</li>
<li id="sec"></li>
</ul>
</div>
<?php }?>
<div class="clearfix"></div>
</div>
</div>
</div>
<div class="header_main_wrapper">
<div class="row">
<div class="<?php if (is_active_sidebar('banner-sidebar')) { echo'four columns header-top-left'; } else { echo'twelve columns logo-position';}?>">
<!-- begin logo -->
<a href="<?php echo home_url(); ?>">
<?php $logo = of_get_option('logo_uploader'); ?>
<?php if (!empty($logo)): ?>
<img src="<?php echo $logo; ?>" alt="<?php bloginfo('description'); ?>"/>
<?php else: ?>
<img src="<?php echo get_template_directory_uri(); ?>/img/logo.png" alt="<?php bloginfo('description'); ?>"/>
<?php endif; ?>
</a>
<!-- end logo -->
</div>
<?php if (is_active_sidebar('banner-sidebar')){ ?>
<div class="eight columns header-top-right">
<?php dynamic_sidebar('banner-sidebar');?>
</div>
<?php }?>
</div>
</div>
<!-- end header, logo, top ads -->
<!-- Start Main menu -->
so where is should I place the ad code?
is it possible to add the overlay banner via text widget? without editing the header.php??

to load something on page load, you need to add it to the <body> tag itself like this:
<body onLoad="callJSFunction()">
.
.
.
</body>
take a look at this tutorial :D

Related

How to use pjax with pagination in yii2

I want to use pjax with pagination in yii2.
When user clicks on next page, i want to reload only one div with dynamic contents.
I have put pjax::begin() and pjax::end() before and end of my div.
This is my controller code :
public function actionRestaurantDetails(){
$this->layout = "detail";
if(isset($_REQUEST['rid']) && !empty($_REQUEST['rid'])){
$rid = $_REQUEST['rid'];
$snRestaurantsDetail = Restaurants::find()->where(['id'=>$_REQUEST['rid']])->one();
$snRestaurantMenuCategoryArr = MenuCategories::find()->where(["status"=>"1"])->all();
$snRestaurantMenusArr = RestaurantMenu::find()->where(['restaurant_id'=>$_REQUEST['rid'],'status'=>"1"])->all();
$query = RestaurantsGallery::find()->where(['restaurant_id'=>$_REQUEST['rid'],'status'=>"1"]);
$snRestaurantgallerysArr = RestaurantsGallery::find()->where(['restaurant_id'=>$_REQUEST['rid'],'status'=>"1"])->all();
$pagination = new Pagination(['totalCount' => $query->count(), 'pageSize'=>3]);
$models = $query->offset($pagination->offset)
->limit($pagination->limit)
->all();
$snRestaurantLayoutsArr = $snRestaurantsDetail->getRestaurantLayouts();
$snRestaurantTablesArr = $snRestaurantsDetail->getRestaurantTables();
$snRestaurantWorkingHoursArr = $snRestaurantsDetail->getRestaurantWorkingHours();
$snRestaurantMealTimesArr = $snRestaurantsDetail->getRestaurentMealTimes();
//p($snRestaurantsDetail);
}
return $this->render('restaurant_detail', [
'snRestaurantsDetail' => $snRestaurantsDetail,
'snRestaurantMenuCategoryArr' => $snRestaurantMenuCategoryArr,
'snRestaurantMenusArr' => $snRestaurantMenusArr,
'snRestaurantMealTimesArr' => $snRestaurantMealTimesArr,
'snRestaurantWorkingHoursArr' => $snRestaurantWorkingHoursArr,
'snRestaurantgallerysArr' => $snRestaurantgallerysArr,
'models' => $models,
'pagination' => $pagination,
]);
}
And this is my view :
<?php
use common\models\RestaurantMenu;
use yii\widgets\Pjax;
?>
<div class="container">
<div class="row align-items-center site-vh-100">
<div class="col-md-12">
<?php
$url = Yii::getAlias('#web')."/img/chiefs-rs-text.png";
?>
<!-- <a class="brand" href="#"><img src="<?php echo $url; ?>" width="35%" height="35%"></a> -->
<h1 class="site-heading site-animate mb-3"><?= !empty($snRestaurantsDetail) ? $snRestaurantsDetail->name : "-" ?></h1>
<h2 class="h5 site-subheading mb-5 site-animate">Please book our restaurant now</h2>
<?php if(Yii::$app->user->isGuest){ ?>
<p>For Booking Restaurant :Register Now</p>
<?php }else{ ?>
<p>Book Now</p>
<?php } ?>
</div>
</div>
</section>
<section class="site-section section_details" id="section-about">
<div class="container">
<div class="row">
<div class="col-md-5 site-animate mb-5">
<h4 class="site-sub-title">Our Story</h4>
<h2 class="site-primary-title display-4">Welcome</h2>
<p><?= !empty($snRestaurantsDetail->description) ? $snRestaurantsDetail->description : "No contents found." ?></p>
<!-- <p class="mb-4">A small river named Duden flows by their place and supplies it with the necessary regelialia. It is a paradisematic country, in which roasted parts of sentences fly into your mouth.</p> -->
</div>
<div class="col-md-1"></div>
<div class="col-md-6 site-animate img" data-animate-effect="fadeInRight">
<img src="<?= ($snRestaurantsDetail->photo) ? Yii::getAlias('#web')."../../../uploads/".$snRestaurantsDetail->photo : "No image uploaded"?>" alt="chiefsRS" class="img-fluid" style="width:100%;height: 60vh">
</div>
</div>
</div>
</section>
<section class="site-section section_details" id="section-menu">
<div class="container">
<div class="row">
<div class="col-md-12 text-center mb-5 site-animate">
<h2 class="display-4">Delicious Menu</h2>
<div class="row justify-content-center">
<div class="col-md-7">
<p class="lead">Far far away, behind the word mountains, far from the countries Vokalia and Consonantia, there live the blind texts.</p>
</div>
</div>
</div>
<div class="col-md-12 text-center">
<ul class="nav site-tab-nav nav-pills mb-5" id="pills-tab" role="tablist">
<?php
if(!empty($snRestaurantMenuCategoryArr)){
foreach ($snRestaurantMenuCategoryArr as $key => $category) { ?>
<li class="nav-item site-animate">
<a class="nav-link <?= (strtolower($category->name) == "breakfast") ? 'active' : '' ?>" id="pills-<?= strtolower($category->name)?>-tab" data-toggle="pill" href="#pills-<?= strtolower($category->name)?>" role="tab" aria-controls="pills-<?= strtolower($category->name);?>" aria-selected="true"><?= $category->name;?></a>
</li>
<?php }
}
?>
</ul>
<div class="tab-content text-left">
<?php
if(!empty($snRestaurantMenuCategoryArr)){
foreach ($snRestaurantMenuCategoryArr as $key => $category) { ?>
<div class="tab-pane fade <?= (strtolower($category->name) == "breakfast") ? 'show active' : '' ?>" id="pills-<?= strtolower($category->name)?>" role="tabpanel" aria-labelledby="pills-<?= strtolower($category->name)?>-tab">
<div class="row">
<?php
$breakfastMenu = RestaurantMenu::find()->where(['restaurant_id'=>$_REQUEST['rid'],'menu_category_id'=>$category->id,'status'=>"1"])->all();
// p($breakfastMenu);
if(!empty($breakfastMenu)){
foreach ($breakfastMenu as $key_menu => $menu) { ?>
<div class="col-md-6 site-animate">
<div class="media menu-item">
<img class="mr-3" src="<?php echo Yii::getAlias('#web')."/../../uploads/".$menu->photo; ?>" class="img-fluid" alt="chiefsRS">
<div class="media-body">
<h5 class="mt-0"><?= !empty($menu->name) ? $menu->name : ""?></h5>
<p><?= !empty($menu->description) ? $menu->description : ""?></p>
<h6 class="text-primary menu-price"><?= !empty($menu->price) ? "$".$menu->price : ""?></h6>
</div>
</div>
</div>
<?php
}
}
?>
</div>
</div>
<?php }
}
?>
</div>
</div>
</div>
</div>
</section>
<!-- END section -->
<?php
Pjax::begin(['id' => 'gallery_r','timeout'=>100000]); ?>
<section class="site-section section_details" id="section-gallery">
<div class="container">
<div class="row site-custom-gutters">
<div class="col-md-12 text-center mb-5 site-animate">
<h2 class="display-4">Gallery</h2>
<div class="row justify-content-center">
<div class="col-md-7">
<p class="lead">Far far away, behind the word mountains, far from the countries Vokalia and Consonantia, there live the blind texts.</p>
</div>
</div>
</div>
<div id="categories"></div>
<?php if (!empty($models)) {
foreach ($models as $key => $image) {
?>
<div class="col-md-4 site-animate">
<a href="<?php echo Yii::getAlias('#web') . "../../../uploads/" . $image->image_name; ?>" class="site-thumbnail image-popup">
<img src="<?php echo Yii::getAlias('#web') . "../../../uploads/" . $image->image_name; ?>" alt="chiefsRS" class="img-fluid" style="width:80%;height:50vh;" title="<?= $image->image_title; ?>">
</a>
</div>
<?php
}
}
?>
</div>
</div>
</section>
<?php echo \yii\widgets\LinkPager::widget([
'pagination' => $pagination,
]);
Pjax::end();?>
<!-- END section -->
<section class="site-section section_details bg-light" id="section-contact">
<div class="container">
<div class="row">
<div class="col-md-12 text-center mb-5 site-animate">
<h2 class="display-4">Get In Touch</h2>
<div class="row justify-content-center">
<div class="col-md-7">
<p class="lead">Far far away, behind the word mountains, far from the countries Vokalia and Consonantia, there live the blind texts.</p>
<p class="text-black">
<?php
if(!empty($snRestaurantsDetail)){ ?>
Address: <br><?= $snRestaurantsDetail->address; ?><br>
Phone: <br><?= $snRestaurantsDetail->contact_no; ?><br> <br>
Email: <br> <?= $snRestaurantsDetail->email; ?>
<?php } ?>
</p>
</div>
</div>
</div>
</div>
</div>
</section>
<div id="map"></div>
<?php// p($snRestaurantsDetail); ?>
<input type="hidden" name="lat" id="lat" value="<?= $snRestaurantsDetail->lattitude; ?>">
<input type="hidden" name="long" id="long" value="<?= $snRestaurantsDetail->longitude; ?>">
<script src="https://maps.googleapis.com/maps/api/js?key=AIzaSyBvpANF446OIBFdLaqozAf-lheEZ__oVVg&libraries=geometry"></script>
<script type="text/javascript">
$.pjax.reload({container: '#gallery_r'});
</script>
<?php Pjax::begin(['id'=>'gallery_r']);
if(!empty($models)){
foreach ($models as $key => $image) { ?>
<div class="col-md-4 site-animate">
<a href="<?php echo Yii::getAlias('#web')."../../../uploads/".$image->image_name;?>" class="site-thumbnail image-popup">
<img src="<?php echo Yii::getAlias('#web')."../../../uploads/".$image->image_name;?>" alt="chiefsRS" class="img-fluid" style="width:80%;height:50vh;" title="<?= $image->image_title;?>">
</a>
</div>
<?php }
Pjax::end();
echo \yii\widgets\LinkPager::widget([
'pagination' => $pagination,
]);
}?>
And this is my js code :
$.pjax.reload({container: '#gallery_r'});
And I call this jquery to add class after pjax load to display contents :
jQuery(document).on("pjax:success", "#gallery_r", function(event){
contentWayPoint();
}
);
var contentWayPoint = function() {
var i = 0;
$('.site-animate').waypoint( function( direction ) {
if( direction === 'down' && !$(this.element).hasClass('site-animated') ) {
i++;
$(this.element).addClass('item-animate');
setTimeout(function(){
$('body .site-animate.item-animate').each(function(k){
var el = $(this);
setTimeout( function () {
var effect = el.data('animate-effect');
if ( effect === 'fadeIn') {
el.addClass('fadeIn site-animated');
} else if ( effect === 'fadeInLeft') {
el.addClass('fadeInLeft site-animated');
} else if ( effect === 'fadeInRight') {
el.addClass('fadeInRight site-animated');
} else {
el.addClass('fadeInUp site-animated');
}
el.removeClass('item-animate');
}, k * 50, 'easeInOutExpo' );
});
}, 100);
}
} , { offset: '95%' } );
};
And on one button click I am calling this URL like this :
<p class="mb-0">Read More</p>
This URL calls as ajax call and loads only pjax container div, When i reload this page manually then it will display the whole page.I don't know why this happened ?
You should move the LinkPager inside the Pjax scope.
<?php
Pjax::begin(['id' => 'gallery_r']);
if (!empty($models)) {
foreach ($models as $key => $image) {
?>
<div class="col-md-4 site-animate">
<a href="<?php echo Yii::getAlias('#web') . "../../../uploads/" . $image->image_name; ?>" class="site-thumbnail image-popup">
<img src="<?php echo Yii::getAlias('#web') . "../../../uploads/" . $image->image_name; ?>" alt="chiefsRS" class="img-fluid" style="width:80%;height:50vh;" title="<?= $image->image_title; ?>">
</a>
</div>
<?php
}
echo \yii\widgets\LinkPager::widget([
'pagination' => $pagination,
]);
Pjax::end();
}
?>

Trying to make link with user id in joomla

I'm trying to add button with link to a seller store in my joomla component and I have no idea how can I do it.
I'm adding code from php file that has what I need but I don't know how to add it on another page. If someone can guide me with some how to step it would be awesome.
Here is the page that has the link to the store:
<?php
// no direct access
defined('_JEXEC') or die;
use Joomla\Registry\Registry;
/** #var SellaciousViewProduct $this */
$sellers = $this->item->get('sellers');
if (!isset($sellers[0]) || (count($sellers) == 1 && $sellers[0]->seller_uid == $this->item->get('seller_uid')))
{
return;
}
$c_currency = $this->helper->currency->current('code_3');
?>
<div class="clearfix"></div>
<a name="also-selling"> </a>
<hr class="isolate"/>
<h4 class="center"><?php echo JText::_('COM_SELLACIOUS_PRODUCT_HEADING_BLOCK_SELLERS'); ?></h4>
<table class="product-sellers table table-striped table-hover table-bordered">
<thead>
<tr>
<th>SELLER </th>
<th>DELIVERY INFO</th>
<th>PRICE </th>
<th>ACTION </th>
</tr>
</thead>
<tbody>
<?php
foreach ($sellers as $i => $seller)
{
/** #var Registry $item */
$item = new Registry($seller);
$s_currency = $this->helper->currency->forSeller($item->get('seller_uid'), 'code_3');
// todo: Add this to config (show current one or not in more sellers) and move to model
if ($item->get('seller_uid') == $this->item->get('seller_uid'))
{
continue;
}
?>
<tr>
<td style="width: 220px;" class="nowrap">
<div class="seller-info">
<a href="<?php echo JRoute::_('index.php?option=com_sellacious&view=store&id=' . $item->get('seller_uid')); ?>">
<?php echo $item->get('seller_company', $item->get('seller_name')); ?></a>
<?php $rating = $item->get('seller_rating.rating'); ?>
<span class="label <?php echo ($rating < 3) ? 'label-warning' : 'label-success' ?>"><?php echo number_format($rating, 1) ?> / 5.0</span>
</div>
<?php if ($item->get('exchange_days')): ?>
<?php if ($item->get('exchange_tnc')):
$options = array(
'title' => '<strong>' . (int) $item->get('exchange_days') . ' Days</strong> Replacement Guarantee',
'backdrop' => 'static',
);
echo JHtml::_('bootstrap.renderModal', 'exchange_tnc-' . $item->get('code'), $options, $item->get('exchange_tnc'));
endif; ?>
<div class="replacement-info">
<i class="fa fa-refresh"></i>
<strong> <?php echo (int) $item->get('exchange_days') ?> Days</strong> Replacement
<?php if ($item->get('exchange_tnc')): ?>
[<i class="fa fa-question"></i>]
<?php endif; ?>
</div>
<?php endif; ?>
<?php if ($item->get('return_days')): ?>
<?php if ($item->get('return_tnc')):
$options = array(
'title' => '<strong>' . (int) $item->get('return_days') . ' Days</strong> Easy Return',
'backdrop' => 'static',
);
echo JHtml::_('bootstrap.renderModal', 'return_tnc-' . $item->get('code'), $options, $item->get('return_tnc'));
endif; ?>
<div class="replacement-info">
<i class="fa fa-refresh"></i>
<strong> <?php echo (int) $item->get('return_days') ?> Days</strong> Easy Return
<?php if ($item->get('return_tnc')): ?>
[<i class="fa fa-question"></i>]
<?php endif; ?>
</div>
<?php endif; ?>
<div>
<?php $allowed_listing_type = (array) $this->helper->config->get('allowed_listing_type'); ?>
<?php if (count($allowed_listing_type) != 1): ?>
<span class="label label-info margin-top-10">Condition:
<?php
$list_type = $item->get('listing_type');
// What if this is a not allowed listing type value
if ($list_type == 1):
echo JText::plural('COM_SELLACIOUS_PRODUCT_FIELD_LISTING_TYPE_VALUE', $list_type);
else:
$list_cond = $item->get('item_condition');
echo JText::plural('COM_SELLACIOUS_PRODUCT_FIELD_ITEM_CONDITION_VALUE', $list_type * 10 + (int) $list_cond);
endif;
?>
</span>
<?php endif; ?>
</div>
</td>
<td>
<div class="delivery-info">
<?php echo JHtml::_('date', '+ ' . rand(1, 30) . ' days', 'D, dS F'); ?>
<br>
<small><?php
$flat_ship = $item->get('flat_shipping');
$ship_fee = $item->get('shipping_flat_fee');
if ($flat_ship == 0)
{
echo JText::_('COM_SELLACIOUS_PRODUCT_SHIPPING_FEE_IN_CART');
}
elseif (round($ship_fee, 2) > 0)
{
$fee = $this->helper->currency->display($ship_fee, $s_currency, $c_currency, true);
echo JText::sprintf('COM_SELLACIOUS_PRODUCT_SHIPPING_FEE_FLAT', $fee);
}
else
{
echo JText::_('COM_SELLACIOUS_PRODUCT_SHIPPING_FEE_FREE');
}
?></small>
</div>
</td>
<td style="width:90px;" class="center">
<span class="product-price-sm"><?php
echo $this->helper->currency->display($item->get('price.sales_price'), $s_currency, $c_currency, true) ?></span>
</td>
<td style="width:100px;" class="nowrap">
<?php $link = JRoute::_('index.php?option=com_sellacious&view=product&p=' . $item->get('code')); ?>
<button class="btn btn-primary btn-cart-sm">DETAILS</button><br/>
<button type="button" class="btn btn-warning btn-cart-sm btn-add-cart" data-item="<?php echo $item->get('code') ?>">ДОБАВИ В КОЛИЧКАТА</button>
<!--<button type="button" class="btn btn-success btn-cart-sm btn-add-cart"
data-item="<?php /*echo $item->get('code') */?>" data-checkout="true">КУПИ СЕГА</button>-->
</td>
</tr>
<?php
}
?>
</tbody>
</table>
And this is the file I'm trying to import the part with the link to the sellers store
<?php
// no direct access.
defined('_JEXEC') or die;
jimport('sellacious.loader');
if (class_exists('SellaciousHelper'))
{
$helper = SellaciousHelper::getInstance();
}
?>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="<?php echo $this->language; ?>" lang="<?php echo $this->language; ?>" dir="<?php echo $this->direction; ?>">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
<!-- favicon -->
<link rel="shortcut icon" href="templates/sellacious/images/favicon/favicon.ico" type="image/x-icon" />
<link rel="icon" href="templates/sellacious/images/favicon/favicon.ico" type="image/x-icon" />
<?php
$user = JFactory::getUser();
$doc = JFactory::getDocument();
$app = JFactory::getApplication();
$sitename = $app->get('sitename');
JHtml::_('script', 'media/com_sellacious/js/plugin/messagebox/jquery.messagebox.min.js', false, false);
JHtml::_('stylesheet', 'media/com_sellacious/js/plugin/messagebox/jquery.messagebox.css', null, false);
$doc->addStyleSheet('//fonts.googleapis.com/css?family=Open+Sans:400italic,700italic,300,400,700');
$doc->addStyleSheet('templates/sellacious/css/bootstrap.min.css', 'text/css', 'screen');
$doc->addStyleSheet('templates/sellacious/css/font-awesome.min.css', 'text/css', 'screen');
$doc->addStyleSheet('templates/sellacious/css/joomla-icons.css', 'text/css', 'screen');
$doc->addStyleSheet('templates/sellacious/css/smartadmin-production.css', 'text/css', 'screen');
$doc->addStyleSheet('templates/sellacious/css/smartadmin-skins.css', 'text/css', 'screen');
$doc->addStyleSheet('templates/sellacious/css/custom-style.css', 'text/css', 'screen');
if ($this->direction == 'rtl')
{
$doc->addStyleSheet('templates/sellacious/css/smartadmin-rtl.css', 'text/css', 'screen');
}
JHtml::_('jquery.framework');
JHtml::_('bootstrap.tooltip');
$doc->addScript('templates/sellacious/js/libs/jquery-ui-1.10.3.min.js'); // jQuery UI full, not from joomla core's minimised one
$doc->addScript('templates/sellacious/js/plugin/fastclick/fastclick.js'); // FastClick: For mobile devices
$doc->addScript('templates/sellacious/js/plugin/jquery-touch/jquery.ui.touch-punch.min.js'); // JS TOUCH plugin for mobile drag-drop touch events
$doc->addScript('templates/sellacious/js/plugin/msie-fix/jquery.mb.browser.min.js'); // browser msie issue fix
$doc->addScript('templates/sellacious/js/bootstrap/bootstrap.min.js'); // Bootstrap JS
$doc->addScript('templates/sellacious/js/notification/SmartNotification.min.js'); // Custom notification
$doc->addScript('templates/sellacious/js/plugin/cookie/jquery.cookie.min.js'); // cookie
$doc->addScript('templates/sellacious/js/sellacious-core.js'); // Sellacious core functions to work template wide
$doc->addScript('templates/sellacious/js/sellacious-notifier.js'); // Sellacious notification per view page
?>
<script data-pace-options='{ "restartOnRequestAfter": true }' src="templates/sellacious/js/plugin/pace/pace.min.js"></script>
<jdoc:include type="head"/>
<!--[if IE 7]>
<h1>Your browser is out of date, please update your browser by going to www.microsoft.com/download</h1>
<![endif]-->
</head>
<?php $collapse = $app->input->cookie->get('collapsedmenu'); ?>
<body class="fixed-page-footer <?php echo $app->input->get('hidemainmenu') || $collapse ? 'minified' : '' ?>"><!--
The possible classes: smart-style-3, minified, fixed-ribbon, fixed-header, fixed-width -->
<!-- HEADER -->
<header id="header" class="btn-group-justified">
<div id="logo-group">
<?php
$logo = 'templates/sellacious/images/logo.png';
if (isset($helper) && $helper->access->isSubscribed()):
$altLogo = $helper->media->getImage('config.backoffice_logo', 1, false);
$logo = $altLogo ?: $logo;
endif;
?>
<span id="logo"><a class="pull-left" href="<?php echo JRoute::_('index.php') ?>">
<img src="<?php echo $logo ?>" alt="<?php echo htmlspecialchars($sitename) ?>"></a></span>
<?php if ($this->countModules('logo-group')) { ?>
<!-- OPTIMAL PLACE FOR NOTIFICATION MODULE -->
<jdoc:include type="modules" name="logo-group" style="none"/>
<?php } ?>
</div>
<?php if ($this->countModules('header-left')) { ?>
<!-- Project Context -->
<jdoc:include type="modules" name="header-left" style="none"/>
<?php } ?>
<!-- pulled right: nav area -->
<div class="pull-right" style="margin-right: 1px;">
<!-- logout button -->
<div id="logout" class="btn-header transparent pull-right cursor-pointer">
<?php $logout_url = 'index.php?option=com_login&task=logout&' . JSession::getFormToken() . '=1'; ?>
<span> <a href="<?php echo $logout_url ?>" title="Sign Out" data-action="userLogout" class="hasTooltip" data-placement="bottom"
data-logout-msg="You can improve your security further after logging out by closing this opened browser"><i
class="fa fa-sign-out"></i></a> </span>
</div>
<!-- end logout button -->
<!-- fullscreen button -->
<div id="fullscreen" class="btn-header transparent pull-right">
<span> <a href="javascript:void(0);" data-action="launchFullscreen" class="hasTooltip" data-placement="bottom"
title="Full Screen"><i class="fa fa-arrows-alt"></i></a> </span>
</div>
<!-- end fullscreen button -->
<!-- back to Joomla administrator button -->
<div id="my-tore" class="btn-header transparent pull-right cursor-pointer">
<span> <a href="../<?php echo basename(JPATH_ADMINISTRATOR); ?>/index.php" class="hasTooltip" data-placement="bottom"
title="Back to Joomla Administrator"><i class="fa fa-joomla"></i></a> </span>
</div>
<!-- end back to Joomla administrator button -->
<!-- Go to Joomla frontend button -->
<div id="joomla" class="btn-header transparent pull-right cursor-pointer">
<span> <a href="../index.php" target="_blank" class="hasTooltip" data-placement="bottom"
title="View Site"><i class="fa fa-external-link"></i></a> </span>
</div>
<!-- end Go to Joomla frontend button -->
<!-- Go to Joomla frontend button -->
<div id="hide-menu" class="btn-header transparent pull-right cursor-pointer">
<span> <a href="#" class="hasTooltip" data-placement="bottom" data-menu="hidemenu"
title="Menu"><i class="fa fa-reorder"></i></a> </span>
</div>
<!-- end Go to Joomla frontend button -->
<!-- Sync media button -->
<div id="sync-media" class="btn-header transparent pull-right cursor-pointer">
<span> <a href="javascript:void(0)" class="hasTooltip" data-placement="bottom" data-action="sync-media" style="width: 135px;"
title="Refresh Media Uploads"><i class="fa fa-refresh"></i> <span class="text-normal"> <?php
echo JText::_('COM_SELLACIOUS_MEDIA_SYNC_BUTTON_LABEL') ?> </span></a> </span>
</div>
<!-- end Sync media button -->
<?php if ($this->countModules('header-right')): ?>
<jdoc:include type="modules" name="header-right" style="none"/>
<?php endif; ?>
</div>
<!-- end pulled right: nav area -->
<?php if (isset($helper) && ($helper->access->check('config.edit') || !$helper->access->isSubscribed())): ?>
<div id="context-news" class="pull-right padding-5"><!-- dynamic news --></div>
<?php endif; ?>
</header>
<!-- END HEADER -->
<!-- Left panel : Navigation area -->
<?php if ($this->countModules('left-panel') || $this->countModules('menu')) { ?>
<!-- Note: This width of the aside area can be adjusted through LESS variables -->
<aside id="left-panel">
<div class="login-info">
<span> <!-- User image size is adjusted inside CSS, it should stay as it -->
<a style="cursor:auto;" id="show-shortcut" data-action="toggleShortcut" href="index.php?option=com_sellacious&view=profile">
<!--<img src="templates/sellacious/images/avatars/male.png" alt="me" class="online"/>-->
<i class="fa fa-user"></i>
<span><?php echo $user->get('name'); ?></span>
</a>
</span>
</div>
<!-- User info -->
<?php if ($this->countModules('left-panel')) { ?>
<jdoc:include type="modules" name="left-panel" style="none"/>
<?php } ?>
<!-- end user info -->
<!-- NAVIGATION : This navigation is also responsive
To make this navigation dynamic please make sure to link the node
(the reference to the nav > ul) after page load. Or the navigation will not initialize.
-->
<!-- User info -->
<?php if ($this->countModules('menu')) { ?>
<jdoc:include type="modules" name="menu" style="none"/>
<?php } ?>
<!-- end user info -->
<span class="minifyme"> <i class="fa fa-arrow-circle-left hit"></i> </span>
</aside>
<!-- END NAVIGATION -->
<?php } ?>
<!-- End Left panel : Navigation area -->
<!-- MAIN PANEL -->
<div id="main" role="main">
<!-- RIBBON -->
<div id="ribbon">
<!-- breadcrumb -->
<?php if ($this->countModules('ribbon-left')) { ?>
<jdoc:include type="modules" name="ribbon-left" style="none"/>
<?php } ?>
<!-- end breadcrumb -->
<?php if ($this->countModules('ribbon-right')) { ?>
<span class="ribbon-button-alignment pull-right">
<jdoc:include type="modules" name="ribbon-right" style="none"/>
</span>
<?php } ?>
<div class="btn-headactions pull-right">
<i class="fa fa-book"></i> Documentation
<i class="fa fa-phone"></i> Support
<i class="fa fa-star"></i> Rate us on JED
</div>
</div>
<!-- END RIBBON -->
<?php if ($this->countModules('toolbar') || $this->countModules('title')) : ?>
<div class="box-toolbar">
<div class="">
<!-- col -->
<div class="pull-left">
<!-- PAGE HEADER -->
<jdoc:include type="modules" name="title"/>
</div>
<!-- end col -->
<!-- right side of the page with the sparkline graphs -->
<!-- col -->
<div class="pull-right">
<?php if ($this->countModules('toolbar')) : ?>
<span class="pull-right">
<jdoc:include type="modules" name="toolbar" style="none"/>
</span>
<?php endif; ?>
</div>
<!-- end col -->
</div>
</div>
<?php endif; ?>
<?php if ($this->countModules('top')) : ?>
<div class="row">
<div class="col-sm-12">
<jdoc:include type="modules" name="content-top" style="xhtml"/>
</div>
</div>
<?php endif; ?>
<?php if ($this->countModules('submenu')) : ?>
<div class="row">
<div class="col-sm-12">
<jdoc:include type="modules" name="submenu" style="none"/>
</div>
</div>
<?php endif; ?>
<div class="clearfix"></div>
<!-- MAIN CONTENT -->
<div id="content">
<?php if ($this->countModules('content-top')) { ?>
<div class="row">
<jdoc:include type="modules" name="content-top" style="none"/>
</div>
<?php } ?>
<div class="clearfix"></div>
<div class="component content-wrap">
<div id="system-message-container"><jdoc:include type="message" style="xhtml"/></div>
<div class="clearfix"></div>
<jdoc:include type="component" style="xhtml"/>
<div class="clearfix"></div>
</div>
<?php if ($this->countModules('content-bottom')) { ?>
<div class="row">
<jdoc:include type="modules" name="content-bottom" style="none"/>
</div>
<?php } ?>
</div>
<div class="clearfix"></div>
<!-- END MAIN CONTENT -->
</div>
<!-- END MAIN PANEL -->
<?php if ($this->countModules('footer')) { ?>
<jdoc:include type="modules" name="footer" style="none"/>
<?php } ?>
<jdoc:include type="modules" name="dynamic" style="xhtml"/>
<!-- Google Analytics code below -->
<?php if ($ga_code = $this->params->get('ga_code')) { ?>
<script type="text/javascript">
var _gaq = _gaq || [];
_gaq.push(['_setAccount', '<?php echo htmlspecialchars($ga_code) ?>']);
_gaq.push(['_trackPageview']);
(function() {
var ga = document.createElement('script');
ga.type = 'text/javascript';
ga.async = true;
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
var s = document.getElementsByTagName('script')[0];
s.parentNode.insertBefore(ga, s);
})();
</script>
<?php } ?>
</body>
</html>
I understand that I need this link,
<a href="<?php echo JRoute::_('index.php?option=com_sellacious&view=store&id=' . $item->get('seller_uid')); ?>">
<?php echo $item->get('seller_company', $item->get('seller_name')); ?></a>
but don't know how to implement it in the second file.
You need access to the view object from the sellacious product view in your file (i.e. the this in $sellers = **$this**->item->get('sellers')). Your file is a template file, and templates don't have access to the component view object - it's already been marked for garbage collection by the time the template renders. If you are only rendering the sellacious store links on pages that include the sellacious component, you could copy and store the data in JRegistry to use in the template. You could do this in a layout override from your template (layouts have access to their component's view object). If it's for use in your custom component or other components, you'd need to write model logic to pull the information from the database. In that case, I'd look at how the sellacious model is doing it and copy just the parts you need.

Changing header from a logo img to site title

I am trying to change my site header logo from an img to my site name (it would just take my site name from Wordpress settings). I can't figure out how to change this, and I feel like it is just a simple fix. Does anyone have any solutions?
inc/header/style5.php
<?php
$header_color = ot_get_option('header_color', 'light');
?>
<!-- Start Header -->
<header class="header style5 <?php echo esc_attr($header_color); ?>" role="banner">
<div class="row">
<div class="small-2 columns text-left mobile-icon-holder">
<i class="fa fa-bars"></i>
</div>
<div class="small-8 large-12 columns logo">
<div id="menu_width">
<?php if (ot_get_option('thb_logo')) { $logo = ot_get_option('thb_logo'); } else { $logo = THB_THEME_ROOT. '/assets/img/logo.png'; } ?>
<a href="<?php echo esc_url(home_url('/')); ?>" class="logolink">
<img src="<?php echo esc_url($logo); ?>" class="logoimg" alt="<?php bloginfo('name'); ?>"/>
</a>
<nav class="menu-holder">
<?php if (has_nav_menu('nav-menu')) { ?>
<?php wp_nav_menu( array( 'theme_location' => 'nav-menu', 'depth' => 3, 'container' => false, 'menu_class' => 'sf-menu style3', 'walker' => new thb_MegaMenu_tagandcat_Walker ) ); ?>
<?php } else if ( current_user_can( 'edit_theme_options' ) ) { ?>
<ul class="sf-menu style3">
<li><?php esc_html_e( 'Please assign a menu', 'goodlife' ); ?></li>
</ul>
<?php } ?>
</nav>
<?php do_action( 'thb_secondary'); ?>
</div>
</div>
<div class="small-2 columns text-right mobile-share-holder">
<div>
<?php do_action( 'thb_quick_search' ); ?>
</div>
</div>
</div>
</header>
<!-- End Header -->
And I think the only part of this code I have to edit is this little section? I just can't figure out how to edit it correctly.
<?php if (ot_get_option('thb_logo')) { $logo = ot_get_option('thb_logo'); } else { $logo = THB_THEME_ROOT. '/assets/img/logo.png'; } ?>
<a href="<?php echo esc_url(home_url('/')); ?>" class="logolink">
<img src="<?php echo esc_url($logo); ?>" class="logoimg" alt="<?php bloginfo('name'); ?>"/>
</a>
It looks like you just need to change:
<img src="<?php echo esc_url($logo); ?>" class="logoimg" alt="<?php bloginfo('name'); ?>"/>
to simply:
<?php bloginfo('name'); ?>

How to show Next Post using current Id in WordPress?

I'm making a WordPress theme. I made a grid structure shown below,
It contains two rows, and every row has three columns. I want to show random posts from my WordPress database in this grid.
This is my code
<div class="row">
<div class="col-xs-12">
<div class="rst-mediagrid">
<div class="div">
<?php
$args = array(
'posts_per_page' => 6,
'offset' => 0,
'category' => '2',
'category_name' => '',
'orderby' => 'date',
'include' => '',
'exclude' => '',
'meta_key' => '',
'meta_value' => '',
'post_type' => 'post',
'post_mime_type' => '',
'post_parent' => '',
'author' => '',
'post_status' => 'publish',
'suppress_filters' => true
);
global $post;
$post = get_post($args);
$next_post = get_adjacent_post( true, '', false, 'taxonomy_slug' );
?>
<div class="rst-col rst-col-50">
<div class="rst-postpic">
<?php echo get_the_post_thumbnail($post->ID); //latest post thumbnail ?>
</div>
</div>
<?php //endif; ?>
<div class="rst-col rst-col-25">
<div class="rst-postpic rst-postvideo">
<?php echo get_the_post_thumbnail($next_post->ID); ?>
</div>
</div>
<div class="rst-col rst-col-25">
<div class="rst-postpic">
<?php echo get_the_post_thumbnail($next_post->ID); ?>
</div>
</div>
<div class="clear"></div>
</div>
<div class="div">
<div class="rst-col rst-col-25">
<div class="rst-postpic">
<?php echo get_the_post_thumbnail($next_post->ID); ?>
</div>
</div>
<div class="rst-col rst-col-25">
<div class="rst-postpic rst-postvideo">
<?php echo get_the_post_thumbnail($next_post->ID); ?>
</div>
</div>
<div class="rst-col rst-col-50">
<div class="rst-postpic">
<?php echo get_the_post_thumbnail($next_post->ID); ?>
</div>
</div>
<div class="clear"></div>
</div>
</div>
</div>
</div>
The above code repeats the same image that I want to show thumbnails for in a perfect order, like the first row has three columns, and the first column has the latest image second column has image of previous post and third column has image of previous of previous mean 3rd post from latest post and second row also has same things.
If you have better suggestion kindly tell me.
use this It does not need to use id of current post as argument.
<?php echo get_next_post(); ?>
at last i found a solution of my question if some one else have same issue then use this
<?php
global $post;
$loop = new WP_Query( array( 'posts_per_page' => 9,'orderby'=>rand) );
$posts = array();
while ( $loop->have_posts() ) :
$items = array();
$items['link']=wp_get_attachment_url( get_post_thumbnail_id( $post->ID ));
$items['Image'] = get_the_post_thumbnail($loop->the_post());
$items['LinkPost']=get_permalink($post->ID);
$items['Title']=get_the_title($post->ID);
$items['PostTime']=get_the_time('M d,Y', $post->ID);
array_push($posts, $items);
endwhile;
for($i = 1; $i< count($posts); $i++){
?>
<?php
if($i==1){
?>
<div class="div">
<div class="rst-col rst-col-50">
<div class="rst-postpic">
<img src="<?php echo $posts[$i+1]['link']; ?>" alt="" style="height: 385px;width: 770px"/>
</div>
<div class="rst-postinfo">
<span>Sport</span>
<h6><?php echo $posts[$i]['Title']; ?></h6>
<time><i class="fa fa-clock-o"></i><?php echo $posts[$i]['PostTime']; ?></time>
</div>
</div>
<?php //endif; ?>
<div class="rst-col rst-col-25">
<div class="rst-postpic rst-postvideo">
<img src="<?php echo $posts[$i+2]['link']; ?>" alt="" style="height: 385px;width: 770px"/>
</div>
<div class="rst-postinfo">
<span>Sport</span>
<h6><?php echo $posts[$i+1]['Title']; ?></h6>
<time><i class="fa fa-clock-o"></i><?php echo $posts[$i+1]['PostTime']; ?></time>
</div>
</div>
<div class="rst-col rst-col-25">
<div class="rst-postpic">
<img src="<?php echo $posts[$i+3]['link']; ?>" alt="" style="height: 385px;width: 770px"/>
</div>
<div class="rst-postinfo">
<span>Sport</span>
<h6><?php echo $posts[$i+2]['Title']; ?></h6>
<time><i class="fa fa-clock-o"></i><?php echo $posts[$i+2]['PostTime']; ?></time>
</div>
</div>
<div class="clear"></div>
</div><!-- end first row-->
<?php } //end if ?>
<?php
if($i == 2 ){
?>
<div class="div">
<div class="rst-col rst-col-25">
<div class="rst-postpic">
<img src="<?php echo $posts[$i+1]['link']; ?>" alt="" style="height: 385px;width: 770px"/>
</div>
<div class="rst-postinfo">
<span>Sport</span>
<h6><?php echo $posts[$i]['Title']; ?></h6>
<time><i class="fa fa-clock-o"></i><?php echo $posts[$i]['PostTime']; ?></time>
</div>
</div>
<div class="rst-col rst-col-25">
<div class="rst-postpic rst-postvideo">
<img src="<?php echo $posts[$i+2]['link']; ?>" alt="" style="height: 385px;width: 770px"/>
</div>
<div class="rst-postinfo">
<span>Sport</span>
<h6><?php echo $posts[$i+1]['Title']; ?></h6>
<time><i class="fa fa-clock-o"></i><?php echo $posts[$i+1]['PostTime']; ?></time>
</div>
</div>
<div class="rst-col rst-col-50">
<div class="rst-postpic">
<img src="<?php echo $posts[$i+3]['link']; ?>" alt="" style="height: 385px;width: 770px"/>
</div>
<div class="rst-postinfo">
<span>Sport</span>
<h6><?php echo $posts[$i+2]['Title']; ?></h6>
<time><i class="fa fa-clock-o"></i><?php echo $posts[$i+2]['PostTime']; ?></time>
</div>
</div>
<div class="clear"></div>
</div><!--end second row-->
<?php
}//end if
}//end for loop ?>
if some have better suggestion kindly post you answer here and also any logical issue in my code then also tell me

Wordpress conditionally load class when comments author matches author of the post

I want to be able to conditionally load a class containing the word 'AUTHOR' in the comments section, next to the name of the person who was the author of the post. I know it has something to do with class bypostauthor, what I've got so far is:
<?php if $class == 'bypostauthor' ?>
<div class="author">AUTHOR</div>
<? endif; ?>
More info:
In comment section of my wordpress post page, the class .bypostauthor exists whenever a the author of post page comments on there post page, giving this for one of the comments in the comment section ->
<li class="comment byuser comment-author-admin bypostauthor odd alt thread-odd thread-alt depth-1 clearfix" id="li-comment-28">
<div class="comment-block" id="comment-28">
<div class="comment-inside-block">
<div class="comment-info">
<div class="comment-author vcard clearfix">
<img alt="" src="http://0.gravatar.com/avatar/6dbfd7e6bd95881c5736647c8736dd89?s=32&d=http%3A%2F%2F0.gravatar.com%2Favatar%2Fad516503a11cd5ca435acc9bb6523536%3Fs%3D32&r=G" class="avatar avatar-32 photo" height="32" width="32">
<div class="comment-meta commentmetadata">
<cite class="fn">Trent Aughey</cite>
<div style="clear:both;"></div>
<a class="comment-time" href="http://trentaughey.com/test/#comment-28"> 1 day ago </a> </div>
</div>
<div class="clearfix"></div>
</div>
<div class="comment-text">
<p>comment – 2</p>
<p class="reply">
<a class="comment-reply-link" href="/test/?replytocom=28#respond" onclick="return addComment.moveForm("comment-28", "28", "respond", "570")">Reply</a> </p>
</div>
</div>
</div>
<ul class="children">
<li class="comment byuser comment-author-admin bypostauthor even depth-2 clearfix" id="li-comment-29">
<div class="comment-block" id="comment-29">
<div class="comment-inside-block">
<div class="comment-info">
<div class="comment-author vcard clearfix">
<img alt="" src="http://0.gravatar.com/avatar/6dbfd7e6bd95881c5736647c8736dd89?s=32&d=http%3A%2F%2F0.gravatar.com%2Favatar%2Fad516503a11cd5ca435acc9bb6523536%3Fs%3D32&r=G" class="avatar avatar-32 photo" height="32" width="32">
<div class="comment-meta commentmetadata">
<cite class="fn">Trent Aughey</cite>
<div style="clear:both;"></div>
<a class="comment-time" href="http://trentaughey.com/test/#comment-29"> 1 day ago </a> </div>
</div>
<div class="clearfix"></div>
</div>
<div class="comment-text">
<p>HELLO</p>
<p class="reply">
</p>
</div>
</div>
</div>
When a non-author of the post page leaves a comment on the post the following code is used
<li class="comment even thread-even depth-1 clearfix" id="li-comment-20">
<div class="comment-block" id="comment-20">
<div class="comment-inside-block">
<div class="comment-info">
<div class="comment-author vcard clearfix">
<img alt="" src="http://0.gravatar.com/avatar/6dbfd7e6bd95881c5736647c8736dd89?s=32&d=http%3A%2F%2F0.gravatar.com%2Favatar%2Fad516503a11cd5ca435acc9bb6523536%3Fs%3D32&r=G" class="avatar avatar-32 photo" height="32" width="32">
<div class="comment-meta commentmetadata">
<cite class="fn">Trent Aughey</cite>
<div style="clear:both;"></div>
<a class="comment-time" href="http://trentaughey.com/test/#comment-20"> 1 month ago </a> </div>
</div>
<div class="clearfix"></div>
</div>
<div class="comment-text">
<p>Test, Test</p>
<p class="reply">
<a class="comment-reply-link" href="/test/?replytocom=20#respond" onclick="return addComment.moveForm("comment-20", "20", "respond", "570")">Reply</a> </p>
</div>
</div>
</div>
I'm trying to accomplish having the word 'AUTHOR' next to the author of post name whenever they comment on there page. Considering bypostauthor class appears whenever page author post a comment on his page I tried to use the following code to make a div class conditionally appear whenever the post author comments ->
<li <?php comment_class('clearfix'); ?> id="li-comment-<?php comment_ID() ?>">
<div class="comment-block" id="comment-<?php comment_ID(); ?>">
<div class="comment-inside-block">
<div class="comment-info">
<div class="comment-author vcard clearfix">
<?php echo get_avatar( $comment->comment_author_email, 32 ); ?>
<div class="comment-meta commentmetadata">
<?php printf(__('<cite class="fn">%s</cite>', 'playne'), get_comment_author_link()) ?><?php if $class == 'bypostauthor' ?>
<div class="author">AUTHOR</div>
<? endif; ?>
<div style="clear:both;"></div>
<a class="comment-time" href="<?php echo esc_url( get_comment_link( $comment->comment_ID ) ) ?>"> <?php echo themeblvd_time_ago_1(); ?> </a><?php edit_comment_link(__('(Edit)', 'playne'),' ','') ?>
</div>
</div>
<div class="clearfix"></div>
</div>
<div class="comment-text">
<?php comment_text() ?>
<p class="reply">
<?php comment_reply_link(array_merge( $args, array('depth' => $depth, 'max_depth' => $args['max_depth']))) ?>
</p>
</div>
</div>
<?php if ($comment->comment_approved == '0') : ?>
<em class="comment-awaiting-moderation"><?php _e('Your comment is awaiting moderation.', 'playne') ?></em>
<?php endif; ?>
</div>
My code fix does nothing, can anyone tell me what I'm doing wrong please.
You can filter the comment author name instead of adding something to core files. Your change will be overwritten on a WordPress update.
add_filter( 'get_comment_author', 'your_prefix_filter_the_post_author_name' );
function your_prefix_filter_the_post_author_name( $author ) {
$classes = get_comment_class();
if (in_array( 'bypostauthor',$classes) ) {
$output = '<div class="author-tag"><p>AUTHOR - ' . $author . '</p></div>';
return $output;
}
return $author;
}
I was able to fix this problem using the following code:
function author_tag() {
$classes = get_comment_class();
if(in_array('bypostauthor',$classes)) {
$output = '<div class="author-tag"><p>AUTHOR</p></div>';
} /*else {
$output = '<div class="author-tag"><p>NOT AUTHOR</p></div>';
}*/
return $output;}
Placed the function as follows:
<li <?php comment_class('clearfix'); ?> id="li-comment-<?php comment_ID() ?>">
<div class="comment-block" id="comment-<?php comment_ID(); ?>">
<div class="comment-inside-block">
<div class="comment-info">
<div class="comment-author vcard clearfix">
<?php echo get_avatar( $comment->comment_author_email, 32 ); ?>
<div class="comment-meta commentmetadata">
<?php printf(__('<cite class="fn">%s</cite>', 'playne'), get_comment_author_link()) ?>
<?php echo author_tag(); ?>
<div style="clear:both;"></div>
<a class="comment-time" href="<?php echo esc_url( get_comment_link( $comment->comment_ID ) ) ?>"> <?php echo themeblvd_time_ago_1(); ?> </a><?php edit_comment_link(__('(Edit)', 'playne'),' ','') ?>
</div>
</div>
<div class="clearfix"></div>
</div>
<div class="comment-text">
<?php comment_text() ?>
<p class="reply">
<?php comment_reply_link(array_merge( $args, array('depth' => $depth, 'max_depth' => $args['max_depth']))) ?>
</p>
</div>
</div>
<?php if ($comment->comment_approved == '0') : ?>
<em class="comment-awaiting-moderation"><?php _e('Your comment is awaiting moderation.', 'playne') ?></em>
<?php endif; ?>
</div>
Hope this helps anyone who had similar issues.

Categories