Expression Engine list category entry only - expressionengine

With the code below, I am currently showing all the categories for the channel, but I only need to show the category or categories for each entry. They have been checkboxed in each seperate entry.
What am I missing?
{exp:channel:entries channel="news" dynamic="no" orderby="date" sort="desc" }
<article class="listing">
<h2>{title}</h2>
<p>Posted on: {entry_date format="%F %j, %Y"} in {exp:channel:categories channel="news" style="linear" show_empty="no"}
{category_name},{/exp:channel:categories}</p>
<p class="summary">{news_summary}</p>
<p style="margin-top: 10px;"><a href='{url_title_path='news/view'}'>Read More</a></p>
</article>
{/exp:channel:entries}

Problem was, I was using regular channel type tags for categories. The correct code for this is....
{exp:channel:entries channel="news" dynamic="no" orderby="date" sort="desc" }
<article class="listing">
<h2>{title}</h2>
<p>Posted on: {entry_date format="%F %j, %Y"} in
{categories backspace="1"}
{category_name},
{/categories}</p>
<p class="summary">{news_summary}</p>
<p style="margin-top: 10px;"><a href='{url_title_path='news/view'}'>Read More</a></p>
</article>
{/exp:channel:entries}

Related

Remove tracking URL parameters from WordLift Faceted Search (Related Articles)

Can we remove the tracking urls parameters ?utm_source=wordlift&utm_medium=wl_faceted&utm_campaign=recommendations used in the related article section?
Yes, WordLift Faceted Search uses a Handlebars template.
The default template looks like this:
<script id="faceted-search-template" type="text/x-handlebars-template">
<aside class="wl-cloud-widget-wrapper wl-faceted-wrapper wordlift-cloud-widget wordlift-faceted">
<h3>{{title}}</h3>
<nav class="chips">
{{#each entities}}
<span class="chip {{activeClass}}" data-referenced-posts="{{referencedPosts}}"
data-id="{{id}}">{{label}}</span>
{{/each}}
</nav>
<section class="cards">
{{#each posts}}
<article class="card" data-post-id="{{ID}}">
<a href="{{permalink}}?utm_source=wordlift&utm_medium=wl_faceted&utm_campaign=recommendations">
{{#if thumbnail}}
<div class="thumbnail" style="background-image: url('{{thumbnail}}');"></div>
{{/if}}
<div class="card-content">
<header class="title">{{post_title}}</header>
</div>
</a>
</article>
{{/each}}
</section>
<nav class="nav-links">
<span class="nav-link previous">❮</span>
<span class="nav-link next">❯</span>
</nav>
</aside>
</script>
A developer can create a new template and embed it into the page, then set the template_id property of the wl_faceted shortcode to the id of the new template.

Customize kendo panelbar item header

I have the following panelbar:
<kendo-panelbar *ngIf="mainMenu"
[expandMode]="expandMode">
<kendo-panelbar-item [title]="menuItem.title" *ngFor="let menuItem of mainMenu" iconClass="fa fa-lg {{menuItem.faIcon}}"
[routerLink]="menuItem.link" routerLinkActive="active">
<kendo-panelbar-item [title]="menuItemSub.title" *ngFor="let menuItemSub of menuItem.sub"
[routerLink]="menuItemSub.link" routerLinkActive="active">
</kendo-panelbar-item>
</kendo-panelbar-item>
</kendo-panelbar>
An example of the generated item is like this:
<kendo-panelbar-item routerlinkactive="active" tabindex="0" ng-reflect-router-link="/dashboard-edge"
ng-reflect-router-link-active="active" ng-reflect-title="Dashboard Edge"
ng-reflect-icon-class="fa fa-lg fa-window-maximize" role="treeitem"
class="k-item k-state-default " id="k-panelbar-item-default-1" aria-selected="false">
<span class="k-link k-header">
<!--bindings={"ng-reflect-ng-if": "fa fa-lg fa-window-maximize"}-->
<span class="k-icon fa fa-lg fa-window-maximize" ng-reflect-klass="k-icon"
ng-reflect-ng-class="[object Object]">
</span>
<!--bindings={"ng-reflect-ng-if": ""}-->
Dashboard Edge
<!--bindings={}-->
<!--bindings={"ng-reflect-ng-if": "false"}-->
</span>
<!--bindings={"ng-reflect-ng-if": "false"}-->
</kendo-panelbar-item>
How can I customize the content of the item (with HTML) so that I can get more control of how the information is displayed? For instance, I would like to have the title wrapped in a <span> tag with some specific class.
I'm able to customize the content using templates, but not the header itself.
Telerik support helped me with this.
Basically, you only need to:
Pass null to [title] binding
And create the ng-template with the kendoPanelBarItemTitle directive
Here is an example:
<kendo-panelbar *ngIf="mainMenu"
[expandMode]="expandMode">
<kendo-panelbar-item [title]="null" *ngFor="let menuItem of mainMenu" iconClass="fa fa-lg {{menuItem.faIcon}}"
[routerLink]="menuItem.link" routerLinkActive="active" [attr.name]="menuItem.name">
<ng-template kendoPanelBarItemTitle>
<span class="item-title">{{menuItem.title}}</span>
</ng-template>
<kendo-panelbar-item [title]="null" *ngFor="let menuItemSub of menuItem.sub"
[routerLink]="menuItemSub.link" routerLinkActive="active" [attr.name]="menuItemSub.name">
<ng-template kendoPanelBarItemTitle>
<span class="sub item-title">{{menuItemSub.title}}</span>
</ng-template>
</kendo-panelbar-item>
</kendo-panelbar-item>
</kendo-panelbar>
Example provided by Telerik guys: example

How to show a message if there are no products inside a category with exp:resso store plugin?

I'm using the latest version of EE2 and a plugin called Exp:resso store.
I have products assigned to a category and for the most part all of this is working fine. Below is my code:
<div class="col-md-7">
{exp:channel:categories channel="products" style="linear"}
<section class="section accordion repeater">
<h3>
{category_name}
<div class="icon">
<img src="/assets/local/img/plus-icon.jpg" alt="">
</div>
</h3>
<div class="accordion-content">
{exp:store:search orderby="title" sort="asc" category="{category_id}"}
{exp:store:product entry_id="{entry_id}"}
<p class="accordion-download">
{title} - {price}
<span><img src="/assets/local/img/add-to-cart.jpg" alt="">Add to cart</span>
</p>
{/exp:store:product}
{/exp:store:search}
</div>
</section>
{/exp:channel:categories}
</div>
I'm trying to find a way to show a No products exist message if the category doesn't have anything inside of it. I've tried using {count}, {total_results} & {total_rows} to check if there aren't any products. Problem is everything I try is obviously wrong because nothing gets output :/
Thanks in advance
The store search tag is a wrapper for the channel entries tag pair so you would need to use the {if no_results} tag pair.
<div class="col-md-7">
{exp:channel:categories channel="products" style="linear"}
<section class="section accordion repeater">
<h3>
{category_name}
<div class="icon">
<img src="/assets/local/img/plus-icon.jpg" alt="">
</div>
</h3>
<div class="accordion-content">
{exp:store:search orderby="title" sort="asc" category="{category_id}"}
{exp:store:product entry_id="{entry_id}"}
<p class="accordion-download">
{title} - {price}
<span><img src="/assets/local/img/add-to-cart.jpg" alt="">Add to cart</span>
</p>
{/exp:store:product}
{if no_results}
There are no products
{/if}
{/exp:store:search}
</div>
</section>
{/exp:channel:categories}
</div>
Should also be mentioned if you are not creating a form for the to add the products to the cart you could use the {store_field_short_name:price} variable to reduce the number of queries on your page. Most store things such as sku, weight, measurements can all be access by using the field short name followed by :variable

Error in Expression Engine Embed

I have a site I'm working on at the moment, in which I have a sidebar displaying the 10 most recent posts (titles as links). I'm calling this in with the Embed function.
Though when I am looking on the individual post itself, the list only displays the post title that I'm on.
My embedded code calls all 10 of the recent posts in a exp:channels entry normal way.
Is there something I've done wrong? Below is the code for the main blog page:
{embed="embeds/html_header"}
<!-- content -->
{embed="embeds/html_blog_top"}
<div class="container">
<div class="row">
{embed="embeds/html_blog_sidebar"}
{exp:channel:entries channel="blog" limit="1"}
<div class="span8">
<article>
<header class="postHeader">
<div class="row-fluid">
<div class="span3 postDate">{entry_date format="%d"}<span>{entry_date format="%F"}</span></div>
<div class="span9 postPic">
<div class="imgWrapper">
{blog_image}
</div>
</div>
</div>
</header>
<div class="row">
<section class="span6 offset2">
<h2>{title}</h2>
<p>{full_entry}</p>
<p><span class='st_sharethis' displayText='ShareThis'></span>
<span class='st_facebook' displayText='Facebook'></span>
<span class='st_twitter' displayText='Tweet'></span>
</p>
</section>
</div>
</article>
</div>
{/exp:channel:entries}
</div>
</div>
</section>
<!-- footer -->
{embed="embeds/html_footer"}
This is the sidebar embed:
<aside class="span4" style="float:right;">
<section class="widget search clearfix">
<h3>news</h3>
<p>
{exp:channel:entries channel="blog" limit="10" orderby="date"}
{title}<br>
{/exp:channel:entries}
</p>
</section>
<section class="widget">
<h3>Archives</h3>
<ul>
<li>
{exp:channel:month_links channel="blog"}
{month} {year}<br>
{/exp:channel:month_links}
</li>
</ul>
</section>
</aside>
Its just the bit with the news section that I can't seem to get as a full list on the individual page.
Add dynamic="no" to your embed entries loop and you should be good.
Also, if you want answers on ExpressionEngine questions more quickly, try posting to expressionengine.stackexchange.com

ExpressionEngine pagination - one template, multiple channels

I've create a blog using a few templates in ExpressionEngine 2, but am struggling with how to get pagination implemented in the main/list view. I can obviously reduce the entry limit and apply the paginate attribute to the channel tag, but it doesn't work properly. It simply outputs the pagination links, but each link simply goes to a standalone page with only the newest entry.
I feel as though I may be missing something obvious, but I'm really not sure. I'd appreciate it if anyone has any input/suggestions as to how to properly implement things.
{exp:channel:entries channel="notes_entry|notes_link|notes_photo|notes_quote|notes_video" limit="20" orderby="date"}
{if channel_short_name == 'notes_link'}
<div class="link">
<h2>{title}</h2>
{notes-link-description}
<span class="date">Posted on {entry_date format="%F %j, %Y"} | Permalink</span>
</div>
{if:elseif channel_short_name == 'notes_quote'}
<div class="quote">
<h2>{title}</h2>
<blockquote>{notes-quote}</blockquote>
<span class="source">{notes-quote-source}</span>
{notes-quote-description}
<span class="date">Posted on {entry_date format="%F %j, %Y"} | Permalink</span>
</div>
{if:elseif channel_short_name == 'notes_entry'}
<div class="entry">
<h2>{title}</h2>
<span class="author">Written by {author}</span>
<p>{notes-entry-summary} <span>Read More…</span></p>
<span class="date">Posted on {entry_date format="%F %j, %Y"} | Permalink</span>
</div>
{if:elseif channel_short_name == 'notes_photo'}
<div class="photo">
<h2>{title}</h2>
<img src="{notes-photo-upload}" alt="" />
{notes-photo-description}
<span class="date">Posted on {entry_date format="%F %j, %Y"} | Permalink</span>
</div>
{if:elseif channel_short_name == 'notes_video'}
<div class="video">
<h2>{title}</h2>
<div class="video-container">
<!-- start of embed code -->
{notes-video-embed}
<!-- end of embed code -->
</div>
{notes-video-description}
<span class="date">Posted on {entry_date format="%F %j, %Y"} | Permalink</span>
</div>
{/if}
{/exp:channel:entries}
Here's a simplified example of paginating multiple channel entries, using the Agile Records theme:
{exp:channel:entries channel="about|news" dynamic="on" limit="5" paginate="bottom"}
<p>
{if channel_short_name == "about"}
<!-- Link to the About Section Entries -->
{title}
{if:else}
<!-- Link to the News Section Entries -->
{title}
{/if}
</p>
{paginate}
<p>Page {current_page} of {total_pages} pages {pagination_links}</p>
{/paginate}
{/exp:channel:entries}
The output of the paginate tag pair results in the following markup:
<p>
Page 1 of 5 pages
<strong>1</strong>
2
3
>
Last ›
</p>
Which looks like the following unstyled HTML in a browser:
The creative use of the {channel_short_name} conditional allows this single code block to link to each respective section's correct single entry page URL:
About the Label
Getting to Know ExpressionEngine

Resources