|
|
|
|
Thread title: Is it just me, or does wordpress suck form a coding standpoint? |
|
|
|
|
|
Thread tools
Search this thread
Display Modes
|
|
12-07-2010, 08:23 PM
|
#11
|
Status: #pugs {display: block;}
Join date: Jan 2007
Location: Chicago
Expertise: CSS, HTML, PHP
Software: Sublime Text 2
Posts: 1,187
|
Yeah, I think you're just complaining about WordPress because you've just got an issue with not really knowing much about it.
Here is a query to grab the latest five posts. There are a bunch of other parameters that you can use with it as well.
Code:
<?php query_posts('showposts=5'); ?>
<?php while (have_posts()) : the_post(); ?>
<li><a href="<?php the_permalink(); ?>">
<?php the_title(); ?></a></li>
<?php endwhile; ?>
http://codex.wordpress.org/Function_...ce/query_posts
Refer to the codex for anything you don't know about. Or just PM me and I can help you out with finding what you would need to use.
|
|
12-07-2010, 08:34 PM
|
#12
|
Status: Geek
Join date: Apr 2006
Location: Denver, CO
Expertise: Software
Software: Chrome, Notepad++
Posts: 6,894
|
Originally Posted by Jordan
Yeah, I think you're just complaining about WordPress because you've just got an issue with not really knowing much about it.
Here is a query to grab the latest five posts. There are a bunch of other parameters that you can use with it as well.
Code:
<?php query_posts('showposts=5'); ?>
<?php while (have_posts()) : the_post(); ?>
<li><a href="<?php the_permalink(); ?>">
<?php the_title(); ?></a></li>
<?php endwhile; ?>
http://codex.wordpress.org/Function_...ce/query_posts
Refer to the codex for anything you don't know about. Or just PM me and I can help you out with finding what you would need to use.
|
That's not the issue, I have the code I need and it works great inside my template. The issue is that I need to use that function outside of wordpress on a non-wordpress page. The function I need is located in wp-includes/post.php, which requires wp-includes/wp-db.php, which requires wp-includes/load.php, which requires wp-includes/functions.php, which requires wp-config.php, which for no apparent reason 302 redirects me to wp-admin/install.php
Here is the blog (see the "latest news article" section on the bottom):
http://67.227.152.40/~anaverag/dir/blog
Here is the hard coded part outside of the blog:
http://67.227.152.40/~anaverag/dir/index.php
|
|
12-07-2010, 08:44 PM
|
#13
|
Status: #pugs {display: block;}
Join date: Jan 2007
Location: Chicago
Expertise: CSS, HTML, PHP
Software: Sublime Text 2
Posts: 1,187
|
Well, if you need to use it in a non-WordPress blog, you're still doing it the wrong way. You can use the same query I use. You just add:
Code:
<?php
require('/the/path/to/your/wp-blog-header.php');
?>
So now we have:
Code:
<?php
require('/the/path/to/your/wp-blog-header.php');
?>
<?php query_posts('showposts=5'); ?>
<?php while (have_posts()) : the_post(); ?>
<li><a href="<?php the_permalink(); ?>">
<?php the_title(); ?></a></li>
<?php endwhile; ?>
Again, you can refer to the codex for using WordPress outside of.. WordPress: http://codex.wordpress.org/Integrati...h_Your_Website
|
|
12-07-2010, 08:59 PM
|
#14
|
Status: Geek
Join date: Apr 2006
Location: Denver, CO
Expertise: Software
Software: Chrome, Notepad++
Posts: 6,894
|
Thanks, that gets me a lot closer, but it still seems to be redirecting to wp-admin/install.php. I cant find an solution for this on Google or the docs so I'm wondering if you know what that is about.
I'd be willing to hire you to fix this.
|
|
12-07-2010, 09:19 PM
|
#15
|
Status: Geek
Join date: Apr 2006
Location: Denver, CO
Expertise: Software
Software: Chrome, Notepad++
Posts: 6,894
|
Just figured out what was happening:
Wordpress when included tried to get its files relitave to the location of the calling file. Since they were in different directories it could not find them. It then sent me to the install page because it figured I didnt install yet. Here is the fix
Code:
//Wrong
require('./blog/wp-blog-header.php');
//Wrong
require('blog/wp-blog-header.php');
//Right
define('ABSPATH', dirname(__FILE__).'/');
require(ABSPATH . 'blog/wp-blog-header.php');
edit: That actually broke something else, but it is yet another step to an actual solution. I'll post again when I find it.
edit2: The problem it created had to do with the inner workings of my templating system, I included the file in the same way in a non-template file and it all works perfect.
Thanks Jordan!
|
|
12-07-2010, 10:18 PM
|
#16
|
Status: #pugs {display: block;}
Join date: Jan 2007
Location: Chicago
Expertise: CSS, HTML, PHP
Software: Sublime Text 2
Posts: 1,187
|
Woo, glad you got it working!
It's okay on having the issues with WordPress. After sending you the query here, I remembered how in '08 I was clueless on how the **** I was going to include loop data on a non-WordPress blog. It's ridiculous how insanely easy it is once you know where to look.
But srsly, just PM me if you have questions or need help in the future. Don't mind one bit.
|
|
|
|
|
|
|
|
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
|
|
|
|