In finally got off my butt and have decided to do actually do some website work that doesn’t involve being brain-dead and using drupal. So here I am switching to MODx (which I love). Heres my issue:
I’m currently using Wordpress to blog. I’ve looked at switching to MODx for that as well, but it just doesn’t have the polish for this specific purpose that Wordpress does. So I thought I would use "The Loop" in Wordpress to display blog posts and information from MODx pages. I created a real file test.php and put
<?php
define('WP_USE_THEMES', false);
require('./wordpress/wp-blog-header.php');
//get_header();
?>
<?php
require_once("./wordpress/wp-config.php"); ?>
<div id="content">
<?php query_posts('cat=1&showposts=1'); ?>
<?php if (have_posts()) : while (have_posts()) : the_post(); ?>
<div class="post">
<h3 class="posttitle" id="post-<?php the_ID(); ?>"><a href="<?php the_permalink() ?>" rel="bookmark"><?php the_title(); ?></a></h3>
<div class="details"><div class="inside">Written by <?php the_author_posts_link() ?> on <?php the_time('d.m.Y');?> |
<?php the_category(', ') ?> <?php edit_post_link('Edit this', ' - ', ''); ?></div></div>
<div class="postcontent">
<?php the_excerpt_reloaded(500, '<p><a><ul><ol><li><img><br /><blockquote>', 'content', FALSE, '', FALSE, 1, TRUE); ?>
<?php
$distract = get_post_meta($post->ID, "Current Distraction", true);
if ($distract) {
echo "<b>Current Distraction:</b> " . $distract;
}
?>
</div>
<div class="details"><div class="inside"><?php comments_popup_link('No Posts', '1 Post', '% Posts'); ?> so far | <a href="<?php the_permalink() ?>">There's More »</a></div></div>
<!--
<?php trackback_rdf(); ?>
-->
</div>
<?php comments_template(); ?>
<?php endwhile; else: ?>
<p><?php _e('Sorry, no posts matched your criteria.'); ?></p>
<?php endif; ?>
</div>
and I get 1 post displayed.
Than I put the same code in a snippet and I get an error:
Fatal error: Call to a member function get_row() on a non-object in ./wordpress/wp-includes/functions.php on line 281
I figured out that I can put
define('WP_USE_THEMES', false);
require('./flog/wp-blog-header.php');
in the at the top of the MODx index.php file, but then I get different errors (I’ve gotten some functions to work, but others do not function)
Does anyone have any experience with this? Also, is there a way to execute "clean" php within MODx (Im assuming we’re seeing some issue with the MODx environment effecting the Wordpress Loop)? Is there a good way to get debug information about why some Wordpress are functioning, but others aren’t?
TIA