-
AuthorPosts
-
August 10, 2014 at 7:05 am #200389
Hi,
After some modification, we update and redesign the layout and functions from Magz theme here:
http://sjoomla3.abouthair.tw/magz/We modified those files to adapt masonry list:
/templates/ja_magz/html/com_content/featured/default.php
/templates/ja_magz/html/com_content/featured/default_item.phpWe want to make the featured articles listed on main page sorting by date (desc) or random.
Sort by date is a default behavior, and we try to hack the code by adding “RAND()” into sql statement, but we are not lucky enough, can’t find the key file to complete this mission.We find an article about sorting random here this forum, still not work, any advice is welcome and we appreciate any replies about how to add this feature, thanks in advance.
Saguaros ModeratorSaguaros
- Join date:
- September 2014
- Posts:
- 31405
- Downloads:
- 237
- Uploads:
- 471
- Thanks:
- 845
- Thanked:
- 5346 times in 4964 posts
August 11, 2014 at 4:09 pm #545499Hi
In the home page of this JA Magz template, we use menu item type of ‘Featured articles‘ and it will display due to the settings of home menu item in your site. These are some hints to add random option:
– Add a ‘Random‘ option in the ‘Article order’ parameter in Layout settings of this menu item via file: /root/components/com_content/views/featured/tmpl/default.xml, look for this field:
<field name="orderby_sec" type="list" description="JGLOBAL_ARTICLE_ORDER_DESC" label="JGLOBAL_ARTICLE_ORDER_LABEL" >
<option value="">JGLOBAL_USE_GLOBAL</option>
<option value="front">COM_CONTENT_FEATURED_ORDER</option>
<option value="rdate">JGLOBAL_MOST_RECENT_FIRST</option>
<option value="date">JGLOBAL_OLDEST_FIRST</option>
<option value="alpha">JGLOBAL_TITLE_ALPHABETICAL</option>
<option value="ralpha">JGLOBAL_TITLE_REVERSE_ALPHABETICAL</option>
<option value="author">JGLOBAL_AUTHOR_ALPHABETICAL</option>
<option value="rauthor">JGLOBAL_AUTHOR_REVERSE_ALPHABETICAL</option>
<option value="hits">JGLOBAL_MOST_HITS</option>
<option value="rhits">JGLOBAL_LEAST_HITS</option>
<option value="order">JGLOBAL_ORDERING</option>
<option vlaue="random">Random</option>
</field>
– Alter the query: /root/components/com_content/helpers/query.php, you will need to add a random option like so:case 'random' :
$orderby = 'RAND()';
break;Please note that this customization requires hack in code of core Joomla so it’s best if you also raise the same thread into Joomla forum for better answer there.
1 user says Thank You to Saguaros for this useful post
-
AuthorPosts
This topic contains 2 replies, has 2 voices, and was last updated by Saguaros 10 years, 3 months ago.
We moved to new unified forum. Please post all new support queries in our New Forum