Donate

Sample code for a plugin to store functions in

Two days ago I wrote about how to use remove_actions in a plugin.

I was asked what the code for a plugin to store functions in look slike.

It is really simple to create a plugin. The WordPress codex provides us with all the information needed here.

In the example below, I kept the code from the above tutorial.

<?php
/**
 * Plugin Name: Functional Plugin
 * Plugin URI: https://christophherr.com
 * Description: Functions for functions.php
 * Version: 1.0
 * Author: Christoph Herr
 * Author URI: https://christophherr.com
 * License: GPL2
 */


// Function to remove the primary navigation from its original place 
add_action( 'get_header', 'ch_remove_nav');
function ch_remove_nav () {
remove_action( 'genesis_after_header', 'genesis_do_nav');
}

// Repositioning the primary navigation to a new place
add_action( 'genesis_before_header', 'genesis_do_nav');

I hope you find this useful.

Similar Posts

Leave a Reply

Your email address will not be published. Required fields are marked *