This is the selector script I believe below so what should happen is as you select a product then you select if its your an individual or couple or family then you click show me and it takes you to the correct link
<div class="finder__selector">
<?php /* Set first option as the default option */ ?>
<?php $count = 1; while ( have_rows('links') ) : the_row(); ?>
<?php $link_url = get_sub_field('link_url'); ?>
<?php if($product_name): ?>
<?php //echo $product_name; ?>
<?php //echo $link_url; ?>
<?php if(strpos($link_url, $product_name) !== false): ?>
<?php the_sub_field('link_title'); ?><i class="down-arrow"></i>
<?php endif; ?>
<?php else: ?>
<?php if($count == 1) : ?>
<?php the_sub_field('link_title'); ?><i class="down-arrow"></i>
<?php endif; ?>
<?php endif; ?>
<?php $count++; ?>
<?php endwhile; ?>
<div class="finder__options">
<?php $count = 1; ?>
<?php while ( have_rows('links') ) : the_row(); ?>
<?php $link_url_select = get_sub_field('link_url'); ?>
<?php $link_title_select = get_sub_field('link_title'); ?>
<?php if($product_name): ?>
<?php if(strpos($link_url_select, $product_name) !== false): ?>
<?php echo $link_title_select; ?><i class="down-arrow"></i>
<?php else: ?>
<?php echo $link_title_select; ?><i class="down-arrow"></i>
<?php endif; ?>
<?php else: ?>
<?php echo $link_title_select; ?><i class="down-arrow"></i>
<?php endif; ?>
<?php $count++; ?>
<?php endwhile; ?>
</div>
So the above works but whats its actually showing on view source and what creaming frog is 404 is
href="&audience=couples" class=finder__option>
my partner and I <i
class=down-arrow></i>
</a>
<a
href="&audience=families" class=finder__option>
my family <i
class=down-arrow></i>
I'd love to have the option to have my posts displayed in multiple columns/rows (so that I could have several thumbnails/posts horizontally laid out next to each other, instead of only being posted below one another).
I tried changing the layout but sadly nothing happened
can you suggest something?
Thank you guys :D
<?php
/**
* Legacy template for compatibility with versions prior to 2.0.0
*
* #version 2.0.0
*/
?>
<?php if ($instance['before_posts']) : ?>
<div class="upw-before">
<?php echo wpautop($instance['before_posts']); ?>
</div>
<?php endif; ?>
<?php if ($upw_query->have_posts()) : ?>
<table class="table table-bordered">
<?php while ($upw_query->have_posts()) : $upw_query->the_post(); ?>
<tr>
<?php $current_post = ($post->ID == $current_post_id && is_single()) ? 'current-post-item' : ''; ?>
<li class="<?php echo ($post->ID == $current_post_id && is_single())?'current-post-item':'' ?>">
<?php if (current_theme_supports('post-thumbnails') && $instance['show_thumbnail'] && has_post_thumbnail()) : ?>
<td>
<div class="upw-content">
<a href="<?php the_permalink(); ?>" title="<?php the_title_attribute(); ?>">
<?php the_post_thumbnail($instance['thumb_size']); ?>
</a>
<?php endif; ?>
<?php if (get_the_title() && $instance['show_title']) : ?>
<p class="post-title">
<a href="<?php the_permalink(); ?>" title="<?php the_title_attribute(); ?>">
<?php the_title(); ?>
</a>
</p>
<?php endif; ?>
</td>
</tr>
<?php if ($instance['show_date']) : ?>
<p class="post-date">
<?php the_time($instance['date_format']); ?>
</p>
<?php endif; ?>
<?php if ($instance['show_author']) : ?>
<p class="post-author">
<span class="post-author-label"><?php _e('By', 'upw'); ?>:</span>
<?php the_author_posts_link(); ?>
</p>
<?php endif; ?>
<?php if ($instance['show_comments']) : ?>
<p class="post-comments">
<?php comments_number(__('No responses', 'upw'), __('One response', 'upw'), __('% responses', 'upw')); ?>
</p>
<?php endif; ?>
<?php if ($instance['show_excerpt']) : ?>
<?php
$linkmore = '';
if ($instance['show_readmore']) {
$linkmore = ' '.$excerpt_readmore.'';
}
?>
<p class="post-excerpt"><?php echo get_the_excerpt() . $linkmore; ?></p>
<?php endif; ?>
<?php if ($instance['show_content']) : ?>
<p class="post-content"><?php the_content() ?></p>
<?php endif; ?>
<?php
$categories = get_the_term_list($post->ID, 'category', '', ', ');
if ($instance['show_cats'] && $categories) :
?>
<p class="post-cats">
<span class="post-cats-label"><?php _e('Categories', 'upw'); ?>:</span>
<span class="post-cats-list"><?php echo $categories; ?></span>
</p>
<?php endif; ?>
<?php
$tags = get_the_term_list($post->ID, 'post_tag', '', ', ');
if ($instance['show_tags'] && $tags) :
?>
<p class="post-tags">
<span class="post-tags-label"><?php _e('Tags', 'upw'); ?>:</span>
<span class="post-tags-list"><?php echo $tags; ?></span>
</p>
<?php endif; ?>
<?php if ($custom_fields) {
$custom_field_name = explode(',', $custom_fields);
foreach ($custom_field_name as $name) {
$name = trim($name);
$custom_field_values = get_post_meta($post->ID, $name, true);
if ($custom_field_values) {
echo '<p class="post-meta post-meta-'.$name.'">';
if (!is_array($custom_field_values)) {
echo $custom_field_values;
} else {
$last_value = end($custom_field_values);
foreach ($custom_field_values as $value) {
echo $value;
if ($value != $last_value) echo ', ';
}
}
echo '</p>';
}
}
} ?>
</div>
</td>
</tr>
<tr>
<td>
<?php endwhile; ?>
</td></tr>
</table>
<?php else : ?>
<p><?php _e('No posts found.', 'upw'); ?></p>
<?php endif; ?>
<?php if ($instance['after_posts']) : ?>
<div class="upw-after">
<?php echo wpautop($instance['after_posts']); ?>
</div>
<?php endif; ?>
I'm working on a website with Joomla 3.2.1 and the Protostar template.
I want the article image to be shown before the article info. The order I want is the following one:
article title
intro image
article info
article intro
I tried doing it changing the code on template.css, but it also moves the article info of articles with no intro image, so it isn't a good option for me.
I tried changing the .php files. For example, the default_item.php of the featured articles view. I copied the intro image's code, and pasted it over the article info's code, but the article info is still being shown over the intro image.
What can I do to put the intro image over the article info?
Here is the code for the article items file (default_item.php) in the featured articles page.
<?php
/**
* #package Joomla.Site
* #subpackage com_content
*
* #copyright Copyright (C) 2005 - 2013 Open Source Matters, Inc. All rights reserved.
* #license GNU General Public License version 2 or later; see LICENSE.txt
*/
defined('_JEXEC') or die;
// Create a shortcut for params.
$params = &$this->item->params;
$images = json_decode($this->item->images);
$canEdit = $this->item->params->get('access-edit');
$info = $this->item->params->get('info_block_position', 0);
?>
<?php if ($this->item->state == 0) : ?>
<div class="system-unpublished">
<?php endif; ?>
<?php if ($params->get('show_title')) : ?>
<h2 class="item-title">
<?php if ($params->get('link_titles') && $params->get('access-view')) : ?>
<?php echo $this->escape($this->item->title); ?>
<?php else : ?>
<?php echo $this->escape($this->item->title); ?>
<?php endif; ?>
</h2>
<?php endif; ?>
<?php if ($this->item->state == 0) : ?>
<span class="label label-warning"><?php echo JText::_('JUNPUBLISHED'); ?></span>
<?php endif; ?>
<?php if ($params->get('show_print_icon') || $params->get('show_email_icon') || $canEdit) : ?>
<div class="btn-group pull-right"> <a class="btn dropdown-toggle" data-toggle="dropdown" href="#" role="button"> <span class="icon-cog"></span> <span class="caret"></span> </a>
<ul class="dropdown-menu">
<?php if ($params->get('show_print_icon')) : ?>
<li class="print-icon"> <?php echo JHtml::_('icon.print_popup', $this->item, $params); ?> </li>
<?php endif; ?>
<?php if ($params->get('show_email_icon')) : ?>
<li class="email-icon"> <?php echo JHtml::_('icon.email', $this->item, $params); ?> </li>
<?php endif; ?>
<?php if ($canEdit) : ?>
<li class="edit-icon"> <?php echo JHtml::_('icon.edit', $this->item, $params); ?> </li>
<?php endif; ?>
</ul>
</div>
<?php endif; ?>
<?php // Todo Not that elegant would be nice to group the params ?>
<?php $useDefList = ($params->get('show_modify_date') || $params->get('show_publish_date') || $params->get('show_create_date')
|| $params->get('show_hits') || $params->get('show_category') || $params->get('show_parent_category') || $params->get('show_author') ); ?>
<?php if ($useDefList && ($info == 0 || $info == 2)) : ?>
<dl class="article-info muted">
<dt class="article-info-term">
<?php echo JText::_('COM_CONTENT_ARTICLE_INFO'); ?>
</dt>
<?php if ($params->get('show_author') && !empty($this->item->author )) : ?>
<dd class="createdby">
<?php $author = $this->item->author; ?>
<?php $author = ($this->item->created_by_alias ? $this->item->created_by_alias : $author); ?>
<?php if (!empty($this->item->contactid ) && $params->get('link_author') == true) : ?>
<?php
echo JText::sprintf('COM_CONTENT_WRITTEN_BY',
JHtml::_('link', JRoute::_('index.php?option=com_contact&view=contact&id='.$this->item->contactid), $author)
); ?>
<?php else :?>
<?php echo JText::sprintf('COM_CONTENT_WRITTEN_BY', $author); ?>
<?php endif; ?>
</dd>
<?php endif; ?>
<?php if ($params->get('show_parent_category') && !empty($this->item->parent_slug)) : ?>
<dd class="parent-category-name">
<?php $title = $this->escape($this->item->parent_title);
$url = ''.$title.'';?>
<?php if ($params->get('link_parent_category') && !empty($this->item->parent_slug)) : ?>
<?php echo JText::sprintf('COM_CONTENT_PARENT', $url); ?>
<?php else : ?>
<?php echo JText::sprintf('COM_CONTENT_PARENT', $title); ?>
<?php endif; ?>
</dd>
<?php endif; ?>
<?php if ($params->get('show_category')) : ?>
<dd class="category-name">
<?php $title = $this->escape($this->item->category_title);
$url = ''.$title.'';?>
<?php if ($params->get('link_category') && $this->item->catslug) : ?>
<?php echo JText::sprintf('COM_CONTENT_CATEGORY', $url); ?>
<?php else : ?>
<?php echo JText::sprintf('COM_CONTENT_CATEGORY', $title); ?>
<?php endif; ?>
</dd>
<?php endif; ?>
<?php if ($params->get('show_publish_date')) : ?>
<dd class="published">
<span class="icon-calendar"></span> <?php echo JText::sprintf('COM_CONTENT_PUBLISHED_DATE_ON', JHtml::_('date', $this->item->publish_up, JText::_('DATE_FORMAT_LC3'))); ?>
</dd>
<?php endif; ?>
<?php if ($info == 0) : ?>
<?php if ($params->get('show_modify_date')) : ?>
<dd class="modified">
<span class="icon-calendar"></span>
<?php echo JText::sprintf('COM_CONTENT_LAST_UPDATED', JHtml::_('date', $this->item->modified, JText::_('DATE_FORMAT_LC3'))); ?>
</dd>
<?php endif; ?>
<?php if ($params->get('show_create_date')) : ?>
<dd class="create">
<span class="icon-calendar"></span>
<?php echo JText::sprintf('COM_CONTENT_CREATED_DATE_ON', JHtml::_('date', $this->item->created, JText::_('DATE_FORMAT_LC3'))); ?>
</dd>
<?php endif; ?>
<?php if ($params->get('show_hits')) : ?>
<dd class="hits">
<span class="icon-eye-open"></span>
<?php echo JText::sprintf('COM_CONTENT_ARTICLE_HITS', $this->item->hits); ?>
</dd>
<?php endif; ?>
<?php endif; ?>
</dl>
<?php endif; ?>
<?php if (isset($images->image_intro) && !empty($images->image_intro)) : ?>
<?php $imgfloat = (empty($images->float_intro)) ? $params->get('float_intro') : $images->float_intro; ?>
<div class="pull-<?php echo htmlspecialchars($imgfloat); ?> item-image"> <img
<?php if ($images->image_intro_caption):
echo 'class="caption"'.' title="' .htmlspecialchars($images->image_intro_caption) .'"';
endif; ?>
src="<?php echo htmlspecialchars($images->image_intro); ?>" alt="<?php echo htmlspecialchars($images->image_intro_alt); ?>"/> </div>
<?php endif; ?>
<?php if (!$params->get('show_intro')) : ?>
<?php echo $this->item->event->afterDisplayTitle; ?>
<?php endif; ?>
<?php echo $this->item->event->beforeDisplayContent; ?> <?php echo $this->item->introtext; ?>
<?php if ($useDefList && ($info == 1 || $info == 2)) : ?>
<dl class="article-info muted">
<dt class="article-info-term">
<?php echo JText::_('COM_CONTENT_ARTICLE_INFO'); ?>
</dt>
<?php if ($info == 1) : ?>
<?php if ($params->get('show_author') && !empty($this->item->author )) : ?>
<dd class="createdby">
<?php $author = $this->item->author; ?>
<?php $author = ($this->item->created_by_alias ? $this->item->created_by_alias : $author); ?>
<?php if (!empty($this->item->contactid ) && $params->get('link_author') == true) : ?>
<?php
echo JText::sprintf('COM_CONTENT_WRITTEN_BY',
JHtml::_('link', JRoute::_('index.php?option=com_contact&view=contact&id='.$this->item->contactid), $author)
); ?>
<?php else : ?>
<?php echo JText::sprintf('COM_CONTENT_WRITTEN_BY', $author); ?>
<?php endif; ?>
</dd>
<?php endif; ?>
<?php if ($params->get('show_parent_category') && !empty($this->item->parent_slug)) : ?>
<dd class="parent-category-name">
<?php $title = $this->escape($this->item->parent_title);
$url = ''.$title.'';?>
<?php if ($params->get('link_parent_category') && $this->item->parent_slug) : ?>
<?php echo JText::sprintf('COM_CONTENT_PARENT', $url); ?>
<?php else : ?>
<?php echo JText::sprintf('COM_CONTENT_PARENT', $title); ?>
<?php endif; ?>
</dd>
<?php endif; ?>
<?php if ($params->get('show_category')) : ?>
<dd class="category-name">
<?php $title = $this->escape($this->item->category_title);
$url = ''.$title.'';?>
<?php if ($params->get('link_category') && $this->item->catslug) : ?>
<?php echo JText::sprintf('COM_CONTENT_CATEGORY', $url); ?>
<?php else : ?>
<?php echo JText::sprintf('COM_CONTENT_CATEGORY', $title); ?>
<?php endif; ?>
</dd>
<?php endif; ?>
<?php if ($params->get('show_publish_date')) : ?>
<dd class="published">
<span class="icon-calendar"></span> <?php echo JText::sprintf('COM_CONTENT_PUBLISHED_DATE_ON', JHtml::_('date', $this->item->publish_up, JText::_('DATE_FORMAT_LC3'))); ?>
</dd>
<?php endif; ?>
<?php endif; ?>
<?php if ($params->get('show_create_date')) : ?>
<dd class="create">
<span class="icon-calendar"></span> <?php echo JText::sprintf('COM_CONTENT_CREATED_DATE_ON', JHtml::_('date', $this->item->created, JText::_('DATE_FORMAT_LC3'))); ?>
</dd>
<?php endif; ?>
<?php if ($params->get('show_modify_date')) : ?>
<dd class="modified">
<span class="icon-calendar"></span>
<?php echo JText::sprintf('COM_CONTENT_LAST_UPDATED', JHtml::_('date', $this->item->modified, JText::_('DATE_FORMAT_LC3'))); ?>
</dd>
<?php endif; ?>
<?php if ($params->get('show_hits')) : ?>
<dd class="hits">
<span class="icon-eye-open"></span> <?php echo JText::sprintf('COM_CONTENT_ARTICLE_HITS', $this->item->hits); ?>
</dd>
<?php endif; ?>
</dl>
<?php if ($this->params->get('show_tags', 1)) : ?>
<?php $this->item->tagLayout = new JLayoutFile('joomla.content.tags'); ?>
<?php echo $this->item->tagLayout->render($this->item->tags->itemTags); ?>
<?php endif; ?>
<?php endif; ?>
<?php if ($params->get('show_readmore') && $this->item->readmore) :
if ($params->get('access-view')) :
$link = JRoute::_(ContentHelperRoute::getArticleRoute($this->item->slug, $this->item->catid));
else :
$menu = JFactory::getApplication()->getMenu();
$active = $menu->getActive();
$itemId = $active->id;
$link1 = JRoute::_('index.php?option=com_users&view=login&Itemid=' . $itemId);
$returnURL = JRoute::_(ContentHelperRoute::getArticleRoute($this->item->slug, $this->item->catid));
$link = new JUri($link1);
$link->setVar('return', base64_encode($returnURL));
endif; ?>
<p class="readmore"><a class="btn" href="<?php echo $link; ?>"> <span class="icon-chevron-right"></span>
<?php if (!$params->get('access-view')) :
echo JText::_('COM_CONTENT_REGISTER_TO_READ_MORE');
elseif ($readmore = $this->item->alternative_readmore) :
echo $readmore;
if ($params->get('show_readmore_title', 0) != 0) :
echo JHtml::_('string.truncate', ($this->item->title), $params->get('readmore_limit'));
endif;
elseif ($params->get('show_readmore_title', 0) == 0) :
echo JText::sprintf('COM_CONTENT_READ_MORE_TITLE');
else :
echo JText::_('COM_CONTENT_READ_MORE');
echo JHtml::_('string.truncate', ($this->item->title), $params->get('readmore_limit'));
endif; ?>
</a></p>
<?php endif; ?>
<?php if ($this->item->state == 0) : ?>
</div>
<?php endif; ?>
<?php echo $this->item->event->afterDisplayContent; ?>
Have you tried to override the template?
Please read the documentation on the link above. They also give examples of the template you just mentioned, for example editing the html/com_content/article/default.php.
i'm making a multilanguage website which uses the advanced custom fields relationship plugin. I'm reading out employers and if i read em out in the site's native language i have zero problems, however when i try to read them out in another language i get back a empty array.
Do any of you guys know what i can do?
<?php
$field = get_post_meta( get_the_id() );
$posts = get_field('field_81');
echo '<!--';
echo 'test ';
var_dump( $field );
var_dump( $posts );
echo '-->';
?>
<?php
if (ICL_LANGUAGE_CODE == 'en'):
?>
<?php
$fields = $field['medewerkers'];
?>
<?php
$posts = $fields;
?>
<?php
endif;
?>
<?php
if ($posts):
?>
<?php
if (ICL_LANGUAGE_CODE == 'nl'):
?>
<h3 class="titelmedewerkers">Medewerkers</h3>
<?php
elseif (ICL_LANGUAGE_CODE == 'en'):
?>
<h3 class="titelmedewerkers">Employees</h3>
<?php
elseif (ICL_LANGUAGE_CODE == 'fr'):
?>
<h3 class="titelmedewerkers">Employes</h3>
<?php
else:
?>
<h3 class="titelmedewerkers">Medewerkers</h3>
<?php
endif;
?>
<ul class="medewerkers">
<?php
foreach ($posts as $post): // variable must be called $post (IMPORTANT)
?>
<?php
setup_postdata($post);
?>
<li class="shadow">
<strong><?php
the_title();
?></strong><br />
<?php
if (get_field('foto')):
?>
<?php
$attachment_id = get_field('foto');
$size = "medium";
$image = wp_get_attachment_image_src($attachment_id, $size);
?>
<img src="<?php echo $image[0]; ?>" alt="<?php the_title(); ?>" /><br />
<?php
endif;
?>
<?php
if (get_field('afdeling')):
?>
<?php
the_field('afdeling');
?><br />
<?php
endif;
?>
<?php
if (get_field('titel')):
?>
<?php
the_field('titel');
?><br />
<?php
endif;
?>
<?php
if (get_field('tel')):
?>
<?php the_field('tel'); ?><br />
<?php
endif;
?>
</li>
<?php
endforeach;
?>
<?php
wp_reset_postdata();
?>
</ul>
<?php
endif;
?>
<?php
wp_reset_postdata();
?>
this part:
<?php
if (ICL_LANGUAGE_CODE == 'en'):
?>
<?php
$fields = $field['medewerkers'];
?>
<?php
$posts = $fields;
?>
<?php
endif;
?>
creates $post only when en, not surprising that you don't have it in other languages
I have an if statement that is at the end of a for each loop that adds the | character at the end of a generated unordered list.
My goal is to add | after "not the last two".
<?php if (! $_link->getIsLast()):?>|<?php endif;?>
I was hoping I could input a value in the getIsLast or getIsFirst functions like this:
<?php if (! $_link->getIsLast(2)):?>|<?php endif;?>
I was hoping the above statement would add the | character for each generated list item except for the last two. However, it doesn't seem to be working.
Does anyone know the proper syntax to do something like this?
The for each loops is below:
<ul class="links pull-right"<?php if($this->getName()): ?> id="<?php echo $this->getName() ?>"<?php endif;?>>
<?php foreach($_links as $_link): ?>
<?php if ($_link instanceof Mage_Core_Block_Abstract):?>
<?php echo $_link->toHtml() ?>
<?php else: ?>
<li<?php if($_link->getIsFirst()||$_link->getIsLast()): ?> class="<?php if($_link->getIsFirst()): ?>first<?php endif; ?><?php if($_link->getIsLast()): ?> last<?php endif; ?>"<?php endif; ?> <?php echo $_link->getLiParams() ?>><?php echo $_link->getBeforeText() ?><a href="<?php echo $_link->getUrl() ?>" title="<?php echo $_link->getTitle() ?>" <?php echo $_link->getAParams() ?>><?php echo $_link->getLabel() ?></a><?php echo $_link->getAfterText() ?></li>
<?php endif;?>
<?php if (! $_link->getIsLast()):?>|<?php endif;?>
<?php endforeach; ?>
</ul>
Try this.
<ul class="links pull-right"<?php if($this->getName()): ?> id="<?php echo $this->getName() ?>"<?php endif;?>>
<?php
$numberOfRows = count($_links);
$currentIndex=0;
foreach($_links as $_link):
?>
<?php if ($_link instanceof Mage_Core_Block_Abstract):?>
<?php echo $_link->toHtml() ?>
<?php else: ?>
<li<?php if($_link->getIsFirst()||$_link->getIsLast()): ?> class="<?php if($_link->getIsFirst()): ?>first<?php endif; ?><?php if($_link->getIsLast()): ?> last<?php endif; ?>"<?php endif; ?> <?php echo $_link->getLiParams() ?>><?php echo $_link->getBeforeText() ?><a href="<?php echo $_link->getUrl() ?>" title="<?php echo $_link->getTitle() ?>" <?php echo $_link->getAParams() ?>><?php echo $_link->getLabel() ?></a><?php echo $_link->getAfterText() ?></li>
<?php endif;?>
<?php if ($currentIndex<$numberOfRows-2):?>|<?php endif;?>
<?php
$currentIndex++;
endforeach; ?>
</ul>
|