This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<html> | |
<head> | |
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no"> | |
<link rel="stylesheet" type="text/css" href="https://stackpath.bootstrapcdn.com/bootstrap/4.1.1/css/bootstrap.min.css"> | |
</head> | |
<body> | |
<style> | |
.youtube { | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
------------------------------ | |
PHP FOR THE REST & AJAX SETUP | |
------------------------------ | |
<?php | |
/** | |
* RelatedPostMPF Class | |
*/ | |
class RelatedPostMPF | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ADDING AUTHOR & IMAGE FIELDS TO REST | |
function related_post_register_fields() { | |
# Add Author Name | |
register_rest_field( 'post', | |
'author_name', | |
array( | |
'get_callback' => 'related_post_author_name', | |
'update_callback' => null, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function __construct() | |
{ | |
add_filter( 'manage_posts_columns' , array( $this, 'add_views_column' ) ); | |
add_action( 'manage_posts_custom_column' , array( $this, 'add_data_into_views_column' ), 5, 2 ); | |
} | |
public function add_views_column( $columns ) { | |
$columns['post_views'] = __('Views'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// add top-level administrative menu | |
function moose_add_toplevel_menu() { | |
add_menu_page( 'Page Title', 'Menu Title', 'manage_options', 'menu_slug', 'page_callback_function', 'dashicons-media-spreadsheet' ); | |
add_submenu_page( 'menu_slug', 'Page Title 1', 'Sub-menu 1 Title', 'manage_options', 'submenu1_slug', 'page_callback_function1' ); | |
add_submenu_page( 'menu_slug', 'Page Title 2', 'Sub-menu 2 Title', 'manage_options', 'submenu2_slug', 'page_callback_function2' ); | |
} | |
add_action( 'admin_menu', 'moose_add_toplevel_menu' ); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public function HTML_INSIDE_PHP() { | |
ob_start(); // OUTPUT BUFFERING | |
?> | |
<h1>This is how to generate HTML Content inside PHP </h1> | |
<p> | |
Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod | |
tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* | |
* MODULE ONE SHORTCODE | |
* | |
*/ | |
function moose_module_one() { | |
ob_start(); // OUTPUT BUFFERING |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
get_header(); ?> | |
<section id="OI-SECTION-ONE" class="oi-module"> | |
<?php echo do_shortcode('[module_three]'); ?> | |
</section> | |
<section id="OI-SECTION-TWO" class="oi-module"> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function page_callback_function() { | |
// check if user is allowed access | |
if ( ! current_user_can( 'manage_options' ) ) return; | |
?> | |
<div class="wrap"> | |
<h1><?php echo esc_html( get_admin_page_title() ); ?></h1> | |
<form action="options.php" method="post"> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
add_action( 'admin_menu', 'addThemePage' ); | |
function addThemePage () { | |
add_theme_page( | |
__('Theme Options', 'wpsettings'), | |
__('Theme Options', 'wpsettings'), | |
'edit_theme_options', | |
'mpf-settings', | |
'addThemeOptionsPage' |