Sunday, February 26, 2017

Change Thumbnail Position in WordPress

// Changing featured image placement in custom post type

add_action('do_meta_boxes', 'customposttype_image_box');

function customposttype_image_box() {



 remove_meta_box( 'postimagediv', 'customposttype', 'side' );



 add_meta_box('postimagediv', __('Custom Image'), 'post_thumbnail_meta_box', 'partner', 'normal', 'high');



}

Tuesday, February 7, 2017

How to Make Parent Menu Clickable in Bootstrap Navwalker Menu

For me it worked this way: I assume you make usage of the wp-bootstrap-navwalker
Open up the wp-bootstrap-navwalker.php with your editor and look up for line approx. 83
// If item has_children add atts to a.
if ( $args->has_children && $depth === 0 ) {
   $atts['href']        = '#';
   $atts['data-toggle'] = 'dropdown';
   $atts['class']           = 'dropdown-toggle';
} else {
   $atts['href'] = ! empty( $item->url ) ? $item->url : '';
}
Change this piece of code to:
// If item has_children add atts to a.
if ( $args->has_children && $depth === 0 ) {
   $atts['href'] = ! empty( $item->url ) ? $item->url : '';
   //$atts['data-toggle']   = 'dropdown';
   $atts['class']           = 'dropdown-toggle';
} else {
   $atts['href'] = ! empty( $item->url ) ? $item->url : '';
}
Note: $att['href'] is enabled now, the the $atts['data-toggle'] is disabled which makes the parent link clickable.
Now open up your style.css and add this piece of code to activate the hover function for your WordPress menu with dropdown and clickable parent.
.dropdown:hover .dropdown-menu {
    display: block;
}
Note: The behaviour of the menu will change slightly on small devices with small screens. No additional jQuery required.

Monday, February 6, 2017

How To Check Server Directory Path

Create a server.php file and upload inside your root directory. Insert the below code and enter url on your website. yourwebsite.com/server.php

<?php
echo dirname(__FILE__);