This file contains hidden or 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 | |
/** | |
* Settings Init. | |
* | |
* Initialize settings for the plugin. | |
* | |
* @since 1.0.0 | |
*/ | |
function tmr_settings_init() { | |
// Register a new setting for `general` page. |
This file contains hidden or 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 | |
/** | |
* Style the Display. | |
* | |
* This method styles the user roles. | |
* | |
* @since 1.0.0 | |
*/ | |
function tmr_style_display() { | |
?> |
This file contains hidden or 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 | |
/** | |
* Tell My Role. | |
* | |
* Get the roles of current user and display it. | |
* | |
* @since 1.0.0 | |
*/ | |
function tmr_display_current_user_role() { | |
// Get current user. |
This file contains hidden or 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 | |
/** | |
* Plugin Name: Tell My Role | |
* Plugin URI: https://WPCouple.com | |
* Description: A plugin to display user roles in WordPress dashboard. | |
* Version: 1.0.0 | |
* Author: WPCouple | |
* Author URI: https://WPCouple.com | |
* Contributors: WPCouple, mrasharirfan | |
* License: GPL-2.0+ |
This file contains hidden or 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 | |
/** | |
* Add Site Title. | |
* | |
* Add site title to every post title. | |
* | |
* @param string $title - Title of the post. | |
*/ | |
function wpc_add_sitename_to_title( $title ) { | |
// Get the site title. |
This file contains hidden or 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 | |
/** | |
* Hello World. | |
* | |
* Display Hello World in WP Admin. | |
* | |
* @since 1.0.0 | |
*/ | |
function wpc_hello_world() { | |
echo '<p>Hello World</p>'; |
This file contains hidden or 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 | |
/** | |
* Plugin Name: Hello World | |
* Plugin URI: https://WPCouple.com | |
* Description: A basic WordPress Plugin. | |
* Version: 1.0.0 | |
* Author: WPCouple | |
* Author URI: https://WPCouple.com | |
* Contributors: WPCouple | |
* License: GPL-2.0+ |
This file contains hidden or 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
require('babel-register') | |
const webpack = require('webpack') | |
const path = require('path') | |
const I18nPlugin = require("i18n-webpack-plugin") | |
const merge = require('webpack-merge') | |
const validate = require('webpack-validator') | |
const pkg = require('./package.json') | |
const toHtml = require('vdom-to-html') | |
const app = require('./app/views/app').default | |
const parts = require('./webpack.config.parts') |
This file contains hidden or 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 | |
/** | |
* Plugin Name: My Plugin | |
* Plugin URI: https://my-plugin.com | |
* Description: A basic WordPress Plugin. | |
* Version: 1.0.0 | |
* Author: Ashar Irfan | |
* Author URI: https://asharirfan.com | |
* Contributors: mrasharirfan | |
* License: GPL-2.0+ |
This file contains hidden or 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_filter( 'post_type_link', 'my_post_type_link', 10, 3); | |
function my_post_type_link($permalink, $post, $leavename) { | |
if ($post->post_type == 'my-post-type') { | |
$meta = get_post_meta($post->ID, '_my-post-meta', true); | |
if (isset($meta) && !empty($meta)) | |
$permalink = home_url( "my-friendly-url/" . $meta . "/" . $post->post_name . "/"); | |
} | |
return $permalink; |