Multiple Instances of Promoted Articles

Répondu

23 Commentaires

  • Wes Drury

    @James - You can have multiple promoted articles on the page but you would need some type of wording like "Feature Request" and some JQuery to only show those articles.  It is possible but would take some development.

    0
  • James Riley

    Yea I guess the JQuery part is where I am fuzzy.  I can dig around and see if I can figure out how to get this going.

    0
  • Wes Drury

    @James - I'm pretty busy but if I get some time I'll send some code your way.  I have something similar implemented in my Help Center so I'll see if I can dig it out.

    0
  • James Riley

    Thanks!  That would be awesome.  No rush.  Much appreciated!

    0
  • James Riley

    Hi Wes,

    Was just checking up on that code if you get a change.  Thanks!

    0
  • Wes Drury

    @James - Haven't had much time but maybe it will help if you kinda layout some details.  On your homepage you would like to show promoted articles in two different places, could you label the article with a keyword at the beginning which I could hide if needed.  For example "Hot Topics- Promoted Article 1" an then "Feature Request - Promoted article 2".

    0
  • James Riley

    I have attached a screen shot of what we have now.  I took some script from another post and changed the name of the first promoted articles section.  I was hoping we could get another instance next to this titled "New Features" where we could promote feature articles.

     

    0
  • Wes Drury

    @James - give this a shot.

    HTML - add the following on your home page.

    <div class="PR1">

    {{promoted_articles}}

    </div>

    <div class="PR2">

    {{promoted_articles}}

    </div>

    CSS - add the below lines

    .promoted-articles a {

    display: none;

    }

    JS - add the below lines

    //Change text of Promoted Articles

    $(".PR1 h3:contains('Promoted articles')").text('Releases');

    $(".PR2 h3:contains('Promoted articles')").text('Feature Request');

    if ( $('div.PR1 a:contains("Release")').length > 0 ){

    $('div.PR1 a:contains("Release")').show();

    }

    if ( $('div.PR2 a:contains("Feature Request")').length > 0 ){

    $('div.PR2 a:contains("Feature Request")').show();

    }

    Now go into your articles and add the word Release or Feature Request in the title an it should show up under the correct one.

    I threw this together quickly so I'm sure there's a more efficient way to code this but this was the quick and dirty way.

    Let me know how it goes.

    1
  • James Riley

    Hmmm I got as far as below.  I have added Release to one of the titles of the articles and it's now showing up.  I do appreciate the help on this, but if we have to have those phrases in all promoted articles titles I don't think this is something we can use though.

     

    0
  • Wes Drury

    @James - Once you get it working we can hide those words but they have to be there as that is the only way it knows how to show.  If you provide me with a link to your Help Center then I can see what you have as I tested the solution on a base Humble Squid theme and it worked perfect.

    0
  • James Riley

    Ahh ok that's cool.  Link - https://support.breadcrumb.com/hc/en-us

     

    I'm probably putting the code in the wrong spots or something.  I know just a touch of such things. I didn't save the new code to the environment was just working in preview. 

    0
  • Wes Drury

    @James - Any way you can add the code and save it so that I can see or will that mess you up.

     

    0
  • James Riley

    I got the code added in and saved for you.  Thanks again!  

    0
  • Wes Drury

    @James - Move the javascript that I have above right below the $(document).ready(function()  and that should do it.

    0
  • Octavian Ratiu

    @Wes - I've been working with James on trying to get this working. I used your code and moved the javascript snippet below the $(document).ready(function()) but we still can't get both instances next to each other.  Any additional help would be greatly appreciated! 

     

    0
  • Wes Drury

    @Octavian -  Are you wanting the Releases and Feature Request side by side?  Is that what you are wanting? if so that should just be a little CSS.  Is all the JS code working correctly?

    0
  • Octavian Ratiu

    @Wes - I'm still having trouble with the JS code splitting up the articles. I added "Feature" to the title of this article https://support.breadcrumb.com/hc/en-us/articles/204403613 but I can't get it to show up under the "Feature Request" section.  Feel free to take a look if you have some time.

    0
  • Wes Drury

    @Octavian - You will need to mark that article as Promoted.

    0
  • Wes Drury

    @Octavian - Also you will need to uncomment that CSS (the very last line in your CSS file) and you can change the PR1 code below:

    if ( $('div.PR1 a:contains("Version")').length > 0 ){

    $('div.PR1 a:contains("Version")').show();

    }

    If it finds the word version then it will show those under the Releases.  I tested this in the browser and it worked.  Once you make those changes let me know and I'll take another look.

    1
  • Octavian Ratiu

    @Wes - Thanks for all the help! I changed the PR1 code, uncommented the CSS, and marked the article as promoted. 

    0
  • Wes Drury

    @Octavian - You have an error in your JS file.  When you added the PR1 information you didn't include the last bracket.  Look at my code above and add the }

    0
  • Octavian Ratiu

    @Wes - D'oh! Sorry about that. It's showing up under the correct sections now. Thanks again for all your help! You had also mentioned that there is a way to hide "Feature" from the title of each article, is that correct?

    0
  • Nicole S. - Community Manager
    Zendesk Community Team

    This post closed for comment by the Zendesk Community Team. If you have a related or new question, please create a new post

    0

Cette publication n’accepte pas de commentaire.

Réalisé par Zendesk