Skip to content

Instantly share code, notes, and snippets.

View akshuvo's full-sized avatar

Akhtarujjaman Shuvo akshuvo

View GitHub Profile
@akshuvo
akshuvo / wp-change-one-page.php
Created July 1, 2018 18:58 — forked from bekarice/wp-change-one-page.php
Apply code or styles to a single page in WordPress
/**
* Change styles applied to one page
*
* Uses 'wp' to run after WP class object so page content is available
*/
function sv_hide_header_footer_for_page() {
if( is_page( 2576 ) ) {
?> <style>
header#header,
<?php
// Visual composer get terms on dropdown params
if( !function_exists('vcdd_get_terms') ){
function vcdd_get_terms( $taxonomy = 'category' ){
$get_categories = get_categories( array(
'taxonomy' => $taxonomy,
) );
foreach ( $get_categories as $category ) {
$categories[] = [ $category->term_id => $category->name ];
}
@akshuvo
akshuvo / readme.md
Created June 2, 2018 06:09 — forked from hitautodestruct/readme.md
Generate a custom structure for Wordpress menus.

This gist is for showing an example of a custom wordpress menu.

If you want to get more from the menu item simply have a look at the $item object. i.e:

// Will return a large object with lots of props like title, url, description, id etc.
var_dump( $item );

This code works on Wordpress 4.1.1 as of 31st of March 2015

@akshuvo
akshuvo / custom-post-taxonomy-permalinks.php
Created May 8, 2018 07:30 — forked from kasparsd/custom-post-taxonomy-permalinks.php
Create permalink structure URLs for custom post types that include all parent terms from a custom taxonomy
<?php
/*
Term Archive Pages:
- http://example.com/recipes/dinner/
- http://example.com/recipes/breakfast,brunch/
Single Recipe Pages:
- http://example.com/recipes/dinner/soup-title/
/**
* WP_Customize_Manager->add_setting(); // adds a new setting to the database
* WP_Customize_Manager->add_section(); // adds a new section (i.e. category/group) to the Theme Customizer page
* WP_Customize_Manager->add_control(); // creates an HTML control that admins can use to change settings.
* WP_Customize_Manager->get_setting(); // can be used to fetch any existing setting, in the event you need to modify something
*/
add_action( 'customize_register', 'my_customize_register' );
function my_customize_register( $wp_customize ) {
@akshuvo
akshuvo / WordPress Repeater MetaBox.php
Last active December 17, 2024 16:37
Creating a “repeater meta-box” without a Plugin in WordPress
<?php
add_action('admin_init', 'gpm_add_meta_boxes', 2);
function gpm_add_meta_boxes() {
add_meta_box( 'gpminvoice-group', 'Custom Repeatable', 'Repeatable_meta_box_display', 'page', 'normal', 'default');
}
function Repeatable_meta_box_display() {
global $post;
$gpminvoice_group = get_post_meta($post->ID, 'customdata_group', true);