Support » Fixing WordPress » How do I; add a [shortcode] to the 404.php file?

  • Resolved Forest Skills

    (@forest-skills)


    Ok, so from first principals;
    1) I use Mantra as my theme, but this shouldn’t have any bearing on this question.
    2) I have modified the standard 404.php slightly so that there is a less generic 404 page.
    3) I use the FS Contact Form plugin which provides nice simple shortcode for you to paste into your pages to show a contact form.
    4) I have a contact form dedicated for people to let me know if something isn’t working on the site.

    So, how do I add the cut and paste shortcode ( [si-contact-form form=’3′] ) to my 404.php file so that the form is included as part of the 404 page?

    FYI; the ‘click here’ bit below is a work around and I’d rather it said something like; “Alternatively please fill in the form below to tell us where you were trying to get to as you may have stumbled across a problem with the website that we are not aware of yet.”

    Current 404.php file text:

    [ Moderator Note: Please post code or markup snippets between backticks or use the code button. Not the single quote character, that does not work. ]

    <?php
    /**
     * The template for displaying 404 pages (Not Found).
     *
     * @package Cryout Creations
     * @subpackage mantra
     * @since mantra 0.5
     */
    
    get_header(); ?>
    
    	<div id="container">
    
    		<div id="content" role="main">
    
    			<div id="post-0" class="post error404 not-found">
    				<h1 class="entry-title"><?php _e( 'Oops!', 'mantra' ); ?></h1>
    				<div class="entry-content">
    					<p><?php _e( 'The Forest Skills Ltd Team are really sorry but the page, blog posting or external hyper-link that you tried to access could not be found. Perhaps if you type a specific word in the search engine below you may be able to find it?', 'mantra' ); ?></p>
    					<?php get_search_form(); ?>
    					<p><?php _e( 'Alternatively please <a href="http://www.forestskillsltd.co.uk/website-problem/">click here</a> to tell us where you were trying to get to; you may have stumbled across a problem with the website that we are not aware of yet.', 'mantra' ); ?></p>
    					<p><strong><?php _e( 'The Forest Skills Ltd Team.', 'mantra' ); ?></strong></p>
    					<p><h6><?php _e( 'Let the adventure begin!', 'mantra' ); ?></h6></p>
    				</div><!-- .entry-content -->
    			</div><!-- #post-0 -->
    
    		</div><!-- #content -->
    <?php get_sidebar(); ?>
    	</div><!-- #container -->
    	<script type="text/javascript">
    		// focus on search field after it has loaded
    		document.getElementById('s') && document.getElementById('s').focus();
    	</script>
    
    <?php get_footer(); ?>

    Thanks in advance! (again!!) 🙂

    Chris

Viewing 5 replies - 1 through 5 (of 5 total)
Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘How do I; add a [shortcode] to the 404.php file?’ is closed to new replies.