We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 46477
    • 21 Posts
    Hello,

    I'm having an issue with pulling a couple of chunks into Wordpress, I manager to fix the issues with WayFinder not loading however all of the links in the chunk are now wrong.

    require_once '../config.core.php';
    require_once MODX_CORE_PATH.'model/modx/modx.class.php';
    $modx = new modX();
    $modx->initialize('web');
    $modx->resource = $modx->getObject('modResource',$modx->getOption('site_start'));
    
    $html = $modx->getChunk('Footer');
    $html .= $modx->runSnippet('Wayfinder');
    
    echo $html;
    


    1- The URLs should be showing as domain.com/about but it is now shoiwng as domain.com/blog/about

    I can't tell if this is a Wordpress or MODX URL issue and seem to be going around in circles, if I add a slash to the front of the URL it gives me the correct url, for example /# gives me the url domain.com/#

    2 - The blog item in the menu should show as active.

    Thanks
    Charles

    This question has been answered by BobRay. See the first response.

      • 46477
      • 21 Posts
      Still trying to get to the bottom of this, it looks as though i'm pulling the Wordpress URL into the chunk rather than the root URL. Can I overwrite this in the chunk only?

      Maybe specify a site_url or base_url?

      Thanks
      Charles
      • discuss.answer
        • 3749
        • 24,544 Posts
        Try changing the link tags in the chunk to this form:

        [[~12? &scheme="full"]]
          Did I help you? Buy me a beer
          Get my Book: MODX:The Official Guide
          MODX info for everyone: http://bobsguides.com/modx.html
          My MODX Extras
          Bob's Guides is now hosted at A2 MODX Hosting
          • 46477
          • 21 Posts
          Thanks BobRay, worked perfectly!

          Sorry for the delay in coming back to you, I didn't get a notification from the forum so I've only just seen this.

          Charles