I’m using the Amazon plugin as a way to show what book I am currently reading.
I’d also like to do the same with video games I am playing, but I’d like them to be separate sections. I was thinking the only way to do this would be install a duplicate Amazon plugin, but I know that wouldn’t be easy …
currently i have just renamed the section to “currently reading/playing” and added the video game … so the book is shown and the video game is below it (all in the same section). that was the only thing i could think of doing to get what i want.
is there another plugin I can use additionally, or can i do something with existing plugin to make two separate entities?
WHICH amazon plugin? There’s two or three already…
CG-Amazon can do this easily, by adding products to its database, and specifically tagging/categorizing the “Currently Reading” and “Currently Playing” items, then making two calls to display each of those two categories. If you are trying to use CG-Amazon, lemme know and I can help.
Okay, more detailed:
In the CGA admin panel, you have your two items, a book, and a video game. (Well, let’s say you have a bunch of books and bunch of video games!)
If you click the “Edit” button to the right of the book you want to ‘tag’, you can then set a custom ‘category’ for the book, say “Reading”. Then click Submit Changes. Do the same for the game, but set the category to be “Playing”.
Then inside of your sidebar, make TWO amazon blocks back to back. Change the titles to match what you want them to show. THEN, we modify the call to show_amazon_items, to something like:
show_amazon_items(1, ‘rand’, true, “Reading”);
For the second call:
show_amazon_items(1, ‘rand’, true, “Playing”);
That’ll give you separate blocks. From then on, when you want to change what you are reading or playing, just go into the CGA page and set your new item to “Reading”, and then set the old item back to “None”.
Okay, now for a little more detail on those calls:
1 == how many items to show. this says show 1. you could have it be 3, and it will show up to 3 items.
‘rand’ == show up to the above number of items randomly selected from the ‘filtered’ list. i.e., you could have 5 books categorized as “Reading”, and it will randomly show 1 of the 5 on a page refresh…
true == show the image. that’s just so people could have longer lists of links without the images.
This is only scratching the surface of what CG-Amazon can do. Including things like showing items off your wishlist (but not tagging them yet when clicking through — that’s an Amazon-side issue), some number of random items matching a keyword, the integration with CG-WhatTunes to show the music your iTunes is playing, integration with CG-Inline to insert a link to ANY amazon product within the body of a post, and more custom queries of the items you’ve added to the local database.
Post away if you have more questions!
wow, thanks david. didn’t think i could do that
i did come across a problem after adding the code to my sidebar
Parse error: parse error, unexpected ‘<‘ in
…/blog-wp/wp-content/themes/ocadia/sidebar.php on line 13
Here is the code I added that you suggested:
<h2><?php _e(‘Currently Reading’); ?></h2>
<?php show_amazon_items(1, ‘rand’, true, “Reading”);
(closed li tag)
<h2><?php _e(‘Currently Playing’); ?></h2>
<?php show_amazon_items(1, ‘rand’, true, “Playing”);
(closed li tag)
Line 13 is the /li in the first block. This makes no sense to me of course, because taking away the “<” isn’t an option, right?
(please teach me how to post code appropriately!! the “`” doesn’t seem to work)
Have you closed those
<?phptags? Or is their apparent absence to do with the problem you’re having getting code to display?
The backtick has always worked for me here…
yep they’re closed!! am i supposed to type ` before and after code to get it to show up here? ’cause that doesnt work 🙁
I’m using Chaitgear’s CGA (Amazon Media) plugin, albeit on WP 1.2.2, so maybe this code won’t work. But I have my books and music on separate pages. It almost seems “too easy” — so maybe it’s very different in WP 1.5. In any event, on each page I have this piece of code:
<!-- CGA LIST -->
<?php get_media('2',20); ?>
<!-- CGA LIST -->
<?php get_media('1',20); ?>
The code is very easy to understand. The numbers 2 and 1 respectively, in the “get” tag are the Amazon numbers for the particular media you want displayed (e.g., 1 for books and 2 for CDs). The second number (20 in both instances here) represents the maximum number of items you wish displayed in each of your lists.
You can see it in action at my blog, http://www.babygotblog.com, just click on the Books or Music links.
thanks joni i will try that out…i’m using 1.5 though. wonder if the coding will be different? i don’t know much about php, so i’m not sure if the calling code has to be the same format throughout the entire template
actually joni is using WP-Amazon, a completely different animal (at least as far as I could see). get_media is ‘his’ call structure. 😉
cahira – one thing I noticed is your second block needs to be
id’s must be unique. classes can be shared.
If that doesn’t work, I can always have you send me your sidebar and I can take a quick look. But if it was working before, the id= thing might be the issue. or if the ? > isn’t on the end of the show_amazon_items lines…
hi david. i’ll try giving it a unique id. if that doesn’t work i will surely like to send you my entire sidebar hehe
yes the tags are properly closed, the code didn’t show up properly here
Glad to hear it. Stuff’s been working for so long, it had to be something simple on the call or CSS side. It does stink that you don’t usually get ‘errors’ about such things from the browser. I guess using a validator would have pointed that out.
Im trying to use the CGA, and while i have no problem getting it to work, I am having some issues configuring it’s output. All I really want is the image, no title, or pricing info, and i’d like it centered in the block I have it in. I admit not having the greatest of CSS skills, but I do know enough html and css to be a hazard to myself 😉 Is there an idiots guide to the style sheet for this, or am i not even looking in the right place to set this up?
I can give you a hack for the moment: set your image size to be “Preview”. That will give you the Small image, and >nothing< else.
The older hack (which is here in the forums somewhere) is to use CSS to hide those fields you don’t want to see (the CSS tag is usually “t-amazon” or something like that).
For more than that, I’d need to see the site, and a better description of how you are trying to use it. In the long run, I just need to make a ‘templating’ system so you can pass in the output format you are looking for. 😉
Thanks for the quick fix David
I had tried setting everything in the css with .t-amazon (i think thats what it was, i saw your comments in the style sheet regarding title but can’t remember the exact tag) as display: none; but it didn’t seem to do anything. I’m off to try the preview option now and will let you know!
- The topic ‘Amazon plugin’ is closed to new replies.