We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 18913
    • 654 Posts
    Just testing something out and it appears that the "wp_bridge" snippet doesn’t need to be called at the start of a template, if there is the include statement (noted above) in the "index.php" file.

    And on the WP side, it looks like the "modx_bridge" code can be included in the functions.php file. This then means that the "require_once" statement doesn’t need to be included in the various templates.

    ...which simplifies things a bit. I might find out that I’ve overlooked something, but if anyone is trying this out, it might be worth just testing those two changes first.

    MattC
      • 12379
      • 460 Posts
      require(’/blog/wp-blog-header.php’);


      should be just
      require('blog/wp-blog-header.php');


      (on Linux, at least)
        Mostly harmless.
        • 12379
        • 460 Posts
        In modx_bridge.php it’s important to define MODX_SITE_BASE_URL as simply "/" otherwise the base url will repeat itself like this: http//www.site.comhttp//www.site.com/

        	define('MODX_SITE_BASE_URL', '/');

          Mostly harmless.
          • 12379
          • 460 Posts
          Just testing something out and it appears that the "wp_bridge" snippet doesn’t need to be called at the start of a template, if there is the include statement (noted above) in the "index.php" file.

          On MODx side I get the error:

          "MODx is not currently installed or the configuration file cannot be found. Do you want to install now?"

          And on the WP side, it looks like the "modx_bridge" code can be included in the functions.php file. This then means that the "require_once" statement doesn’t need to be included in the various templates.

          Works fine on WP side, but again creates the above error on MODx pages...
            Mostly harmless.
            • 12379
            • 460 Posts
            On the MODx side, I can see all the functions work, but it’s still in want of some WP function code replicating the blog post summaries on the front page of WordPress...
              Mostly harmless.
              • 12379
              • 460 Posts
              Here’s a code suggestion for wp_function, duplicating the WP index code as a snippet. While the WP functions are returning the correct data, the html tags (outside the WP functions) aren’t displaying, so <div>s, <h3>, and <a> tags aren’t appearing in the output leaving a horrible formatted mess of data! Any ideas please? Have tried "echo" without much difference.


              <?php
              $output = '';
              if (have_posts()) : while (have_posts()) : the_post(); 
              $output .= the_date('','<h2>','</h2>');
              $output .= '<div ' . post_class() . 'id="post-' . the_ID() . '" >';
              $output .= '<h3 class="storytitle"><a href="' . the_permalink() . '" rel="bookmark">' . the_title() . '</a></h3>';
              $output .= '<div class="meta">' . _e("Filed under:") . the_category(',') . '—' . the_tags(__('Tags: '), ', ', ' — ') . the_author() . '@' . the_time() . edit_post_link(__('Edit This')) . '</div>';
              $output .= '<div class="storycontent">' . the_content(__('(more...)')) . '</div>';
              $output .=  '<div class="feedback">' . wp_link_pages() . comments_popup_link(__('Comments (0)'), __('Comments (1)'), __('Comments (%)')) . '</div>';
              $output .= '</div>';
              $output .= comments_template();
                  
              endwhile; else:
              $output .= _e('Sorry, no posts matched your criteria.') . '</p>';
              
              endif;
              $output .= posts_nav_link(' — ', __('« Newer Posts'), __('Older Posts »'));
              
              return $output;
              ?>
                Mostly harmless.
                • 26931
                • 2,314 Posts
                Here’s a code suggestion for wp_function, duplicating the WP index code as a snippet. While the WP functions are returning the correct data, the html tags (outside the WP functions) aren’t displaying, so <div>s, <h3>, and <a> tags aren’t appearing in the output leaving a horrible formatted mess of data! Any ideas please? Have tried "echo" without much difference.
                don’t know if it helps, but there’s also this:
                http://www.allebrum.com/current_projects/allebrum-wordpress-tools-for-modx
                http://modxcms.com/forums/index.php?topic=46030.0
                  • 12379
                  • 460 Posts
                  Seems inserting require(’blog/wp-blog-header.php’); interferes with header information for other services:

                  For example:


                  • RSS feed validation for MODx, causing Feedburner to substitute the WP blog feed for MODx-based RSS feeds. Feed validation services also produce an error.
                  • PayPal IPN validation errors.
                  • Google Adwords: "Reason for disapproval: Invalid HTTP Response Code"


                  Would be more ideal to include wp-blog-header.php in the template itself rather than hardcoded in MODx’s index.php file, which would also avoid overwriting the include when updating MODx.
                    Mostly harmless.