Skip to main content
code fix
Source Link
Romans-8---31-39
  • 2.9k
  • 1
  • 15
  • 20
{!--set main multi-channel entry list--}
{exp:stash:set_list
    name="one" 
    parse_tags="yes"
}
    {exp:channel:entries
        channel="ONE_CHANNEL|ANOTHER_CHANNEL|ETC"
        dynamic="no"
    } 
        {stash:entry_id}{entry_id}{/stash:entry_id}
        {stash:title}{title}{/stash:title}
    {/exp:channel:entries}
{/exp:stash:set_list}

{!--set tweet list--}
{exp:stash:set_list
    name="two" 
    parse_tags="yes"
    parse_depth="2" {!--run 2x to parse the math plugin--}
}
    {exp:channel:entries
        channel="TWEET_CHANNEL"
        dynamic="no"
    } 
        {stash:entry_id}{entry_id}{/stash:entry_id}
        {stash:title}{title}{/stash:title}
        {!--set a number to match every third count where the tweet should be output--}
        {stash:two_count}{exp:math formula="{count} * 3"}{/stash:two_count}
    {/exp:channel:entries}
{/exp:stash:set_list}

{!--output multi-channel list and tweet list--}
{exp:stash:get_list
    name="one" 
    prefix="st1"
}
    {!--output tweet on every third loop--}
    {if st1:count % 3 == 0}

        {exp:stash:get_list:nested
            name="two" 
            limit="1"
            match="#{st1:count}#" 
            against="two_count"
            prefix="st2"
        }
            {!--if no results, output main channel entry--}
            {if st2:no_results}
                <li>{st1:entry_id} : {st1:title}</li>
            {/if}
            {!--tweet--}
            <li>{st2:entry_id} : {st2:title}</li>
            {!--3rd main--}
            <li>{st1:entry_id} : {st1:title}</li>
        {/exp:stash:get_list:nested}

    {!--otherwise output main channel entry--}
    {if:else}
        <li>{st1:entry_id} : {st1:title}</li>
    {/if}
    
{/exp:stash:get_list}
{!--set main multi-channel entry list--}
{exp:stash:set_list
    name="one" 
    parse_tags="yes"
}
    {exp:channel:entries
        channel="ONE_CHANNEL|ANOTHER_CHANNEL|ETC"
        dynamic="no"
    } 
        {stash:entry_id}{entry_id}{/stash:entry_id}
        {stash:title}{title}{/stash:title}
    {/exp:channel:entries}
{/exp:stash:set_list}

{!--set tweet list--}
{exp:stash:set_list
    name="two" 
    parse_tags="yes"
    parse_depth="2" {!--run 2x to parse the math plugin--}
}
    {exp:channel:entries
        channel="TWEET_CHANNEL"
        dynamic="no"
    } 
        {stash:entry_id}{entry_id}{/stash:entry_id}
        {stash:title}{title}{/stash:title}
        {!--set a number to match every third count where the tweet should be output--}
        {stash:two_count}{exp:math formula="{count} * 3"}{/stash:two_count}
    {/exp:channel:entries}
{/exp:stash:set_list}

{!--output multi-channel list and tweet list--}
{exp:stash:get_list
    name="one" 
    prefix="st1"
}
    {!--output tweet on every third loop--}
    {if st1:count % 3 == 0}

        {exp:stash:get_list:nested
            name="two" 
            limit="1"
            match="#{st1:count}#" 
            against="two_count"
            prefix="st2"
        }
            {!--if no results, output main channel entry--}
            {if st2:no_results}
                <li>{st1:entry_id} : {st1:title}</li>
            {/if}
            <li>{st2:entry_id} : {st2:title}</li>
        {/exp:stash:get_list:nested}

    {!--otherwise output main channel entry--}
    {if:else}
        <li>{st1:entry_id} : {st1:title}</li>
    {/if}
    
{/exp:stash:get_list}
{!--set main multi-channel entry list--}
{exp:stash:set_list
    name="one" 
    parse_tags="yes"
}
    {exp:channel:entries
        channel="ONE_CHANNEL|ANOTHER_CHANNEL|ETC"
        dynamic="no"
    } 
        {stash:entry_id}{entry_id}{/stash:entry_id}
        {stash:title}{title}{/stash:title}
    {/exp:channel:entries}
{/exp:stash:set_list}

{!--set tweet list--}
{exp:stash:set_list
    name="two" 
    parse_tags="yes"
    parse_depth="2" {!--run 2x to parse the math plugin--}
}
    {exp:channel:entries
        channel="TWEET_CHANNEL"
        dynamic="no"
    } 
        {stash:entry_id}{entry_id}{/stash:entry_id}
        {stash:title}{title}{/stash:title}
        {!--set a number to match every third count where the tweet should be output--}
        {stash:two_count}{exp:math formula="{count} * 3"}{/stash:two_count}
    {/exp:channel:entries}
{/exp:stash:set_list}

{!--output multi-channel list and tweet list--}
{exp:stash:get_list
    name="one" 
    prefix="st1"
}
    {!--output tweet on every third loop--}
    {if st1:count % 3 == 0}

        {exp:stash:get_list:nested
            name="two" 
            limit="1"
            match="#{st1:count}#" 
            against="two_count"
            prefix="st2"
        }
            {!--if no results, output main channel entry--}
            {if st2:no_results}
                <li>{st1:entry_id} : {st1:title}</li>
            {/if}
            {!--tweet--}
            <li>{st2:entry_id} : {st2:title}</li>
            {!--3rd main--}
            <li>{st1:entry_id} : {st1:title}</li>
        {/exp:stash:get_list:nested}

    {!--otherwise output main channel entry--}
    {if:else}
        <li>{st1:entry_id} : {st1:title}</li>
    {/if}
{/exp:stash:get_list}
added no_results output
Source Link
Romans-8---31-39
  • 2.9k
  • 1
  • 15
  • 20
{!--set main multi-channel entry list--}
{exp:stash:set_list
    name="one" 
    parse_tags="yes"
}
    {exp:channel:entries
        channel="ONE_CHANNEL|ANOTHER_CHANNEL|ETC"
        dynamic="no"
    } 
        {stash:entry_id}{entry_id}{/stash:entry_id}
        {stash:title}{title}{/stash:title}
    {/exp:channel:entries}
{/exp:stash:set_list}

{!--set tweet list--}
{exp:stash:set_list
    name="two" 
    parse_tags="yes"
    parse_depth="2" {!--run 2x to parse the math plugin--}
}
    {exp:channel:entries
        channel="TWEET_CHANNEL"
        dynamic="no"
    } 
        {stash:entry_id}{entry_id}{/stash:entry_id}
        {stash:title}{title}{/stash:title}
        {!--set a number to match every third count where the tweet should be output--}
        {stash:two_count}{exp:math formula="{count} * 3"}{/stash:two_count}
    {/exp:channel:entries}
{/exp:stash:set_list}

{!--output multi-channel list and tweet list--}
{exp:stash:get_list
    name="one" 
    prefix="st1"
}
    {!--output tweet on every third loop--}
    {if st1:count % 3 == 0}

        {exp:stash:get_list:nested
            name="two" 
            limit="1"
            match="#{st1:count}#" 
            against="two_count"
            prefix="st2"
        }
            {!--if no results, output main channel entry--}
            {if st2:no_results}
                <li>{st1:entry_id} : {st1:title}</li>
            {/if}
            <li>{st2:entry_id} : {st2:title}</li>
        {/exp:stash:get_list:nested}

    {!--otherwise output main channel entriesentry--}
    {if:else}
        <li>{st1:entry_id} : {st1:title}</li>
    {/if}
    
{/exp:stash:get_list}
{!--set main multi-channel entry list--}
{exp:stash:set_list
    name="one" 
    parse_tags="yes"
}
    {exp:channel:entries
        channel="ONE_CHANNEL|ANOTHER_CHANNEL|ETC"
        dynamic="no"
    } 
        {stash:entry_id}{entry_id}{/stash:entry_id}
        {stash:title}{title}{/stash:title}
    {/exp:channel:entries}
{/exp:stash:set_list}

{!--set tweet list--}
{exp:stash:set_list
    name="two" 
    parse_tags="yes"
    parse_depth="2" {!--run 2x to parse the math plugin--}
}
    {exp:channel:entries
        channel="TWEET_CHANNEL"
        dynamic="no"
    } 
        {stash:entry_id}{entry_id}{/stash:entry_id}
        {stash:title}{title}{/stash:title}
        {!--set a number to match every third count where the tweet should be output--}
        {stash:two_count}{exp:math formula="{count} * 3"}{/stash:two_count}
    {/exp:channel:entries}
{/exp:stash:set_list}

{!--output multi-channel list and tweet list--}
{exp:stash:get_list
    name="one" 
    prefix="st1"
}
    {!--output tweet on every third loop--}
    {if st1:count % 3 == 0}

        {exp:stash:get_list:nested
            name="two" 
            limit="1"
            match="#{st1:count}#" 
            against="two_count"
            prefix="st2"
        }
            <li>{st2:entry_id} : {st2:title}</li>
        {/exp:stash:get_list:nested}

    {!--otherwise output main channel entries--}
    {if:else}
        <li>{st1:entry_id} : {st1:title}</li>
    {/if}
    
{/exp:stash:get_list}
{!--set main multi-channel entry list--}
{exp:stash:set_list
    name="one" 
    parse_tags="yes"
}
    {exp:channel:entries
        channel="ONE_CHANNEL|ANOTHER_CHANNEL|ETC"
        dynamic="no"
    } 
        {stash:entry_id}{entry_id}{/stash:entry_id}
        {stash:title}{title}{/stash:title}
    {/exp:channel:entries}
{/exp:stash:set_list}

{!--set tweet list--}
{exp:stash:set_list
    name="two" 
    parse_tags="yes"
    parse_depth="2" {!--run 2x to parse the math plugin--}
}
    {exp:channel:entries
        channel="TWEET_CHANNEL"
        dynamic="no"
    } 
        {stash:entry_id}{entry_id}{/stash:entry_id}
        {stash:title}{title}{/stash:title}
        {!--set a number to match every third count where the tweet should be output--}
        {stash:two_count}{exp:math formula="{count} * 3"}{/stash:two_count}
    {/exp:channel:entries}
{/exp:stash:set_list}

{!--output multi-channel list and tweet list--}
{exp:stash:get_list
    name="one" 
    prefix="st1"
}
    {!--output tweet on every third loop--}
    {if st1:count % 3 == 0}

        {exp:stash:get_list:nested
            name="two" 
            limit="1"
            match="#{st1:count}#" 
            against="two_count"
            prefix="st2"
        }
            {!--if no results, output main channel entry--}
            {if st2:no_results}
                <li>{st1:entry_id} : {st1:title}</li>
            {/if}
            <li>{st2:entry_id} : {st2:title}</li>
        {/exp:stash:get_list:nested}

    {!--otherwise output main channel entry--}
    {if:else}
        <li>{st1:entry_id} : {st1:title}</li>
    {/if}
    
{/exp:stash:get_list}
Source Link
Romans-8---31-39
  • 2.9k
  • 1
  • 15
  • 20

This builds on CreateSean's answer, since you're using Stash. You'll need a math plugin and in this example I'm using Math from Caddis.

{!--set main multi-channel entry list--}
{exp:stash:set_list
    name="one" 
    parse_tags="yes"
}
    {exp:channel:entries
        channel="ONE_CHANNEL|ANOTHER_CHANNEL|ETC"
        dynamic="no"
    } 
        {stash:entry_id}{entry_id}{/stash:entry_id}
        {stash:title}{title}{/stash:title}
    {/exp:channel:entries}
{/exp:stash:set_list}

{!--set tweet list--}
{exp:stash:set_list
    name="two" 
    parse_tags="yes"
    parse_depth="2" {!--run 2x to parse the math plugin--}
}
    {exp:channel:entries
        channel="TWEET_CHANNEL"
        dynamic="no"
    } 
        {stash:entry_id}{entry_id}{/stash:entry_id}
        {stash:title}{title}{/stash:title}
        {!--set a number to match every third count where the tweet should be output--}
        {stash:two_count}{exp:math formula="{count} * 3"}{/stash:two_count}
    {/exp:channel:entries}
{/exp:stash:set_list}

{!--output multi-channel list and tweet list--}
{exp:stash:get_list
    name="one" 
    prefix="st1"
}
    {!--output tweet on every third loop--}
    {if st1:count % 3 == 0}

        {exp:stash:get_list:nested
            name="two" 
            limit="1"
            match="#{st1:count}#" 
            against="two_count"
            prefix="st2"
        }
            <li>{st2:entry_id} : {st2:title}</li>
        {/exp:stash:get_list:nested}

    {!--otherwise output main channel entries--}
    {if:else}
        <li>{st1:entry_id} : {st1:title}</li>
    {/if}
    
{/exp:stash:get_list}