Support » Fixing WordPress » CG-Whattunes display

  • Resolved slipperyamoeba


    I just recently discovered CG-Whattunes and got it installed on my website ( relatively pain free. My question now is, what file do I need to edit to change the appearance of how the
    song info is listed on my webpage (such as changing the font or
    completely removing the name of the album from the page)?

    Specifically, I’d like to only have the album cover image and the time the song was played displayed under the “Now Playing” header. With mouseover popping up the song tile and album @ Amazon (instead of just album @amazon as it currently is).

    Hope that wasn’t too confusing. Just looking to get pointed in the right direction.


Viewing 15 replies - 1 through 15 (of 38 total)
  • Just about everything Dave’s plugins display are wrapped with all kinds of id’s and classes. Check the source and style using those.

    span#t-now-playing {

    Thanks for the reply Beel. So, do I have to edit multiple files in order to make display changes? Or if not, do you happen to know which specific php or style sheet I need to tweak? Or even better which section of which file?

    I am trying to only have the album art displayed (no song title, album name etc. Basically no text.)

    I have been using David’s plugins since he first released them and have “Now Playing” “Now Reading” “Random Item” and “Wishlist” in my sidebar (along with his “Recent Referrers”, “Recent Searches” and “FeedRead News” :-).

    You can just add the css to your theme style sheet or include a separate “amazon.css” in the header as I have done (check my source).

    Figured I’d respond here rather than via email, so others can learn about this stuff. 😉

    For >styling< content, just add the right CSS overrides into your theme’s CSS file. Beel’s right — I typically over-wrapper things like nuts, class wrapper items, so that you can easily CSS things to make it look visually the way you want.

    However, changing what’s >output< is something different. While there are some options in the getWhatsPlaying function call, doing more complex adjustments you’d need to modify the code in that function itself. Some of it is actually not even in THAT function, as it calls into CG-Amazon for the amazon output.

    To just show the image…. hmmm… there’s options in cga-config.php that control that for Amazon calls, and are likely the best way to do it here. It should let you get just the image without further code mods — but I’ve actually never tested this particular case/approach.

    If $showTitle (the second param to getWhatsPlaying) is false, you are basically JUST getting the amazon output, almost pure. So it’s almost like you called amazon yourself — thus all the cga-config.php settings apply: what gets shown/not shown, image size defaults (though getWhatsPlaying’s last param allows that specified to override), country/locale, etc.

    If it doesn’t seem readily apparent, ping here or via email and I’ll try to follow up. I apologize in advance if this drops off the radar — ping me like once a week for the next two weeks and I’ll certainly get to it (I’m juggling $$ earning and $$ sucking things… 😉 ).


    So, I cracked open cga-config.php as suggested by David and found this line.

    // set this true to show ONLY the product image, NO other fields. this basically infers minimumData too…
    //$amazonImageOnly = true;

    I took out the 2 preceding slashes infront of the last part, leaving

    // set this true to show ONLY the product image, NO other fields. this basically infers minimumData too…
    $amazonImageOnly = true;

    That seemed to get rid of the the album name and artist beneath the picture. But I still haven’t found how to lose the song title from above the image. Any thoughts?

    Two more questions:

    1. When you mouseover the album image its border changes to blue, which is fine, but the goofy looking thing is that the border extends way out to the right on the mouseover (in firefox) or to the right and below (in explorer). Is there a way either get rid of this effect completely or to not have the border extend to far out (so, just highlight the image and not the surrounding text which is what I assume it’s trying to do) ?

    2. Is there a way to display the time the last song was played?

    Thanks again for all you help?

    While you wait for David’s response, in the meantime have you tried using “display:hidden” in your css for what you don’t want shown? Oh wait, change this:
    getWhatsPlaying(true, true)
    getWhatsPlaying(true, false)

    For your other questions the css is set to display:block and has a hover baclground color – I’d first just delete the background color and give that a whirl.

    Don’t know about the time.

    Beel thanks again for the reply. I was able to fix the mouseover thing by changing the background attribute in the following to none (or white would also work for my page).

    .amazon-item-wrap a:hover
    background: none;

    Silly question, but, where (what file) do I find “getWhatsPlaying(true, true)?

    you mean the function call definition?

    for the date… hmmm. Yeah, you can do it. A quick hacky thing would be to find the line:

    if ($showTitle && !$titleBefore) $output .= $titleout;

    … in CG-WhatTunes.php, and add AFTER it something like:

    if (1) // showdate
    $time = date('r', $np['playtime']); // 'r' can be any format string
    $output .= $preTitle.$lf; // THIS IS OPTIONAL
    if ($amazonWrapInfo!='li') $output .= '<li>'.$lf;
    if ($titleWrap) $output .= "<$amazonWrapInfo class='t-amazon'>".$lf;
    $output .= $time.$lf;
    if ($titleWrap) $output .= "</$amazonWrapInfo>".$lf;
    if ($amazonWrapInfo!='li') $output .= '</li>'.$lf;
    $output .= $postTitle.$lf; // THIS IS ALSO OPTIONAL

    I haven’t tried this… just off the top of my head here. You might need to remove the OPTIONAL lines, and might also need to change the wrappering class from t-amazon to something else if you are hiding the t-amazon’s in CSS overrides…


    Great! Thanks David for the detailed reply. That works great for displaying the date/time on my site. I like how configurable that is too (for example changing the “r” value to a different value).

    Once again, thank you both Beel and David for all you help. There really is absolutely no way I could have figured any of this out by myself. A few more questions that seem like they should be straight forward but I can’t figure them out.

    1. Is there a way to move the date/time the song was played underneath the album cover image?

    2. How do I change the border color around the album cover image?

    3. In Firefox the album cover image, song title, etc are jogged to the right underneath the “Now Playing” title, but not in IE. I think this is somehow my doing as I also get an error having to do with a
    [li] when I try to WC3 validate my page. Is there a simple way to nudge these back left in Firefox?

    Again many thanks!

    The first question is easy, just move the code he posted further down in the function (somewhere before the output is returned)

    I’ll have to spend some time thinking about your next 2 questions which should be easy, too.

    Yep, you have an error in your sidebar – fix that and we will see what the layout looks like.

    As for the border, add something like:
    span.b-amazon img {border:hotpink}


    Come to think of it, the xhtml error may be a prob with David’s function. I do not use what he suggests in the docs and I think that may have been the reason why (too long ago to remember)

    This is what I use:
    if (function_exists(“getWhatsPlaying”)) // then we can use it
    $amaAlbum = getWhatsPlaying(true, true);
    if ($amaAlbum)
    echo ‘<li id=”now-playing”>Now Playing’;
    echo $amaAlbum;
    echo ‘</li>‘;

    That closing li may be the reason.

    Beel, I tried your above posted function and it still gave me an xhtml error, BUT along with that it also solved about three different layout glitches I was fighting with. Much, much better. Great tip! I am definitely going with your setup.

Viewing 15 replies - 1 through 15 (of 38 total)
  • The topic ‘CG-Whattunes display’ is closed to new replies.