Register a SA Forums Account here!
JOINING THE SA FORUMS WILL REMOVE THIS BIG AD, THE ANNOYING UNDERLINED ADS, AND STUPID INTERSTITIAL ADS!!!

You can: log in, read the tech support FAQ, or request your lost password. This dumb message (and those ads) will appear on every screen until you register! Get rid of this crap by registering your own SA Forums Account and joining roughly 150,000 Goons, for the one-time price of $9.95! We charge money because it costs us money per month for bills, and since we don't believe in showing ads to our users, we try to make the money back through forum registrations.
 
  • Post
  • Reply
BuddytheRat
Aug 14, 2005
I don't think so. The code for single-event.php is here:

http://codetidy.com/272

EDIT: And the header file: http://codetidy.com/273

BuddytheRat fucked around with this message at 02:45 on Nov 8, 2010

Adbot
ADBOT LOVES YOU

Ned
May 23, 2002

by Hand Knit
What is the code that creates the custom post type?

BuddytheRat
Aug 14, 2005
Here's the part of functions.php for the custom post type: http://codetidy.com/274

Ned
May 23, 2002

by Hand Knit
You might need to change your permalink settings. I don't know if custom post types play well with id based permalinks. When you go from Admin does it take you to an id based url?

BuddytheRat
Aug 14, 2005

Ned posted:

You might need to change your permalink settings. I don't know if custom post types play well with id based permalinks. When you go from Admin does it take you to an id based url?

Does the exact same thing with pretty permalinks as well. The custom post types have a post id and for the most part act exactly like posts. It feels like I've tried everything short of reinstalling wordpress.

Ned
May 23, 2002

by Hand Knit
look into $wp_rewrite - it has some functions where you define a new permalink structure and associate it with your custom post type.

try putting this in your function to create the event post type.

code:
global $wp_rewrite;
$event_structure = '/event/%event';
$wp_rewrite->add_rewrite_tag('%event%', '([^/]+)', 'event=');
$wp_rewrite->add_permastruct('event', $event_structure, false);
I don't think you should have to do a reinstall but maybe try turning off some plugins and seeing if it loads properly without the plugins there.

BuddytheRat
Aug 14, 2005

Ned posted:

look into $wp_rewrite - it has some functions where you define a new permalink structure and associate it with your custom post type.

try putting this in your function to create the event post type.

code:
global $wp_rewrite;
$event_structure = '/event/%event%/';
$wp_rewrite->add_rewrite_tag('%event%', '([^/]+)', 'event=');
$wp_rewrite->add_permastruct('event', $event_structure, false);
I don't think you should have to do a reinstall but maybe try turning off some plugins and seeing if it loads properly without the plugins there.

I think you forgot a few characters in there. (I fixed it.) Same exact thing. On the plus side, though, pretty permalinks are now working on my local server, which has never happened before. It works even without your code. Go figure.

The permalinks without your code worked the same way when I tried it with pretty links earlier. (/event/event-name-here)

I have no plugins activated. (Not even Akismet.)

I did alter wp-comments-post.php slightly to fix a problem where comments were permanently closed for posts dated in the future, but it does the same thing with or without my edit. (I would love to know how to do this using a plugin, so I don't have to mess with core wordpress files.)

code:
// get_post_status() will get the parent status for attachments.
$status = get_post_status($post);

$status_obj = get_post_status_object($status);
$type = get_post_type($post); //I added this

if ( !comments_open($comment_post_ID) ) {
	do_action('comment_closed', $comment_post_ID);
	wp_die( __('Sorry, comments are closed for this item.') );
} elseif ( 'trash' == $status ) {
	do_action('comment_on_trash', $comment_post_ID);
	exit;
} elseif ( !$status_obj->public && !$status_obj->private && $type != 'event' ) { //and I added ''&& $type != 'event'
	do_action('comment_on_draft', $comment_post_ID);
	exit;
} elseif ( post_password_required($comment_post_ID) ) {
	do_action('comment_on_password_protected', $comment_post_ID);
	exit;
} else {
	do_action('pre_comment_on_post', $comment_post_ID);
}
EDIT: I did notice something though. When I do use pretty permalinks, being logged in makes no difference and it still won't work. But using normal links, being logged in makes it work.

DOUBLE EDIT: So, I switched to pretty links, and then put in your code, and it was working again while logged in. So, I took out your code and.. it's still working while logged in, even though there is no actual difference in the code when it wasn't working a second ago and it working now. :psyduck:

BuddytheRat fucked around with this message at 08:43 on Nov 8, 2010

Ned
May 23, 2002

by Hand Knit

BuddytheRat posted:

EDIT: I did notice something though. When I do use pretty permalinks, being logged in makes no difference and it still won't work. But using normal links, being logged in makes it work.

DOUBLE EDIT: So, I switched to pretty links, and then put in your code, and it was working again while logged in. So, I took out your code and.. it's still working while logged in, even though there is no actual difference in the code when it wasn't working a second ago and it working now. :psyduck:

I think the code just rebuilds the .htaccess file to set up the permalinks. If you remove that code but don't rebuild the permalinks then the .htaccess file is still the same. I'm not incredibly sure though because I'm still relatively new to custom post types myself.

Want to set up a guest login for me? I'll poke around and see what I can see!

BuddytheRat
Aug 14, 2005

Ned posted:

I think the code just rebuilds the .htaccess file to set up the permalinks. If you remove that code but don't rebuild the permalinks then the .htaccess file is still the same. I'm not incredibly sure though because I'm still relatively new to custom post types myself.

Want to set up a guest login for me? I'll poke around and see what I can see!

Sure! I've set up a new account. Username: "the_ned", password: "lljk".
Just be sure to change that pass as soon as you login.

Ned
May 23, 2002

by Hand Knit
I am in there and poking around. Very unusual situation here. I think one of the issues is that your events are scheduled and WP might not actually want to display content that is scheduled in the future unless we modify the call to get the post so I am looking into that on pages it knows are events.

BuddytheRat
Aug 14, 2005

Ned posted:

I am in there and poking around. Very unusual situation here. I think one of the issues is that your events are scheduled and WP might not actually want to display content that is scheduled in the future unless we modify the call to get the post so I am looking into that on pages it knows are events.

Up until now the only problem I had relating to dealing with future posts was the comments. Once I hacked wp-comments-post.php tt worked perfectly up until a certain point. I don't know exactly what changed to make it do this suddenly, which is something that probably could have been avoided.. I guess I've learned the hard way that I need to save older versions as backups.

Ned
May 23, 2002

by Hand Knit
It's alive!!

I found your answer here: http://wptheming.com/2010/08/how-to-make-an-events-custom-post-type/

BuddytheRat
Aug 14, 2005

Ned posted:

It's alive!!

I found your answer here: http://wptheming.com/2010/08/how-to-make-an-events-custom-post-type/

Woah! That was fast. Thank you man, this is great! I guess I have a lot to learn. (And my google-fu could use some work, as well.)

Seriously I can't thank you enough. I was tearing my hair out trying to figure this out.

EDIT: And 'Schedule' now says 'Event Date'! That is way cool.

BuddytheRat fucked around with this message at 10:51 on Nov 8, 2010

Ned
May 23, 2002

by Hand Knit

BuddytheRat posted:

Woah! That was fast. Thank you man, this is great! I guess I have a lot to learn. (And my google-fu could use some work, as well.)

Seriously I can't thank you enough. I was tearing my hair out trying to figure this out.

It was a very complex thing to put together on your own. The nice thing about WordPress is the people who develop WordPress usually start doing so because they are bloggers and if there is one thing bloggers like to write about it is about themselves and what they do. There are no shortage of answers out there but sometimes the documentation can be a bit lacking.

Custom post types are also relatively new but the fact you added columns to the event type is great!

BuddytheRat
Aug 14, 2005

Ned posted:

It was a very complex thing to put together on your own. The nice thing about WordPress is the people who develop WordPress usually start doing so because they are bloggers and if there is one thing bloggers like to write about it is about themselves and what they do. There are no shortage of answers out there but sometimes the documentation can be a bit lacking.

Custom post types are also relatively new but the fact you added columns to the event type is great!

That little tidbit came from this guide, actually:
http://net.tutsplus.com/tutorials/wordpress/rock-solid-wordpress-3-0-themes-using-custom-post-types/

I still don't entirely understand it all, but, I am learning by doing! I am way better at the CSS part.

NotShadowStar
Sep 20, 2000
Working on a site where I'm doing a sub-theme of twentyten. It's 1/2 content (thousands of pages) and 1/2 blog. The sidebar will be the same across the whole site for the most part, but for blog pages I want to show archives, subscription links widgets and all that. The best way I can think of is putting all of the widgets I want to show everywhere in Widget Area 2, and the ones I want in just for post areas in Widget Area 1, then create a sidebar.php that detects if it's a page or a post and displays the widget areas accordingly. That seems more complicated than it should be though, is there a better way?

benitocereno
Apr 14, 2005


Doctor Rope
How about something like this in page.php?

php:
<?php if ( is_page('blog') ) { ?>
<?php include(TEMPLATEPATH.'/sidebar-blog.php');?>
<?php } else { ?>
<?php include(TEMPLATEPATH.'/sidebar.php');?>
<?php ?>

If you have all of your blog posts in a "blog" page it will load the alternate sidebar. Just copy your theme's sidebar.php and rename it to something like sidebar-blog.php, then customize as needed.

I don't think there's anything wrong with the widget idea, but this is the way I've always done it.

Edit: If you want the new sidebar to apply to single posts as well (when they drill down), I believe you can just change the sidebar call in single.php to get_sidebar(blog); since that function allows you to pass a string name.

benitocereno fucked around with this message at 21:20 on Nov 8, 2010

stray
Jun 28, 2005

"It's a jet pack, Michael. What could possibly go wrong?"
Here's two interesting posts by Roger Johansson on bending WordPress to your evil ways:

- How to make WordPress URLs root-relative (very nice to know!)
- Removing TITLE attributes from WordPress links (this quirk of WordPress' has always bugged me)

Ned
May 23, 2002

by Hand Knit

stray posted:

Here's two interesting posts by Roger Johansson on bending WordPress to your evil ways:

- How to make WordPress URLs root-relative (very nice to know!)
- Removing TITLE attributes from WordPress links (this quirk of WordPress' has always bugged me)

Filters are pretty sweet. As a WP developer learning how hooks and filters work will make your life a lot easier.

I like having title attributes in links though. They seem to help out with SEO or something.

Doh004
Apr 22, 2007

Mmmmm Donuts...
My plugin has the user uploading photos (specific to the plugin). I currently have them uploaded to a pictures directory within the plugin. Is this incorrect and should I just have it all uploaded to the uploads directory? Am I opening up some security concerns?

Stuntman Mike
Apr 14, 2007
The saucer people are coming!
Bringing my original question over from the Webdev thread, as I've decided since to use Wordpress. Please recommend to me some good plugins! :ohdear:

Myself posted:

I've got a final class project (web-media design course) for which I proposed the following:

  • A site that allows users to browse audio and video content sorted by date.

  • This content is user-submitted, they can upload/record their own video or audio, which then gets put in the directory to be browsed. Users can also submit via linking (directly, or via links to youtube/vimeo/etc)

  • When a user uploads content, they fill out a small form with their name and a few other fields. When a video in the directory is clicked the user is sent to a page, displaying the media player and this accompanying information (date, location, name of uploader, etc).

  • I don't need user profiles or accounts, all posting is done my "anonymous" users. In fact, I definitely don't want to require a login or profile, the user should browse the site and upload content without registering, only having to fill out the form.

I'm using Wordpress as the structure here, and it isn't a big site by any means - no need for extreme 1000-user measures or anything.

The first piece I need is a plugin that lets anonymous visitors post. Atop that, I need a plugin that lets visitors authorize with Facebook or Twitter and then post.

The posts themselves are audio or video - how easily can Wordpress handle that? I'd love to find something like Facebook's feature that lets you record video with your webcam right in the submit page.This is the tough one, I think.


TL;DR:

In a nutshell, what I need is to let anyone looking at the site/blog post video to it, with the option of just giving their name, or if they have a Twitter/Facebook account, logging in with that.

Any plugin recommendations? I'm a Wordpress noob and there's so many plugins out there to wade through.

Stuntman Mike fucked around with this message at 02:25 on Nov 10, 2010

Ned
May 23, 2002

by Hand Knit

Doh004 posted:

My plugin has the user uploading photos (specific to the plugin). I currently have them uploaded to a pictures directory within the plugin. Is this incorrect and should I just have it all uploaded to the uploads directory? Am I opening up some security concerns?

I'd try to put them in the uploads directory. If they uninstall the plugin do they lose those images?

Lareous
Feb 19, 2008

Doh004 posted:

My plugin has the user uploading photos (specific to the plugin). I currently have them uploaded to a pictures directory within the plugin. Is this incorrect and should I just have it all uploaded to the uploads directory? Am I opening up some security concerns?

Yeah, I'd put them in the uploads directory if at all possible. Did you make this plugin or are you using something like Photosmash Galleries?

Doh004
Apr 22, 2007

Mmmmm Donuts...

Ned posted:

I'd try to put them in the uploads directory. If they uninstall the plugin do they lose those images?
Umm, I haven't really thought that far out yet. I'd imagine if you uninstalled the plugin, you wouldn't want any of the old data. Now, deactivating it shouldn't delete the data (or should it? :iiam:)

Lareous posted:

Yeah, I'd put them in the uploads directory if at all possible. Did you make this plugin or are you using something like Photosmash Galleries?

Made the plugin from scratch. I had thought about using the built in WP uploading functionality; however, I have a fair amount of experience of image uploading and manipulation with PHP, so I was comfortable enough to build it in.

Ned
May 23, 2002

by Hand Knit

Stuntman Mike posted:

TL;DR:

In a nutshell, what I need is to let anyone looking at the site/blog post video to it, with the option of just giving their name, or if they have a Twitter/Facebook account, logging in with that.

Any plugin recommendations? I'm a Wordpress noob and there's so many plugins out there to wade through.

Do it by hand. Unless it is some low level BS class I think the goal of this assignment is to get you to learn how to develop the concepts, not integrate them. Otherwise everyone would turn in a WordPress install with a bunch of plugins.

Stuntman Mike
Apr 14, 2007
The saucer people are coming!

Ned posted:

Do it by hand. Unless it is some low level BS class I think the goal of this assignment is to get you to learn how to develop the concepts, not integrate them. Otherwise everyone would turn in a WordPress install with a bunch of plugins.

On the contrary, integrating the concepts is the primary goal. This is pretty ambitious for the class and I'm allowed to use existing plugins, etcetera to complete it. I've got no previous PHP or similar experience so I need all the help I can get.

I've got a fallback plan if I can't make this work, but I'd like to give it a shot.

Lareous
Feb 19, 2008

Stuntman Mike posted:

Any plugin recommendations? I'm a Wordpress noob and there's so many plugins out there to wade through.

Something like TDO Miniforms maybe?

BuddytheRat
Aug 14, 2005
I am trying to sort posts by a date held in a custom field using this plugin: http://matth.eu/wordpress-date-field-plugin

The only problem is when I try to actually query the posts, and arrange them by this custom value.

I am using the code suggested by the plugin developer.
code:
$cal_query = new WP_Query('post_type=event&meta_key=event_date_value&orderby=meta_value&meta_compare=>=&meta_value=' . time() . '&order=ASC' );
I've tested the output value of the custom field and checked all of the syntax with the query statement and it seems like it should work completely fine, instead, it tells me there are no posts to display. The client I am making the site for is ready and waiting to show off the site and I am going insane with all these roadblocks. :(

Ned
May 23, 2002

by Hand Knit
You probably need to shove the post_status in there too.

BuddytheRat
Aug 14, 2005

Ned posted:

You probably need to shove the post_status in there too.

No deal. It works fine until I add in the meta_value stuff.

Strict 9
Jun 20, 2001

by Y Kant Ozma Post
I'm about to take on a client which will probably be my biggest Wordpress site yet. Specifically, it's a magazine publisher with lots of archived issues, each of which has a column. Anyone have experience working with a publisher and organizing their content in Wordpress?

LittleCat
Oct 24, 2004

twinkle, twinkle, little bat

Strict 9 posted:

I'm about to take on a client which will probably be my biggest Wordpress site yet. Specifically, it's a magazine publisher with lots of archived issues, each of which has a column. Anyone have experience working with a publisher and organizing their content in Wordpress?

There are plugins to import well-formed HTML pages into Wordpress, if that's what you're looking for? I haven't used one (At the day job, I'm working on importing content from a magazine's old HTML site into Wordpress, but their HTML wasn't "well=formed" by any stretch so it's manual and taking forever), but there are a few in the plugins directory that review well.

Ned
May 23, 2002

by Hand Knit

Strict 9 posted:

I'm about to take on a client which will probably be my biggest Wordpress site yet. Specifically, it's a magazine publisher with lots of archived issues, each of which has a column. Anyone have experience working with a publisher and organizing their content in Wordpress?

I was the main WP person at Time Inc so I have some experience with this stuff.

El Kabong
Apr 14, 2004
-$10
I'm starting a how-to blog, which is more for getting my hands dirty with blogging than for creating any cash flow, but I'd like a few suggestions for basic, clean, seo-friendly themes that I can build upon as I learn what it is I want to do with this site.

hmm yes
Dec 2, 2000
College Slice
Nothing wrong starting with Twenty Ten theme + the All in One SEO plugin

Serfer
Mar 10, 2003

The piss tape is real



I figured I'd take a stab in the dark here...

On our company website, we're using something called "Sticky Image" to glue images to the posts, so essentially each post has a title image. However, it doesn't seem to have been updated in years, the authors website doesn't mention it, and all I can find is a handful of forum posts regarding it. Hell, I can't even find someone using the same version we are. Everyone else seems to be a version behind (1.31 vs 1.32)

Anyway, ever since we upgraded wordpress, it doesn't seem to upload the images correctly. I've done some debugging and can kind of see what's going on, but I don't want to hack it up too much because I'd rather just replace it with something supported. Is there any chance that there's a similar working plugin, or newer builtin functionality that can take what already exists and reuse it, or something that is easy to convert the existing data to.

Ned
May 23, 2002

by Hand Knit

Serfer posted:

Is there any chance that there's a similar working plugin, or newer builtin functionality that can take what already exists and reuse it, or something that is easy to convert the existing data to.

There is functionality called post thumbnails that was introduced in 2.9 that you probably want to incorporate with your theme.

Basically you put a piece of code in your functions.php and you get a box on the right of each post/page in the admin that allows you to select an image from the media library.
code:
add_theme_support( 'post-thumbnails' );
Then you just need to add it to your theme for the places you want it to appear.
code:
if (has_post_thumbnail()) {
the_post_thumbnail();
}
[/code]

Serfer
Mar 10, 2003

The piss tape is real



Ned posted:

There is functionality called post thumbnails that was introduced in 2.9 that you probably want to incorporate with your theme.

Ok, that sounds perfect, but, what about the older posts? Is there a way to integrate the already existing data with this?

Ned
May 23, 2002

by Hand Knit

Serfer posted:

Ok, that sounds perfect, but, what about the older posts? Is there a way to integrate the already existing data with this?

The short answer is no. The long answer is yes.

Basically you have to check if the post has a thumbnail associated with it. If it doesn't, do it the old way, otherwise, do it the new way.

You can always parse the content of old posts and pull out the first image.

Adbot
ADBOT LOVES YOU

mcsuede
Dec 30, 2003

Anyone who has a continuous smile on his face conceals a toughness that is almost frightening.
-Greta Garbo
Try this plugin: http://wordpress.org/extend/plugins/regenerate-thumbnails/

  • 1
  • 2
  • 3
  • 4
  • 5
  • Post
  • Reply