Skip to content

Instantly share code, notes, and snippets.

@JulioPotier
Last active December 27, 2015 23:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save JulioPotier/7406741 to your computer and use it in GitHub Desktop.
Save JulioPotier/7406741 to your computer and use it in GitHub Desktop.
add_action( 'wp_head', 'page_into_contact_form' );
function page_into_contact_form(){
if( is_main_query() && is_page( get_option( 'contact_page_id' ) ){
add_filter( 'the_content', 'content_into_contact_form' );
}
}
function content_into_contact_form( $content ){
// $content est le contenu par défaut de l'article
if( $GLOBALS['post']->ID == get_option( 'contact_page_id' ) ){
$content = '[contact-form-7 id="2" title="Contact form 1"]';
}
return $content;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment