• 0

DMS 2 Fix Faulty Custom Post Template


Question

Posted · Report post

Hi

 

I've experienced a major problem. I was using PL NextBox on a custom post type detail page. As far as I know the php content was fine, but on refreshing / loading the page I get "Oops, There may be an issue loading". problem is that I hadn't created a template for the individual custom post type yet and so it's pulling up an unknown template. I simply can't get rid of the error as there is no template to delete. Very frustrating. Please advise how to reset this particular post type in DMS. Is there a fallback?

 

Best Regards
 
Glennyboy

Share this post


Link to post
Share on other sites

15 answers to this question

  • 0

Posted · Report post

I've tried resetting the permailink to a custom permalink and that didn't work so I'm stuck with a post type with an error that seems impossible to remove?

Share this post


Link to post
Share on other sites
  • 0

Posted · Report post

OK Glad to say I fixed this issue by going directly into the database to remove the offending PLNextBox entry. If anyone else has the same sort of issue you can filed Pagelines sections in the database table wp_pl_data_sections. I am using a multisite install so it is format wp_thesiteid_pl_data_sections.

 

Pagelines need more failsafe fallback measures.

Share this post


Link to post
Share on other sites
  • 0

Posted · Report post

Thanks for informing us the issue has been resolved and I will also make sure our developers see this topic.

Share this post


Link to post
Share on other sites
  • 0

Posted · Report post

So what content was in the box that caused the error? Must have been javascript im guessing, or a PHP error.

Share this post


Link to post
Share on other sites
  • 0

Posted · Report post

No javascipt involved - leaving just php in this case

Share this post


Link to post
Share on other sites
  • 0

Posted · Report post

ok, and the code was?

Share this post


Link to post
Share on other sites
  • 0

Posted · Report post

deleted and updated I'm afraid. It was calling a custom field a the ACF plugin though

Share this post


Link to post
Share on other sites
  • 0

Posted · Report post

I guess we'll never know then ;)

 

The nextbox section does its best to test for PHP errors, but it isn't entirely bullet proof.

Share this post


Link to post
Share on other sites
  • 0

Posted · Report post

The php was something like:-

<?php 
 
$term = get_field('taxonomy_field_name');
 
if( $term ): ?>
 
	<h2><?php echo $term->name; ?></h2>
	<p><?php echo $term->description; ?></p>
 
<?php endif; ?>

Minus the staring and ending php tags

Share this post


Link to post
Share on other sites
  • 0

Posted · Report post

Well off the bat, you are not checking if $term is an object.. and opening closing tags just to echo might be an issue too...

 

consider this:

$term = get_field('taxonomy_field_name');

if( is_object( $term ) && isset( $term->name ) && isset( $term->description ) ) {

    printf( '<h2>%s</h2><p>%s</p>', $term->name, $term->description );

}

Share this post


Link to post
Share on other sites
  • 0

Posted · Report post

I'm not sure if ACF handles that? The code is directly from their documentation

Share this post


Link to post
Share on other sites
  • 0

Posted · Report post

I have no idea what ACF is, but my code does EXACLY what your code does, but it does it with error checking included. In PHP you have to assume a value is not set, so you must check it is valid before using it.

Share this post


Link to post
Share on other sites
  • 0

Posted · Report post

Ok well whatever it is, my code is the same, uses the same function exactly as yours does.

Share this post


Link to post
Share on other sites
  • 0

Posted · Report post

If its any consolation I added your code to my CodeBox for use later :-)

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now