Jump to content

Recommended Posts

Hi,

Would be most grateful if someone could give some advice.

I have a html page which parses php. Within this page there is a small amount of CMS content which uses php and I'd also like to display some recent Wordpress blog content which also uses php.

My issue is the blog content will display but the CMS content will not. Each will work on their own.

Please excuse my ignorance here but what am I doing wrong?

The code is this.

   <?php require('golf-blog/wp-blog-header.php');?>
<?php
$posts = get_posts('numberposts=4&order=DEC&orderby=post_date');
foreach ($posts as $post) : setup_postdata( $post ); ?>

<h4><?php the_title(); ?>  </h4>  
<?php the_excerpt(); ?> 
<?php
endforeach;
?>

<?php ob_start(); ?>
{SCMS_CONTENT_2}
<?php $pjSimpleCMS = 2; $pjHide = 1; include '/home/costa-blanca/public_html/cms/app/views/pjLayouts/pjActionLoad.php'; ?>

 

Link to post
Share on other sites

You're not echoing out the content

<h4><?php the_title(); ?>  </h4>  

should be

<h4><?php echo the_title(); ?>  </h4>  

/* or this */

<h4><?= the_title() ?>  </h4>  

 

Link to post
Share on other sites

It looks like you're mixing CMSs? WordPress by itself doesn't understand mustache notation, so {SCMS_CONTENT_2} means nothing to it unless you're using a theme or plugin that parses that code.

1 hour ago, Strider64 said:

You're not echoing out the content

the_title() will echo by default - you can turn echo off by passing false to the third parameter.

Link to post
Share on other sites

Thank you both for your prompt replies.

Strider64 - I tried what you suggested and its still the same.

maxxd - In terms of mixing CMS. I just pull some Wordpress content into an external html page. Wordpress exists on the site but it stands alone, I'm not using a Wordpress as CMS. The CMS is a simple script from a company called PHPjabbers.

The {SCMS_CONTENT_2}  is my CMS content and just brings a table to the page.

So nothing I can do.....one or the other has to go?

Link to post
Share on other sites

If you're pulling data from WordPress but not using it as the CMS (so basically, it's headless) then your page doesn't know what to do with the WordPress functions you're calling. That's what I mean by mixing CMSs, you're relying on the PHPjabbers stuff to handle the bracketed text replacement and WordPress to hand the_posts(), the_title(), the_excerpt(), etc. Pick one - make sure you include the proper WordPress handler code, or use WordPress and include the PHPjabber script in the WordPress template file and use it there.

Link to post
Share on other sites

maxxd,

Thank you for taking the time to reply.

I'm now using the Wordpress side in php and I'm loading the CMS with javascript. Small loss to seo but its a good compromise.

Once again thank you....

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.