5 Replies - 3570 Views - Last Post: 30 November 2010 - 06:35 AM

#1 KristinaD  Icon User is offline

  • New D.I.C Head

Reputation: 1
  • View blog
  • Posts: 4
  • Joined: 21-October 10

Help w/ Wordpress Gallery Page & ads

Posted 22 October 2010 - 08:32 AM

Ok, so I'm trying to help a friend who wants to redesign her blog. I've made a child theme of one that she likes and I'm changing things up to match her current look. My PHP is fairly limited right now, but taking a PHP/MySQL class at the moment, and I'm hoping helping her will give me some practice. I've added some ad code in there and modified a few small things for her. However, she wants an all new way of displaying gallery pictures, and I'm afraid I don't even know where to begin.

Currently, she's using Next-Gen with a thumbnail gallery below the posts, and it reloads the page for each picture clicked. This gives her ad impressions and increases page views. But, it also slows things down and, in my opinion, looks bad. So, she wants to change it so that the gallery opens in a new window, one that will have an ad or two, and then refreshes for each "Next" image click (to increase those ad impressions and page views). Her site is Accidental Sexiness(a "pop culture" blog), she likes the way the image galleries are done on Popsugar and Celebuzz.

I have no idea where to begin for this. Do I need to look at how to create a custom post type? Is there an existing plug in for this? Does any of this make any sense?

(This is my first non-introduction post, so I hope I've used all the right etiquette.)

Is This A Good Question/Topic? 0
  • +

Replies To: Help w/ Wordpress Gallery Page & ads

#2 andwilley  Icon User is offline

  • D.I.C Head

Reputation: 12
  • View blog
  • Posts: 50
  • Joined: 18-June 09

Re: Help w/ Wordpress Gallery Page & ads

Posted 03 November 2010 - 09:21 AM

Well, I'm not 100% sure what you're asking for.. The galleries on those two other sites don't open a new window.. also I'm really just completely clueless about how to navigate sites like those.. but here's an overview of how I would approach this without telling you how to do it.

I would create a template within your theme that you could assign to each gallery. This could be a much simplified version of the page (get rid of the header, footer, sidebars, etc) to reduce load time for the page peripherals (which I think is what you were talking about). When you link to it, target="_blank" to make it a new tab/new window. Put a few adds in there if you need to.

Then pick a gallery. One of my favorites is this one. For this particular gallery, you can manipulate it with some fancy css and js to make it look however you want. What I like about it is that all you need to do to add a picture to the gallery is to add a line of code with an <li> for each <img> tag to the gallery <ul>. This could easily be done with custom fields and post_meta, uploading the pic to the backend and adding it to the appropriate custom field. What you'll like about it is that its smooth, has a preload so you don't get half pictures in the featured slot, and it reloads the page every time. It even has captions built into the title="" field, so it would be easy to use in the backend (change the title when you upload the picture). This should also help on SEO for a site like your friends.

There are a million ways to do this, especially with Wordpress, this is just one option. If you're just getting into Wordpress, the codex is where it's at. I've spent hours there learning the ins and outs theme development. As far as making website backends easy to deploy, Wordpress can't be beaten.

Let me know if that helps at all.. I'd be happy to share more details if you're willing to check out the codex, let me know what gallery you plan on using, and have specific questions about problems you're having with implementation.

Happy coding.

EDIT: Just thought about it, shouldn't be too hard either to make the target="_blank" automatic with a gallery page created in the backend with a filter to add that target field to a link with the gallery template (or whatever you end up calling it). ..Filling in the gaps..

This post has been edited by andwilley: 03 November 2010 - 09:25 AM

Was This Post Helpful? 1
  • +
  • -

#3 KristinaD  Icon User is offline

  • New D.I.C Head

Reputation: 1
  • View blog
  • Posts: 4
  • Joined: 21-October 10

Re: Help w/ Wordpress Gallery Page & ads

Posted 03 November 2010 - 01:06 PM

First, thanks for offering help!

I'm really very new to all this, and when I get it, it all clicks and I hear choral music. But, before that click, man does it all look Greek to me. I've made a page template before; I understand how templates work for the most part when it comes to pages and posts. However, when it comes to galleries, then I'm confused.

She uses NextGen on her site, and she really likes it. I've gotten her current gallery set up to open on a new page, with the target="_blank" (not on the live site, just in development). However, it simply opens the entire post on a new page, with the selected image enlarged, just as it would do if it was on the same page. This is expected, it's exactly what it should do. I don't want it to do what it should do... I would like for it to open in a template, just like you mentioned.

As it is now, she creates posts in the typical WP fashion, and inserts the short code for her NextGen gallery at the bottom (nggallery id=#) which she has set to show as an ImageBrowser rather than an effect. I feel like it's the NextGen code that I would need to get into and modify, not the WP code. It's NextGen that I need to tell to open in a new template when a thumbnail is clicked. I can pass a template as an argument in the in the NextGen shortcode. But, that just is a template for the part that shows up on the post, I still can't figure out how to push it into a new tab/window.

I keep meaning to dig into that Codex, but I get overwhelmed and sidetracked. I need to stop trying to multitask and just hit each "To Do" one at a time.
Was This Post Helpful? 0
  • +
  • -

#4 andwilley  Icon User is offline

  • D.I.C Head

Reputation: 12
  • View blog
  • Posts: 50
  • Joined: 18-June 09

Re: Help w/ Wordpress Gallery Page & ads

Posted 03 November 2010 - 02:52 PM

I've never used NextGen, so I don't really know how to talk you through it, unfortunately. If I have some time in the coming few days I'll install it on my local WP playground and let you know if I see a solution.

In the meantime, I'll get you started on a few of the key codex articles:

The Loop
Themes
Templates
Functions
Hooks

The best thing to do is to DL a Wordpress theme from the library and rip it apart (or just use the default theme). Make it do things it doesn't do, understand why it does what it does, etc. Then make your own. Start simple.

I'll get back to you in a few days about NextGen.
Was This Post Helpful? 0
  • +
  • -

#5 andwilley  Icon User is offline

  • D.I.C Head

Reputation: 12
  • View blog
  • Posts: 50
  • Joined: 18-June 09

Re: Help w/ Wordpress Gallery Page & ads

Posted 23 November 2010 - 12:03 PM

Sorry, I know its been awhile, but I just remembered this thread was here. You may not even check on it any more, but wanted to see where you were at.

And just to be sure I know what you're talking about.. You wanted, instead of each image opening in the pop up dark background effect, to open each in a new page (tab) with that simplified template you talked about?
Was This Post Helpful? 0
  • +
  • -

#6 KristinaD  Icon User is offline

  • New D.I.C Head

Reputation: 1
  • View blog
  • Posts: 4
  • Joined: 21-October 10

Re: Help w/ Wordpress Gallery Page & ads

Posted 30 November 2010 - 06:35 AM

Thanks for checking back in on me! It turned out to be a bit simpler than I thought, but it took me a while to figure that out. When you create a gallery in NextGEN, you can go in and tell it to create a page for that gallery also. So, I created a master "Gallery" page, and then I just add the individual galleries as children of that page. And, using WordPress's page template feature, I can make the changes needed to give Gallery pages a special look.

When you create a child page, it is supposed to take the template of its parent, but these aren't doing that for some reason. However, it's not a big deal to go in and quick edit the page to switch the template. Not ideal, but totally doable.

I made some edits to NextGEN's Imagebrowser code so that the gallery would open in a new window when an image was clicked. That just opened the whole post in a new page, with the Imagebrowser open, so I had to change the href to that of the gallery page. Then I realized that meant the image never opened, ever, it was just an endless chain of opening the gallery page in a new window. So, it really got to work on my PHP skills by grabbing the URL and then running an if/else. IF the URL contains the word "Gallery" (meaning it was the actually gallery) then run the Imagebrowser code normally, ELSE (meaning the URL is that of a post, hopefully not containing the word gallery...) then open the Gallery page. Does that make sense? It took a few different arrangements and tries, but it works properly now!

So, to sum it up: NextGEN can create a page for each gallery, combine that with WordPress's customer page templates. Then, modify the NextGEN code to know whether we are viewing the gallery from a post or its own page, and based on that, decide whether the thumbnail links to the gallery's page or just opens up the image.

Whew. It taxed my limited skills, but I learned a lot.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1