Permalink
Browse files

Request for include a option to use with theme via functions php closes

#101

#How to use 
Put this code inside functions.php after extracting tx-onepager.zip

```php
require "tx-onepager/theme.php";
```
  • Loading branch information...
1 parent 80e571d commit 5266b40afde8bbfffc8bd6c2a0e8e5b8d1f6e453 @nadimtuhin nadimtuhin committed Oct 18, 2015
Showing with 73 additions and 6 deletions.
  1. +5 −0 {app/inc → }/constants.php
  2. +5 −1 gulpfile.js
  3. +55 −0 theme.php
  4. +8 −5 tx-onepager.php
@@ -1,5 +1,10 @@
<?php
+if(!defined('ONEPAGER_URL')){
+ define( 'ONEPAGER_URL', plugins_url( '', __FILE__ ) );
+}
+
+define( 'ONEPAGER_PATH', dirname( __FILE__ ) );
define( 'ONEPAGER_PRESETS_PATH', ONEPAGER_PATH . "/presets" );
define( 'ONEPAGER_PRESETS_URL', ONEPAGER_URL . "/presets" );
define( 'ONEPAGER_BLOCKS_PATH', ONEPAGER_PATH . "/blocks" );
View
@@ -156,7 +156,11 @@ gulp.task('default', function () {
});
gulp.task('package', ['package-build'], function () {
- var files = ['app', 'assets', 'blocks', 'src', 'vendor', 'presets', 'tx-onepager.php', 'uninstall.php', 'readme.txt', 'CHANGELOG.md'];
+ var files = [
+ 'app', 'assets', 'blocks', 'src', 'vendor', 'presets',
+ 'tx-onepager.php', 'constants.php', 'theme.php', 'uninstall.php',
+ 'readme.txt', 'CHANGELOG.md'
+ ];
packager("tx-onepager", files, ROOT_PATH);
});
View
@@ -0,0 +1,55 @@
+<?php
+// If this file is called directly, abort.
+if ( ! defined( 'WPINC' ) ) {
+ die;
+}
+
+if ( ! defined( 'ONEPAGER_VERSION' ) ) {
+ define( 'ONEPAGER_VERSION', '1.2.3.3' );
+}
+
+if ( ! defined( 'ONEPAGER_PHP_VERSION' ) ) {
+ define( 'ONEPAGER_PHP_VERSION', '5.4' );
+}
+
+if ( ! defined( 'ONEPAGER_URL' ) ) {
+ define( 'ONEPAGER_URL', get_stylesheet_directory_uri()."/tx-onepager" );
+}
+
+require( __DIR__ . "/constants.php" );
+
+function onepager_php_version_check() {
+ if ( ! version_compare( PHP_VERSION, ONEPAGER_PHP_VERSION, '<' ) ) {
+ return;
+ }
+
+ $notice =
+ 'You are running ancient version of PHP-<strong>%s</strong>.
+Onepager requires at least PHP <strong>%s</strong> to run smoothly.
+<br/>Please update your PHP version to run this plugin and keep you website secure.';
+
+ wp_die( sprintf( $notice, PHP_VERSION, ONEPAGER_PHP_VERSION ) );
+}
+
+onepager_php_version_check();
+
+
+require( ONEPAGER_PATH . '/app/inc/support.php' );
+require( ONEPAGER_PATH . '/src/functions.php' );
+require( ONEPAGER_PATH . '/src/theme_helpers.php' );
+require( ONEPAGER_PATH . '/vendor/autoload.php' );
+
+require( ONEPAGER_PATH . '/app/Onepager.php' );
+require( ONEPAGER_PATH . '/app/bootstrap.php' );
+
+require( ONEPAGER_PATH . '/app/Api/routes.php' );
+require( ONEPAGER_PATH . '/app/OptionsPanel/settings.php' );
+require( ONEPAGER_PATH . '/app/Metabox/metabox.php' );
+
+
+add_action( 'wp_head', 'print_onepager_meta' );
+function print_onepager_meta() {
+ echo "<meta type='page-builder' content='tx-onepager'>";
+}
+
+do_action( 'onepager_loaded' );
View
@@ -17,11 +17,15 @@
die;
}
-define( 'ONEPAGER_VERSION', '1.2.3.3' );
-define( 'ONEPAGER_PHP_VERSION', '5.4' );
+if(!defined('ONEPAGER_VERSION')){
+ define( 'ONEPAGER_VERSION', '1.2.3.3' );
+}
+
+if(!defined('ONEPAGER_PHP_VERSION')) {
+ define( 'ONEPAGER_PHP_VERSION', '5.4' );
+}
-define( 'ONEPAGER_URL', plugins_url( '', __FILE__ ) );
-define( 'ONEPAGER_PATH', dirname( __FILE__ ) );
+require(__DIR__."/constants.php");
function onepager_php_version_check() {
if ( ! version_compare( PHP_VERSION, ONEPAGER_PHP_VERSION, '<' ) ) {
@@ -39,7 +43,6 @@ function onepager_php_version_check() {
onepager_php_version_check();
-require( ONEPAGER_PATH . '/app/inc/constants.php' );
require( ONEPAGER_PATH . '/app/inc/support.php' );
require( ONEPAGER_PATH . '/src/functions.php' );
require( ONEPAGER_PATH . '/src/theme_helpers.php' );

0 comments on commit 5266b40

Please sign in to comment.