0

I have a plugin on Wordpress that generates HTML showing titles from a RSS feed, this is a sample of the code below for each item and then it repeats its self for the next few items.

</div>
<ul class="rss-aggregator">
    <li class="feed-item">
        <a target="_blank" rel="nofollow" href='http://www.football365.com/news/premier-league-winners-and-losers-7'>Premier League winners and losers</a>
        <div class="wprss-feed-meta">
            <span class="feed-source">Source: Football 365</span>
            <span class="feed-date">Published on 2015-10-19</span>
        </div>
        <div class="wprss-time-ago">31 mins ago</div>
    </li>

I was wondering if there is any code I can add to the page to automatically insert a paragraph after </div></li> as the page changes all the time with different title and URLS but </div></li>always stays the same after every feed, so the new HTML would look like:

</div> 
    <ul class="rss-aggregator">
        <li class="feed-item">
            <a target="_blank" rel="nofollow" href='football365.com/news/… League winners and losers</a>
            <div class="wprss-feed-meta">
                <span class="feed-source">Source: Football 365</span>
                <span class="feed-date">Published on 2015-10-19</span>
            </div>
            <div class="wprss-time-ago">31 mins ago</div>
        </li>
        <p>
David Thomas
  • 249,100
  • 51
  • 377
  • 410
Mike
  • 1
  • 1
  • 3
    This implies that you want to insert a `

    ` element directly after an `

  • ` element, which would be invalid HTML (only an `
  • ` elements are valid children of either `
      ` or `
      ` elements); you could, however, insert a `

      ` after the `

    1. ` element's parent element.
  • – David Thomas Oct 19 '15 at 12:03
  • @DavidThomas Thanks for that and how would i go about that, I'm an absolute beginner – Mike Oct 19 '15 at 12:13
  • 1
    First you'd need to explain where, *exactly*, you want the created `

    ` element to go (bearing in mind that the DOM won't create invalid HTML); and offer some details about what you want to create. Given the posted 'input' (the HTML above) what output would you expect to be created? Doees the `

    ` take any information from what's already there, does it have some static text? Is that the last/only `

  • ` element in the list? Ideally post the exact HTML result you want the jQuery/JavaScript to create.
  • – David Thomas Oct 19 '15 at 12:16
  • @DavidThomas The exact HTML I would want would look like this: – Mike Oct 19 '15 at 12:22
  • Thank you! Could you please [edit] your question to add the desired output there, where it's easily readable and less likely to be missed by others? Also, please remember to format the HTML appropriately so that it's not all in one long line? Also, please understand that you *cannot have a `

    ` element as a sibling of an `

  • ` element.* That's invalid HTML, it will not work.
  • – David Thomas Oct 19 '15 at 12:23