So i've did this into my template php file to show different header between Item and Itemlist views.
<!-- BLOG HEADER RENDER -->
<?php $com=JRequest::getCmd( 'option'); $view=JRequest::getCmd( 'view'); $img=JRequest::getCmd( 'CatItemImage'); if($com=='com_k2' && $view!='item' ): ?>
<div class="headerblog">
<h2>Lorem Ipsum <span>dolore algo mais...</span> </h2>
</div>
<?php else: ?>
<img src="<?php echo $img ;?>" width="100%" height="380px" />
<?php endif ?>
The condition works well, but I am having problems to get CatItemImage from Item view.
Joomla Version: 3.2
K2 Version: 2.6.7
Anybody could help? Thanks in advance!
Related
I create custom theme and I am trying to create a contact form using wpform but for some reasons the form doesn't show on my page
here is a code from the custom theme
<?php
/* Template Name: CallUS*/
get_header();?>
<section>
<div class="u-clearfix u-sheet u-valign-middle-xs u-sheet-1">
<h1>
call us
</h1>
<img
class="u-image u-image-default u-image-1 u-hidden-xs"
src="<?php bloginfo('template_directory');?>/images/---1113.png"
alt=""
data-image-width="800"
data-image-height="972"
/>
</div>
</section>
<?php get_footer();?>
and this picture from the form that I have created using wpform
Way 01:
You must have the_content() function in order to show page contents. I've edited your code so you can see how to do it:
<?php
/* Template Name: CallUS*/
get_header();?>
<section>
<div class="u-clearfix u-sheet u-valign-middle-xs u-sheet-1">
<h1>
call us
</h1>
<img
class="u-image u-image-default u-image-1 u-hidden-xs"
src="<?php bloginfo('template_directory');?>/images/---1113.png"
alt=""
data-image-width="800"
data-image-height="972"
/>
<?php
while ( have_posts() ) :
the_post();
the_content();
endwhile; // End of the loop.
?>
</div>
</section>
<?php get_footer();?>
Then you've to select CallUS Page Template from below page:
Way 02:
If you go to the WPForms from the menu then you can see the shortcode column on each row. it will be like [wpforms id="123"]
Copy your design shortcode from there and use that directly into your file like below:
<?php
/* Template Name: CallUS*/
get_header();?>
<section>
<div class="u-clearfix u-sheet u-valign-middle-xs u-sheet-1">
<h1>
call us
</h1>
<img
class="u-image u-image-default u-image-1 u-hidden-xs"
src="<?php bloginfo('template_directory');?>/images/---1113.png"
alt=""
data-image-width="800"
data-image-height="972"
/>
<?php echo do_shortcode('[wpforms id="3306"]');?>
</div>
</section>
<?php get_footer();?>
What's the best way to make multiply-page menu?
For example Category1 -> Article -> Full article text?
Not dropdown menu.
There's site example: http://fl.jetcode.lv/service.html
There are on page "Услуги" (Services), list with point's (Обслуживание windows, Подключение интернета, Сборка компьютеров, Чистка вирусов, ...)
When i click one of them (for example 'Обслуживание windows'('Maintenance windows')), i need to get page with points of that category like Установка Windows XP /Vista /7 /8 / W.S 2003,2008 (Installing Windows), Установка Linux (Installing Linux). And each Category have their own list of that text. So what's the best way to make that?
By steps:
1. I'm here: http://fl.jetcode.lv/index.html
2. I click on 'Обслуживание windows', and go to that page http://fl.jetcode.lv/service.html
3. Now i see a list with services on that category
4. Click on 'Полное описание', under 'Установка Windows XP /Vista /7 /8 / W.S 2003,2008'
5. And get to that page http://fl.jetcode.lv/service_inside.html
So how i can structure that's menu with WordPress ?
I've created a Posts with first categories (Category1), then i added it to Appearance->Menus, and get that list on page. Now i can manage their content in post, but it will be hard for end-user. So i trying to make list with second-category in post, and stucked. So can somebody please advice how it correctly/better to do ?
Thanks!
To put this simply,
You won't be needed to change anything to header but in category.php.
Instead of including the <section id="menu"> in the header put it on categories.php then to the usual get post contents and you are done.
The logic isn't in the menu but the flow of how you call each file/element.
This is the sample structure in category.php
<h1 class="post-title"><?php single_cat_title(); ?></h1>
<!-- Display all posts under specific Category -->
<?php while(have_posts()): the_post(); ?>
<hr />
<div id="category-post">
<!-- Display the Post Title -->
<h1><?php the_title(); ?></h1>
<!-- Display the Date & Time of Post -->
<p class="post-date">Posted on <span><?php the_time('F j, Y'); ?></span></p>
<!-- Checks if the post has Featured Image, else will load
the default thumbnail called post-thumb.jpg.
Delete ELSE CLAUSE to remove default thumbnail feature.
-->
<?php
if ( has_post_thumbnail() ) {
the_post_thumbnail( add_image_size( 'post-thumbnail'), array( 'class' => "post-thumb" ) );
}
else {
echo '<img class="post-thumb wp-post-image" src="';
echo bloginfo( 'stylesheet_directory' );
echo '/_/img/post-thumb.jpg" />';
}
?>
<!-- Display the excerpt if specified IF NOT, will display the
first 20 words in the actual content.
See functions.php for the excerpt lenght setting.
-->
<div class="category-content">
<?php the_excerpt();?>
</div>
<!-- Displays a link to the actual post -->
<a class= "category-read" href="<?php echo get_permalink() ?>">Read</a>
</div>
<?php endwhile; ?>
<!-- Displays the link for NEXT and PREVIOUS entries.
By default, only 10 posts per page can be loaded.
See [Settings > Reading] in Wordpress Panel to configure
-->
<div id='paging'>
<?php next_posts_link('« Older Entries ') ?>
|
<?php previous_posts_link(' Newer Entries »') ?>
</div>
I have a few nested divs on a website I am creating with the Joomla engine. The problem lies mainly in the fact that the plugins themselves nest 2 divs inside my already created div "banner", meaning I do not have access to these two divs. Within them is the small, rectangular image. This image should help you see my issue (I'd post an embedded image but you know, apparently I need 10 rep):
http://www.nerfarena.net/SiteImage.PNG
I don't want the banner ad butted against the search bar. But the three nested divs will not increase in height no matter what CSS properties I modify. Even #banner won't budge. They all seem to size themselves to the minimum needed (bottom of the search bar + banner ad's height). I'm looking for a way around this so any suggestions would be really appreciated.
Here is the chunk of the php file where the divs I am concerned about are:
`
<!-- Logo -->
<div id="logo">
<?php if ($logo && $logoimage == 1): ?>
<img src="<?php echo htmlspecialchars($logo); ?>" alt="<?php echo $sitename; ?>" />
<?php endif; ?>
<?php if (!$logo || $logoimage == 0): ?>
<?php if ($sitetitle): ?>
<?php echo htmlspecialchars($sitetitle); ?><br/>
<?php endif; ?>
<?php if ($sitedescription): ?>
<div class="sitedescription"><?php echo htmlspecialchars($sitedescription); ?></div>
<?php endif; ?>
<?php endif; ?>
</div>
<!-- Search -->
<div id="search">
<jdoc:include type="modules" name="position-0" />
</div>
<!-- Banner -->
<div id="banner" style= "text-align: right;">
<jdoc:include type="modules" name="banner-position" />
</div>
</div>
`
Try using sibling selectors for CSS. Sometimes it helps me fix the alignments of divs.
Hello and thanks for reading. I am a .NET developer and don't know PHP (Although I am working on learning on the job) and what I am working on was made my consultants that we dont have contact with anymore. When a news post is clicked it appears to display using a template single.php. Followed is the code for this page:
<div id="marketBanner">
<div id="banner">
<img src="<?php bloginfo('stylesheet_directory'); ?>/images/services-banner.jpg" alt="" />
</div>
<div id="breadcrumbWrap">
<div id="breadcrumbs">
<?php
if(function_exists('bcn_display'))
{
bcn_display();
}
?>
</div>
</div>
</div>
<div id="content">
<div class="left">
<h2><?php the_title(); ?></h2><br />
<?php if (have_posts()) : while (have_posts()) : the_post(); ?>
<div class="the_details">
Posted: <?php the_date(); ?> | View All News
</div>
<?php the_content(''); ?>
<?php endwhile; endif; ?>
</div>
Why does this page get used when a post is chosen? I want only a certain category of post to use this page and another category of post to use a different template. How do I achieve this?
You need to study the Wordpress Template Hierarchy # https://codex.wordpress.org/Template_Hierarchy#Single_Post_display
A template (PHP file) is looked for in this order (only on wordpress).
1 - single-{post_type}.php - If the post type were product, WordPress would look for single-
2 - product.php
3 - single.php
4 - index.php
In your case I would use single.php to create a template for the average post then specifically create a template for the one you want different using single-'post_type'.php
You can change the post type when creating a post.
Take a look at the Wordpress Template Hierarchy. It explains which templates get used and will probably be super helpful if you're just starting out with WP. You can use WP syntax to create category pages - but at the archive level - not the single post level.
To create separate pages based on post categories see here and below:
<?php
$post = $wp_query->post;
if (in_category(9)) {
include (TEMPLATEPATH.'/single-specific9.php');
return;
}
if (in_category(8)) {
include (TEMPLATEPATH.'/single-specific8.php');
return;
}
if (in_category(11)) {
include (TEMPLATEPATH.'/single-specific11.php');
return;
}
Site: http://bit.ly/13GerYd
I am using Joomla 3 with default Protostar template. I have created a "Tag Selected" module which just shows all pages with a specific tag. It works fine in the sidebar but for some reason when I position the module in the footer the TITLE does not appear. I have toggled Show/Hide title from the module and nothing. It's setup the same way as the ones in the blue sidebar area and I don't see it in the DOM so CSS is not hiding it.
Has anyone had this issue? The "Tag Selected" php template is below but I didn't want to edit this since the module works in other positions. Thoughts?
<?php JLoader::register('TagsHelperRoute', JPATH_BASE . '/components/com_tags/helpers/route.php'); ?>
<div class="tagsselected<?php echo $moduleclass_sfx; ?>">
<?php if ($list) : ?>
<ul>
<?php foreach ($list as $i => $item) : ?>
<li>
<?php $item->route = new JHelperRoute; ?>
<a href="<?php echo JRoute::_(TagsHelperRoute::getItemRoute($item->content_item_id, $item->core_alias, $item->core_catid, $item->core_language, $item->type_alias, $item->router)); ?>">
<?php if (!empty($item->core_title)) :
echo htmlspecialchars($item->core_title);
endif; ?>
</a>
</li>
<?php endforeach; ?>
</ul>
<?php else : ?>
<span><?php echo JText::_('MOD_TAGS_SIMILAR_NO_MATCHING_TAGS'); ?></span>
<?php endif; ?>
Figured out that the module title does not show up in the footer if there were no style given to the footer modules. This solution is made in your template index.php file - Templates/YOURTEMPLATE/index.php:
in the fooer part there is a code like:
Code:
<jdoc:include type="modules" name="footer" />
Replace it with this following code,
Code:
<jdoc:include type="modules" name="footer" style="xhtml" />