Skip to content

Instantly share code, notes, and snippets.

View wpmark's full-sized avatar

Mark Wilkinson wpmark

View GitHub Profile
@wpmark
wpmark / gist:1e57902ba32a0f115db7
Created December 6, 2014 11:06
Adding Fields to a WP Front End Profile Tab
<?php
function wpmark_add_profile_field( $fields ) {
$fields[] = array(
'id' => 'test_meta',
'label' => 'Test Meta',
'desc' => 'Describe your field here.',
'type' => 'select',
'options' => array(
array( 'value' => 'value1', 'name' => 'Name 1' ),
@wpmark
wpmark / gist:7e38e5114ecc153f400b
Created December 6, 2014 11:00
Adding Your Own WP Front End Profile Tabs
<?php
function wpmark_add_tab( $tabs ) {
/* add our tab to the tabs array */
$tabs[] = array(
'id' => 'wpmark_tab',
'label' => 'Testing',
'tab_class' => 'testing-tab',
'content_class' => 'testing-content',
);
@wpmark
wpmark / gist:8fb38d36484ec1e34dbc
Created December 6, 2014 10:55
Output WP Front End Profile
<?php wpfep_show_profile(); ?>
@wpmark
wpmark / gist:aa92cc2ee556f7d7c9f0
Created December 1, 2014 18:38
Display Custom WP Post Type Meta Fields
<?php
/* assuming your post type was named cpt_content */
$option = get_option( ‘wpptm_meta’ );
$option = $option[ ‘cpt_content_selectbox’ ];
echo $option;
@wpmark
wpmark / gist:2dbb0d59c898acd4adda
Created December 1, 2014 18:37
Display WP Post Type Meta Fields
<?php
$description = get_option( ‘wpptm_meta’ );
$description = $description[ ‘post_type_name_description’ ];
echo wpautop( $description );
@wpmark
wpmark / gist:8d96847316d5f46a6174
Created December 1, 2014 18:36
Add Additional Fields to WP Post Type Meta
<?php
function wpptm_add_select_input( $settings ) {
/* add our setting to the settings array */
$settings[] = array(
'type'=> 'select',
'label'=> 'A Select Box',
'id'=> ‘selectbox’,
'options' = array(
array(
@wpmark
wpmark / wp-admin-menu-hierarchy-correction.php
Created November 19, 2014 17:19
WordPress Admin Menu Hierarchy Correction
<?php
function wpmark_menu_hierarchy_correction( $parent_file ) {
global $current_screen;
/* get the base of the current screen */
$screenbase = $current_screen->base;
/* if this is the edit.php base */
if( $screenbase == 'edit' ) {
@wpmark
wpmark / wp-add-posts-as-submenu.php
Created November 19, 2014 17:13
WordPress Add Posts Menu as a Sub Menu
<?php
function wpmark_add_posts_as_submenu() {
/* add the sub menu under content for posts */
add_submenu_page(
'wpmark_admin_menu', // parent slug
'Posts', // page_title,
'Posts', // menu_title,
'edit_posts', // capability,
'edit.php' // menu_slug,
@wpmark
wpmark / wp-remove-toplevel-admin-menu.php
Created November 19, 2014 17:08
WordPress Remove Top Level Admin Menu
<?php
function wpmark_remove_posts_menu_item() {
/* remove the sub menu item */
remove_menu_page(
'edit.php', // parent slug
);
}
@wpmark
wpmark / wp-add-submenu.php
Created November 19, 2014 16:58
Add WordPress Sub Menu
<?php
function wpmark_add_submenu_item() {
/* add the sub menu under content for posts */
add_submenu_page(
'tools.php', // parent slug
'My Sub Menu', // page_title,
'My Sub Menu', // menu_title,
'manage_options', // capability,
'wpmark_submenu_content' // menu_slug,