Posts

Showing posts from April, 2016

Create admin menu and submenu in wordpress plugin

add_action('admin_menu', 'car_menu');
function car_menu() {
    add_menu_page('Car rental fleets', 'Fleets', 'manage_options', 'limousine-fleet', 'all_fleets','dashicons-migrate','4' );
    add_submenu_page('limousine-fleet', 'Limousine Fleets', 'All Fleets', 'manage_options', 'limousine-fleet' );
    add_submenu_page('limousine-fleet', 'Add new fleet', 'Add new', 'manage_options', 'new-fleet','add_new_fleet' );
}
function all_fleets() {
  echo "Display all fleets here.";
}
function add_new_fleet()
{
    echo "Add new fleet";
}

Add css and js on header using custom plugin in wordpress

add_action( 'wp_enqueue_scripts', 'my_enqueued_assets' );
function my_enqueued_assets() {
    wp_enqueue_style( 'car_rental', plugins_url( '/css/car_rental.css' , __FILE__ ) );
    wp_enqueue_script( 'script-name', plugins_url('/js/car_rental.js' , __FILE__ ), array(), '1.0.0', true );
}

Xampp - cant access my project in lampp/htdocs in Ubuntu - Solved

Open terminal (ctrl+alt+t)In the linux terminal navigate to your lampp directory.cd /opt/lampp In the command line type:sudo chmod 777-R htdocs

add join in datatables using codeigniter

Sets join statement variables. If you want DataTables to include data from another table, you can define an a table along with its columns and foreign key relationship.
$this->datatables->join('states', 'cities.state_id = states.id', 'left');
$this->datatables->select('cities.id,cities.name,states.name as state_name')
->from('cities');

Syntax error, unrecognized expression: a[href*=#]:not([href=#]) : solved

your selector is not valid. # is a special char and needs to be escaped like 'a[href*=\\#]:not([href=\\#])'

Facebook Callback appends '#_=_' to Return URL

You need to add following script in head section
<script type="text/javascript">
    if (window.location.hash && window.location.hash == '#_=_') {
        window.location.hash = '';
    }
</script>
or
<script type="text/javascript">
    if (window.location.hash && window.location.hash == '#_=_') {
        if (window.history && history.pushState) {
            window.history.pushState("", document.title, window.location.pathname);
        } else {
            // Prevent scrolling by storing the page's current scroll offset
            var scroll = {
                top: document.body.scrollTop,
                left: document.body.scrollLeft
            };
            window.location.hash = '';
            // Restore the scroll offset, should be flicker free
            document.body.scrollTop = scroll.top;
            document.body.scrollLeft = scroll.left;
        }
    }
</script>
For more visit…