Move image to top if there is no date published (K2 articles

Rate this topic: Evaluations: 1, 1.00 on the average.Evaluations: 1, 1.00 on the average.Evaluations: 1, 1.00 on the average.Evaluations: 1, 1.00 on the average.Evaluations: 1, 1.00 on the average.Evaluations: 1, 1.00 on the average.1.00 out of 6 based on 1 vote(s)
GK User
Wed Jul 02, 2014 3:50 pm
Reply with quote
Report this post
Hi,

Please have a look here: http://www.madonnafanclub.nl/fanclub
There are certain articles on my site where I do not want the date to be displayed. Normally the data is published above the picture.

As you can see, the image is not aligned to the top (at the same height as the left menu and the block on the left).
Is that possible to make?

Or is there a way to make the data (if it is published) to be shown under the picture, so ALL articles have the picture aligned with the left and right block?
User avatar
Gold Boarder

teitbite
Fri Jul 04, 2014 7:59 am
Reply with quote
Report this post
Hi

Please remind me Your ftp access. I'll fix it.
User avatar
Moderator

GK User
Sat Jul 05, 2014 10:43 am
Reply with quote
Report this post
teitbite wrote:Hi

Please remind me Your ftp access. I'll fix it.


Can you tell how to fix it myself? Hope to learn something from it regarding K2 articles and its design :)
User avatar
Gold Boarder

teitbite
Sat Jul 05, 2014 12:06 pm
Reply with quote
Report this post
Hi

Ok. Lets try. I wanted to see code to be sure what needs to be done and be able to see solution in real time, but we can try guessing :)

Edit file: /html/com_k2/templates/default/item.php

Around line 26 this code should starts:

Code: Select all
               $params->get('itemFontResizer') ||
               $params->get('itemAuthor') ||
               $params->get('itemPrintButton') ||
               $params->get('itemEmailButton') ||
               $params->get('itemSocialButton') ||
               $params->get('itemVideoAnchor') ||
               $params->get('itemImageGalleryAnchor') ||
               $params->get('itemHits') ||
               $params->get('itemCategory')


add a data entry to this condition like that:

Code: Select all
               $params->get('itemFontResizer') ||
               $params->get('itemAuthor') ||
               $params->get('itemPrintButton') ||
               $params->get('itemEmailButton') ||
               $params->get('itemSocialButton') ||
               $params->get('itemVideoAnchor') ||
               $params->get('itemImageGalleryAnchor') ||
               $params->get('itemHits') ||
               $params->get('itemCategory')
                                        || $this->item->params->get('itemDateCreated')


I only added last line the code above.
User avatar
Moderator

GK User
Sat Jul 05, 2014 2:17 pm
Reply with quote
Report this post
HI teitbite,

It didn't work. Maybe my question wasn't clear it enough :) I have made to screenshots

This is how it is:
Image

And this is how I want it to be :)
Image

Is this possible? I can give you FTP access if you like :)
User avatar
Gold Boarder

teitbite
Sun Jul 06, 2014 8:20 am
Reply with quote
Report this post
Hi

Send me an ftp access. I need to check couple of things.
User avatar
Moderator

GK User
Sun Jul 06, 2014 8:59 am
Reply with quote
Report this post
teitbite wrote:Hi

Send me an ftp access. I need to check couple of things.


I have send you a private message with the information :)
User avatar
Gold Boarder

teitbite
Sun Jul 06, 2014 10:07 am
Reply with quote
Report this post
Hi

Same file, almost same code. I've cut this:

Code: Select all
            <?php if(
               $params->get('itemFontResizer') ||
               $params->get('itemAuthor') ||
               $params->get('itemPrintButton') ||
               $params->get('itemEmailButton') ||
               $params->get('itemSocialButton') ||
               $params->get('itemVideoAnchor') ||
               $params->get('itemImageGalleryAnchor') ||
               $params->get('itemHits') ||
               $params->get('itemCategory') ||
               $this->item->params->get('itemDateCreated')
            ): ?>
            <ul>
               <?php if($this->item->params->get('itemDateCreated')): ?>
               <li class="itemDate">
                  <time datetime="<?php echo JHtml::_('date', $this->item->created, JText::_(DATE_W3C)); ?>"> <?php echo JHTML::_('date', $this->item->created, JText::_('F j, Y')); ?> </time>
               </li>
               <?php endif; ?>
               <?php if($params->get('itemAuthor')): ?>
               <li class="itemAuthor"> <?php echo K2HelperUtilities::writtenBy($this->item->author->profile->gender); ?>&nbsp;
                  <?php if(empty($this->item->created_by_alias)): ?>
                  <a rel="author" href="<?php echo $this->item->author->link; ?>"><?php echo $this->item->author->name; ?></a>
                  <?php else: ?>
                  <?php echo $this->item->author->name; ?>
                  <?php endif; ?>
               </li>
               <?php endif; ?>
               <?php if($params->get('itemCategory')): ?>
               <li class="itemCategory"> <span><?php echo JText::_('K2_PUBLISHED_IN'); ?></span> <a href="<?php echo $this->item->category->link; ?>"><?php echo $this->item->category->name; ?></a> </li>
               <?php endif; ?>
               <?php if($params->get('itemHits')): ?>
               <li class="itemHits"> <?php echo JText::_('K2_READ'); ?> <strong><?php echo $this->item->hits; ?></strong> <?php echo JText::_('K2_TIMES'); ?> </li>
               <?php endif; ?>
               <?php if($params->get('itemFontResizer')): ?>
               <li class="itemResizer"> <span><?php echo JText::_('K2_FONT_SIZE'); ?></span> <a href="#" id="fontDecrease"><?php echo JText::_('K2_DECREASE_FONT_SIZE'); ?></a> <a href="#" id="fontIncrease"><?php echo JText::_('K2_INCREASE_FONT_SIZE'); ?></a> </li>
               <?php endif; ?>
               <?php if($params->get('itemPrintButton') && !JRequest::getInt('print')): ?>
               <li class="itemPrint"> <a rel="nofollow" href="<?php echo $this->item->printLink; ?>" onclick="window.open(this.href,'printWindow','width=900,height=600,location=no,menubar=no,resizable=yes,scrollbars=yes'); return false;"> <?php echo JText::_('K2_PRINT'); ?> </a> </li>
               <?php endif; ?>
               <?php if($params->get('itemEmailButton') && !JRequest::getInt('print')): ?>
               <li class="itemEmail"> <a rel="nofollow" href="<?php echo $this->item->emailLink; ?>" onclick="window.open(this.href,'emailWindow','width=400,height=350,location=no,menubar=no,resizable=no,scrollbars=no'); return false;"> <?php echo JText::_('K2_EMAIL'); ?> </a> </li>
               <?php endif; ?>
               <?php if($params->get('itemCommentsAnchor') && $params->get('itemComments') && ( ($params->get('comments') == '2' && !$this->user->guest) || ($params->get('comments') == '1')) ): ?>
               <li>
                  <?php if(!empty($this->item->event->K2CommentsCounter)): ?>
                  <!-- K2 Plugins: K2CommentsCounter -->
                  <?php echo $this->item->event->K2CommentsCounter; ?>
                  <?php else: ?>
                  <?php if($this->item->numOfComments > 0): ?>
                  <a class="itemCommentsLink k2Anchor" href="<?php echo $this->item->link; ?>#itemCommentsAnchor"> <span><?php echo $this->item->numOfComments; ?></span> <?php echo ($this->item->numOfComments>1) ? JText::_('K2_COMMENTS') : JText::_('K2_COMMENT'); ?> </a>
                  <?php else: ?>
                  <a class="itemCommentsLink k2Anchor" href="<?php echo $this->item->link; ?>#itemCommentsAnchor"> <?php echo JText::_('K2_BE_THE_FIRST_TO_COMMENT'); ?> </a>
                  <?php endif; ?>
                  <?php endif; ?>
               </li>
               <?php endif; ?>
               <?php if($params->get('itemSocialButton') && !is_null($params->get('socialButtonCode', NULL))): ?>
               <li class="itemSocial"> <?php echo $params->get('socialButtonCode'); ?> </li>
               <?php endif; ?>
               <?php if($params->get('itemVideoAnchor') && !empty($this->item->video)): ?>
               <li class="itemVideo"> <a class="k2Anchor" href="<?php echo $this->item->link; ?>#itemVideoAnchor"><?php echo JText::_('K2_MEDIA'); ?></a> </li>
               <?php endif; ?>
               <?php if($params->get('itemImageGalleryAnchor') && !empty($this->item->gallery)): ?>
               <li class="itemGallery"> <a class="k2Anchor" href="<?php echo $this->item->link; ?>#itemImageGalleryAnchor"><?php echo JText::_('K2_IMAGE_GALLERY'); ?></a> </li>
               <?php endif; ?>
            </ul>
            <?php endif; ?>


and copied it under the code displaying image.
User avatar
Moderator

GK User
Sun Jul 06, 2014 1:37 pm
Reply with quote
Report this post
Almost good! :)

Look here, an article without a date, looks good: http://www.madonnafanclub.nl/fanclub

But a news article with the date isn't good: http://www.madonnafanclub.nl/nieuws/act ... v-magazine
The title with the light grey background isn't good positioned, and the date is under that grey background....
It that something you could fix?
User avatar
Gold Boarder

GK User
Sun Jul 06, 2014 3:51 pm
Reply with quote
Report this post
gjhvs wrote:Almost good! :)

Look here, an article without a date, looks good: http://www.madonnafanclub.nl/fanclub

But a news article with the date isn't good: http://www.madonnafanclub.nl/nieuws/act ... v-magazine
The title with the light grey background isn't good positioned, and the date is under that grey background....
It that something you could fix?


I did some fixing here and there myself and got it fixed!
User avatar
Gold Boarder

teitbite
Mon Jul 07, 2014 12:38 pm
Reply with quote
Report this post
Hi

Great. Can You tell us what You did in case someone else will be looking for the same answer?
User avatar
Moderator

GK User
Mon Jul 07, 2014 4:44 pm
Reply with quote
Report this post
Sure!

I have placed your code after this line:

Code: Select all
<?php echo $this->item->event->AfterDisplayTitle; ?> <?php echo $this->item->event->K2AfterDisplayTitle; ?>


I started after this code with
Code: Select all
<header>

Then your code.
Als closed it again with
Code: Select all
</header>


And that worked!
Thanks for your help :)
User avatar
Gold Boarder


cron