The Snipr files and projects are visible on the frontend of your site. By default they will show on a default WordPress single page. This may not be adjusted to your specific theme. In order to integrate the look of the pages with your theme you can create custom single pages for the Snipr plugin.

  • 1. Create a new folder called wpsnipr and place it inside your main theme folder. /wp-content/themes/your_theme/wpsnipr
  • 2. Create 3 new php files called Snipr_Project.php, Snipr_File.php and Snipr_Editor.php and add them to the wpsnipr folder you created. /wp-content/themes/your_theme/wpsnipr
  • 3. Now you will need to open your theme folder and search for the file called single.php or page.php. Copy it’s content and paste it into the new files you created before.
    Remove all code untill you only have the main html page structure left and search for the part where it usually show the post/page content. Usually the default WordPress function the_content() is used for this. Then replace the_content() with the snipr code for the specific page.

Snipr_Project.php

<?php 
/* Template Name: WP Snipr Project */
get_header();

$snipr_json = sniprApi::get_post_meta( $post->ID, '_snipr_json');

echo sniprApi::show_project(
	array(
		'project_id' => sniprApi::project_id($post->ID), 
		'post_id' => $post->ID,
		'json' => sniprApi::encode( $snipr_json, 'json' ),
		'readonly' => 1,
		'frontend' => 1
	)
);

get_footer();

Snipr_File.php

<?php 
/* Template Name: WP Snipr File */
get_header();

$snipr_json = sniprApi::get_post_meta( $post->ID, '_snipr_json');

echo sniprApi::show_file(
	array(
		'file_id' => sniprApi::project_id($post->ID), 
		'post_id' => $post->ID,
		'json' => sniprApi::encode( $snipr_json, 'json' ),
		'readonly' => 1,
		'frontend' => 1
	)
);

get_footer();

Snipr_Editor.php

<?php 
/* Template Name: WP Snipr Editor */
get_header();

$snipr_json = sniprApi::get_post_meta( $post->ID, '_snipr_json');

echo sniprApi::show_project(
	array(
		'project_id' => sniprApi::project_id($post->ID), 
		'post_id' => $post->ID,
		'json' => sniprApi::encode( $snipr_json, 'json' ),
		'readonly' => 0,
		'frontend' => 1
	)
);

get_footer();