PHPFixing
  • Privacy Policy
  • TOS
  • Ask Question
  • Contact Us
  • Home
  • PHP
  • Programming
  • SQL Injection
  • Web3.0

Tuesday, November 15, 2022

[FIXED] How to fix this fatal error of php Fatal error: Uncaught Error: Call to undefined function nm_blog_get_ajax_content()?

 November 15, 2022     error-handling, javascript, jquery, php     No comments   

Issue

Image of the output in the browser

I am working on a project offline. I have a file called index.php. Now I want to launch in a browser sp that I can edit it.

But When I try to launch the index.php file by vs code editor the browser show this error. Fatal error: Uncaught Error: Call to undefined function nm_blog_get_ajax_content() in C:\Users\Joy\Downloads\Compressed\minimalist-theme\Theme Files\savoy\savoy\index.php:1 Stack trace: #0 {main} thrown in C:\Users\Joy\Downloads\Compressed\minimalist-theme\Theme Files\savoy\savoy\index.php on line 1

The index.php file is this:

<?php nm_blog_get_ajax_content(); // AJAX: Get blog content only, then exit ?>
<?php
  global $nm_theme_options;
  
  $show_categories = ( $nm_theme_options['blog_categories'] ) ? true : false;
  $categories_class = ( $show_categories ) ? '' : ' nm-blog-categories-disabled';

  $blog_page = nm_blog_get_static_content();
?>
<?php get_header(); ?>

<div class="nm-blog-wrap<?php echo esc_attr( $categories_class ); ?>">
  <?php if ( $blog_page ) : ?>
    <div class="nm-page-full">
      <div class="entry-content">
        <?php echo do_shortcode( $blog_page->post_content ); ?>
      </div>
    </div>
  <?php endif; ?>
  
  <?php if ( $show_categories ) : ?>
    <div class="nm-blog-categories">
      <div class="nm-row">
          <div class="col-xs-12">
            <?php echo nm_blog_category_menu(); ?>
          </div>
      </div>
    </div>
  <?php endif; ?>
  
  <?php get_template_part( 'template-parts/blog/content' ); ?>
</div>

<?php get_footer(); ?>

My aim is to launch in the local host of my browser that I couldn't do. Can anyone help me, please?


Solution

You need to include the file where the nm_blog_get_ajax_content() function is stored.

Something like this yet you will need to change the path to match your filename and path which contains this function

<?php require_once('/path/to/functions/file.php'); ?>


Answered By - centralhubb.com
Answer Checked By - Senaida (PHPFixing Volunteer)
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg
Newer Post Older Post Home

0 Comments:

Post a Comment

Note: Only a member of this blog may post a comment.

Total Pageviews

Featured Post

Why Learn PHP Programming

Why Learn PHP Programming A widely-used open source scripting language PHP is one of the most popular programming languages in the world. It...

Subscribe To

Posts
Atom
Posts
Comments
Atom
Comments

Copyright © PHPFixing