Theme: Code Snippets for Dynamic Content ======================================== You can pull various pieces of dynamic content into your Tendenci theme template. Before adding the snippets below be sure that your template file has the "load" tag for that module at the top of your page. Example: if you were to add an event feed you would want `{% load event_tags %}` pasted at the very top of your html doc. For more tag references, check out the docs built into your site at: yourdomain/admin/doc/tags/ Event Feed ------------ Add `{% load event_tags %}` to the very top of your html page Then add the following code snippet where you want to place your event feed: .. code-block:: django {% list_events as events_list limit=3 %} {% if event_list %} {% trans 'View more events' %} ยป {% endif %} Single Event (featured event) ----------------------------- Add `{% load event_tags %}` to the very top of your html page Then add the following code snippet where you want to place your event feed: .. code-block:: django {% list_events as events_list limit=1 %}

Featured Event

{% if events_list %} {% for event in events_list %}
{% if event.image %} {{ event.title }} {% else %} {% endif %}

{{ event.start_dt|date:"F d, Y" }}

{{ event.title }}

{{ event.description|striptags|truncatewords:"30"|safe }}

Read More »

{% endfor %} {% else %}

Add an Event Today to See Something Here

{% now "F d, Y" %}

This is example of what your event description will look like. Where is this text source?. Start adding Events to start adding your own content today!

{% if request.user.is_authenticated %}

Display your next upcoming event right on your homepage. Once you add your first event, this area will be replaced by that information. Don't forget to add an evennt photo!

{% endif %}

Read More »

{% endif %}
Time Display on Event Feed (hide time if all day) ------------------------------------------------- {% if event.all_day %}{{ event.start_dt|date:"F j, Y" }}{% else %}{{ event.start_dt }}{% endif %} Articles Feed ------------- Add `{% load article_tags %}` to the very top of your html page Then add the following code snippet where you want to place your articles feed: .. code-block:: django {% list_articles as articles_list limit=3 %} Insert Box ----------- Add `{% load box_tags %}` to the very top of your html page Then add the following code snippet where you want to place your box: (The number 13 should be replaced with the number associated with the box you would like to load) .. code-block:: django {% box 13 %} Inside the boxes interface, adding code allows you to add images, add Font-Awesome Icons, and responsive Bootstrap Layouts. .. image:: img/boxexample.png .. Tip:: .. hidden-code-block:: django :label: + Show Added HTML for Layout
{% box 5 %}
{% box 4 %}
.. image:: img/insidebox.png .. hidden-code-block:: html :label: + Show Added HTML Inside Donation Box <> (Left)

  Donate

Online Donations from supporters like you allow us to achieve our purpose throughout the year. We appreciate your generous donation; please donate today using our simple online donation!

Donate Now  

 

.. hidden-code-block:: css :label: + Show Added CSS /* BG-DARK HOMEPAGE */ .bg-dark { padding: 20px 10px 50px 20px; background: #2b2b2b; } #box-5 , #box-4 { border: 1px solid #54b848; border-radius: 8px; margin:20px; background-color: #323232; } #box-5 h3 { font-size: 45px; text-transform:none; border-bottom: 1px solid #54b848; padding:0 0 10px 30px; width:100%; font-family: FontAwesome, "Assistant", sans-serif; font-weight:600; color: #54b848; } #box-4 h3 { font-size: 45px; text-transform:none; padding:0 0 0 30px; width:100%; font-family: FontAwesome, "Assistant", sans-serif; font-weight:600; font-size:35px; color: #54b848; } #box-5 p>a { background-color: #54b848; color: white; text-align: center; padding: 10px 20px; border-radius: 8px; font-weight:600; text-transform: uppercase; float: right; position: relative; left: -20%; font-size: 20px; } #box-5 p>a:hover { text-decoration:none; background-color: #3333ff; } #box-4 p>a { color:#54b848; font-weight:600; font-size:18px; } #box-5 p { font-weight:200; padding: 10px 30px 0 30px; } #box-4 p { font-weight:200; padding: 0px 30px 0 30px; } Bootstrap Carousel ------------------ Add `{% load story_tags %}` to the very top of your html page Then add the following code snippet where you want to place your carousel: .. code-block:: django {% list_stories as stories_list limit=10 tags="rotator" quality="80" data-interval="5000" %} Directories Carousel -------------------- Add `{% load directory_tags %}` to the very top of your html page Then add the following code snippet where you want to place your directories: .. code-block:: django
Directories (use with flexslider) --------------------------------- Add `{% load directory_tags %}` to the very top of your html page Then add the following code snippet where you want to place your directories: .. code-block:: django {% list_directories as directories_list limit=20 tags="sponsor" %} Jobs Feed ---------- Add `{% load job_tags %}` to the very top of your html page Then add the following code snippet where you want to place your jobas: .. code-block:: django {% list_jobs as jobs_list limit=3 %} {% for job in jobs_list %}

{{ job.title }} »

{{ job.location }}

{% empty %}

{% if user.profile.is_superuser %}{Add your first job{% else %}Great New Job{% endif %}

Houston: A new job opening is available...

{% endfor %} Simple Job Feed Layout .. image:: img/jobboard.png .. Tip:: .. hidden-code-block:: django :label: + Show HTML

Hire in our Network

Learn more and post a job.

Post a Job

Get Hired

Search our jobs board and find a job.

Visit Job Board

Job Board

{% list_jobs as jobs_list limit=3 %} {% for job in jobs_list %}

{{ job.title }}

{{ job.description|striptags|truncatewords:"10"|safe }}
Posted on: {% now "M d" %}

{% endfor %}
.. hidden-code-block:: css :label: + Show CSS #homepage-jobs-board { background-color: white; } .homepage-jobs-cta { background-color: #f1f1f2; } .homepage-jobs-cta p { text-align:center; color: #6d6e70; font-weight:300; } .homepage-jobs-ctas { padding: 60px 10px; } .homepage-jobs-list { padding: 60px 40px; } .homepage-jobs-list h3 { text-align: center; color: #f6ba17; padding-bottom:20px; } .homepage-jobs-cta h3, .homepage-jobs-list h4>a { padding-top:30px; text-align:center; text-transform:none; color: #6d6e70; font-size:20px; } .homepage-jobs-list h4>a { padding-bottom: 0; padding-left: 10px; } .homepage-jobs-list h4 { padding-top: 15px; } .homepage-jobs-list p { color: #6d6e70; border-bottom: 2px #d1d2d4 solid; padding-bottom: 20px; padding-left: 10px; font-weight:300; } .homepage-jobs-list a:hover, .homepage-jobs-list a:active, .homepage-jobs-list a:focus { text-decoration:none; opacity:.7; } .homepage-jobs-list p>strong { font-weight:300; font-size:14px; color: #f6ba17; float: right; } .homepage-job-post-button { text-align:center; width:50%; margin-left: 25%; padding-bottom:30px; } .homepage-job-post-button h4 { background-color: #fbce42; border-bottom: 4px solid #f6ba17; border-radius: 8px; color:white; text-transform:none; font-weight:500; padding: 10px 0; } .homepage-job-post-button a:hover, .homepage-job-post-button a:active, .homepage-job-post-button a:focus { text-decoration:none; } .homepage-job-post-button h4:hover{ opacity: .7; } .view-more-jobs { text-align: center; } .view-more-jobs h4 { font-weight:600; margin-top:20px; } Photos Feed ----------- Add `{% load photo_tags %}` to the very top of your html page Then add the following code snippet where you want to place your photos: .. code-block:: django {% list_photos as photos_list limit=6 random=True %} Drag and drop photo albums to change the order of display on /photos/. To display photos from the top of your list in your feed - as opposed to the most recently added photos - add this order selection to your code. `{% list_photos as photos_list limit=2 order='photoset__position' %}` To pull photos from one or more photo sets, use `list_photo_sets` template tag. You can either tag your photo set(s): .. code-block:: django {% list_photo_sets as photo_sets_list tags="tendencidemo" %} Or specify the photo set id as below. (The `filters` can accept multiple photo sets. For example, `filters="id=1|id=2"`.) .. code-block:: django {% list_photo_sets as photo_sets_list filters="id=1" %} Videos Feed ----------- Add `{% load video_tags %}` to the very top of your html page Also add {% load video_filters %} to the very top of your html page Then add the following code snippet where you want to place your videos: .. code-block:: django News Feed (with Thumbnail Image) -------------------------------- Add `{% load news_tags %}` to the very top of your html page Then add the following code snippet where you want to place your news feed: .. code-block:: django
{% list_news as news_list limit=3 %}
Here's an example of what this snippet can look like: .. image:: img/newsfeed.png .. Tip:: HTML and CSS added to the above image: .. hidden-code-block:: html :label: + Show Added HTML

News

.. hidden-code-block:: css :label: + Show Added CSS section#services { background-color: #2b2b2b; padding-bottom:150px; padding-top:30px; } #services .container { width: 90%; } #services h4 { font-size: 45px; text-transform:none; width:100%; font-family: FontAwesome, "Assistant", sans-serif; font-weight:600; font-size:35px; color:white; } #services h3, #services a { font-size: 25px; font-weight:400; width:300px; color: #54b848; text-transform: none; margin:-10px 0; padding:0 10px; font-family: 'Assistant', sans-serif; } #services a:hover, #services h3:hover { text-decoration:none; font-color: #3333ff; } #services p{ color:white; font-weight: 200; font-size:16px; padding:0 10px; font-family: 'Assistant', sans-serif; } #services img:hover { opacity: .7; } #services img { padding:0 10px; } RSS Feed ---------- Add the following code snippet where you want to place your RSS Feed, include only the elements that you can to display on your page. If the RSS feed does not contain the elements you're calling, they won't show on the page and may throw an error. .. image:: img/rssfeed.png .. code-block:: django

Careers

View More
Example 2 shows more of the rss elements that could be included in your site: .. code-block:: django {% get_rss "http://rss.nytimes.com/services/xml/rss/nyt/PersonalTech.xml" as rss %} {% if rss.feed.image %} {% endif %} {% for entry in rss.entries %}
{# media image #} {% if entry.media_content %} {% for media in entry.media_content %} {% if media.medium == 'image' %} {% endif %} {% endfor %} {% endif %}
{# title #}

{{entry.title}}

{# pubdate #}
Published on: {{entry.published}}
{# authors #} {% if entry.authors %}
Author{{ entry.authors|pluralize }}: {% for author in entry.authors %} {{ author.name }} {% endfor %}
{% endif %} {# categories #} {% if entry.tags %}
Categories: {% for tag in entry.tags %} {% if tag.scheme %} {{ tag.term }} {% else %} {{ tag.term }} {% endif %} {% endfor %}
{% endif %} {# description #} {% if entry.content %} {% for content in entry.content %}
{{ content.value|safe }}
{% endfor %} {% elif entry.summary %}
{{ entry.summary|safe }}
{% endif %} {# enclosure #} {% if entry.links %} {% for link in entry.links %} {% if link.rel == 'enclosure' %}
{{ link.length|filesizeformat }}
{% endif %} {% endfor %} {% endif %} read more...
{% endfor %} .. Tip:: Other elements you can include: .. code-block:: django {{ entry.enclosure }} {{ entry.pubdate }} {{ entry.updateddate }} {{ entry.author_name }} {{ entry.author_email}} {{ entry.author_link }}