Skip to content

Instantly share code, notes, and snippets.

View Iulian33's full-sized avatar

Iulian Cirlig Iulian33

  • Personal Team
  • Chisinau
View GitHub Profile
@Iulian33
Iulian33 / wpml.php
Created January 26, 2018 11:35
WPML function that export dropdown on php template
<?php $args = array(
'display_flags' => 1,
'display_names_in_native_lang' => 0,
'display_names_in_current_lang' => 0
); ?>
<?php do_action('wpml_add_language_selector', $args); ?>
@Iulian33
Iulian33 / submenu-page.php
Created January 3, 2018 14:41
Add a submenu option page to an menu page from admin
add_action( 'admin_menu', 'atributes_register');
function atributes_register() {
add_submenu_page(
'edit.php?post_type=aanbod',
__( 'Atributes', 'best4u' ),
__( 'Atributes', 'best4u' ),
'manage_categories',
'atributes-options',
'atributes_callback'
@Iulian33
Iulian33 / admin_custom_style.php
Created December 19, 2017 14:53
This Hook insert an link with a custom css file for admin
function custom_admin_style() {
wp_enqueue_style( 'child-admin-style', get_stylesheet_directory_uri() . '/framework-customizations/theme/custom_admin_style.css' );
}
add_action( 'admin_head', 'custom_admin_style' );
@Iulian33
Iulian33 / related-posts.php
Created December 14, 2017 15:35
Related Posts : You can set first parameter your post type Second parameter the taxonomy that posts should be related third parameter is for setting number of posts by adding an number in this area
@Iulian33
Iulian33 / widget-area.php
Created November 30, 2017 13:38
Initialize an widget area in admin pannel Apiarince Widhets
// Custom Widget Inits
function custom_widgets() {
register_sidebar( array(
'name' => __( '404 Area', 'best4u' ),
'id' => 'widget-404',
'description' => '',
'before_widget' => '<aside id="%1$s" class="widget %2$s">',
'after_widget' => '</aside>',
'before_title' => '<div class="widget-title">',
'after_title' => '</div>',
@Iulian33
Iulian33 / remove-default-page-editor.php
Created November 30, 2017 10:42
Function that Removes Default editor from a Specific page by ID
// removes Home default editor in admin
function remove_pages_editor(){
if(get_the_ID() === 16) {
remove_post_type_support( 'page', 'editor' );
}
}
add_action( 'add_meta_boxes', 'remove_pages_editor' );
@Iulian33
Iulian33 / rename-default-posts-post-type.php
Created November 30, 2017 10:40
Function that renames Default Wordpress Post type "Posts"
// Renaming default post type posts in News
function revcon_change_post_label() {
global $menu;
global $submenu;
$menu[5][0] = 'News';
$submenu['edit.php'][5][0] = 'News';
$submenu['edit.php'][10][0] = 'Add News';
$submenu['edit.php'][16][0] = 'News Tags';
}