how to remove wordpress documentation menu link in dashboard - wordpress

I want to customize my dashboard by removing WordPress icon and it's menu on the top bar but I have no idea of how it works because am not an expert in WordPress please help me

Create a new file in the WordPress wp-content/plugins/ folder named admin-bar.php then add the following plugin header:
<?php
/*
Plugin Name: Admin Bar
Plugin URI: http://www.sitepoint.com/
Description: Modifies the WordPress admin bar
Version: 1.0
Author: Craig Buckler
Author URI: http://twitter.com/craigbuckler
License: MIT
*/
You can now activate this plugin in the WordPress administration panel. It won’t do anything yet but you can make additions, save then refresh to view the updates.
you can remove existing items with the remove_node() method. For this, we need to create a new function named update_adminbar() which is passed an WP_Admin_Bar object ($wp_adminbar). This function is called when the admin_bar_menu action hook is activated:
// update toolbar
function update_adminbar($wp_adminbar) {
// remove unnecessary items
$wp_adminbar->remove_node('wp-logo');
$wp_adminbar->remove_node('customize');
$wp_adminbar->remove_node('comments');
}
// admin_bar_menu hook
add_action('admin_bar_menu', 'update_adminbar', 999);
https://www.sitepoint.com/customize-wordpress-toolbar/

You can create a custom plugin and upload folder to your server with this one file in it. Make sure to save the file as exact plugin name. For example, "AdminBar.php"
<?php
/*
Plugin Name: AdminBar
Plugin URI:
Description: Code to hide the admin bar for non-admins only.
Version: 1.0
Author: Name Here
Author URI:
*/
function hide_admin_bar_settings()
{
?>
<style type="text/css">
.show-admin-bar {
display: none;
}
</style>
<?php
}
function disable_admin_bar()
{
if(!current_user_can('administrator'))
{
add_filter( 'show_admin_bar', '__return_false' );
add_action( 'admin_print_scripts-profile.php', 'hide_admin_bar_settings' );
}
}
add_action('init', 'disable_admin_bar', 9);

Related

Updating failed after adding shortcode

I have created a new plugin for youtube video slider. I have used below code for plugin creation. After activating this plugin, post and page update is not working. I am getting the error is "Updating failed"
I have used shortcode like this [az_youtube_slider] in my post.
Can you please anyone help me to fix the error.
Thanks in advance.
<?php
/*
Plugin Name: Assistanz youtube slider
Plugin URI: https://www.assistanz.com/
Description: Get videos from youtube assistanz channel and slider
Version: 1.0
Author: Safia
Author URI: https://assistanz.com/
License: GPLv2 or later
Text Domain: assistanz
*/
if(!defined('ABSPATH')) exit;
function az_youtube_slider($atts, $content = null) {
return "<p>Youtube video will come here</p>";
}
add_shortcode("az_youtube_slider", "az_youtube_slider");
?>
Use 'Classic Editor' plugin to fix your issue also your function will not work, please update your function with below.
function displayDate($atts, $content = null) {
return "<p>Youtube video will come here</p>";
}
add_shortcode("az_youtube_slider", "displayDate");

Removing a Wordpress Action from theme via plugin

Im adding a copyright link in footer of a theme using the
function copy() {
echo '<div class="copyright">Text</div>';
}
add_action('wp_footer', 'copy');
and trying to remove it writing a simple plugin like this one:
<?php
/*
Plugin Name: Link Remover
Plugin URI: http://domain/
Version: 1.0
Author: authorname
Description: Plugin description
*/
remove_action('wp_footer', 'copy');
?>
but it doesnt remove in this way is there any other method to do this?
thanks...
Try this:
function remove_copyright()
{
remove_action('wp_footer', 'copy');
}
add_action('init','remove_copyright', 15);

Addon to the FormCraft plugin doesn't work (Wordpress)

I'm trying to create an addon for the FormCraft Wordpress plugin and I'm having some trouble with it.
I've edited a demo addon based on the FormCraft documentation, added it to my Wordpress as a plugin. But it doesn't seem to work.
I tried just copy-pasting the demo addon from http://formcraft-wp.com/help/developing-an-add-on-for-formcraft/. But it also didn't work.
Here's the code:
<?php
/*
Plugin Name: FormCraft Demo Add-On
Plugin URI: http://ncrafts.net/
Description: Demo Add-on for FormCraft
Author: nCrafts
Author URI: http://ncrafts.net
Version: 1
Text Domain: formcraft-demo
*/
// Tell FormCraft our add-on exists
add_action('formcraft_addon_init', 'formcraft_demo_addon');
function formcraft_demo_addon()
{
register_formcraft_addon( 'demo_addon_settings', 0, 'Demo Addon', 'DemoController');
}
// We show a simple text field in the add-on's settings
function demo_addon_settings() {
echo "<input style='margin: 20px 10%; width: 80%' placeholder='Banned hosts' type='text' ng-model='Addons.DemoAddon.banned_hosts'>";
}
add_action('formcraft_after_save', 'your_function', 10, 4);
function your_function($content, $meta, $raw_content, $integrations)
{
file_get_contents('https://my-app.com/send_request?formcraft=true');
}
?>
Nothing is showing up in the settings and based on my server logs nothing is being sent in the formcraft_after_save action.
What am I missing?
author of FormCraft here.
Firstly, please make sure you are using FormCraft version 3.2.6 or above. Is the Demo Addon showing up when you edit any form, and go to Add-Ons -> Installed?
You can reach me directly at nish at ncrafts dot net as well.

Wordpress shortcode is not called

Okay, I have created a plugin and now want to provide shortcode to app.
Here is my only file in wp-content/plugins/my-plugin/my-plugin.php
<?php
/**
* Plugin Name: Latest Issue
* Author: Max Tsepkov
* Author URI: http://www.yogi.pw
*/
add_action('init', function() {
add_shortcode('my-plugin', function() {
// ... my code
return 'string';
});
});
I know that plugin is activated and the callback for init is called.
But the shortcode function is never get called.
I add text [my-plugin] to a widget, and it isn't replaced as well.
What do I do wrong? How to correctly register a shortcode?
I guess you PHP is at least 5.3, so you can make it work in a widget, you need to add this code.
add_filter('widget_text', 'do_shortcode');
I tested your code and it works.
Turned out, that some themes are not parsing shortcodes in widgets.
We can explicitly hook into theme filter and let it run shortcodes in widgets.
For details see https://wordpress.org/support/topic/how-to-make-shortcodes-work-in-a-widget
And there is no need for hook into init action. This code works:
<?php
/**
* Plugin Name: Latest Issue
* Author: Max Tsepkov
* Author URI: http://www.yogi.pw
*/
// Allow theme to parse shortcodes in widgets
add_filter('widget_text', 'do_shortcode');
add_shortcode('my-plugin', function() {
// ... my code
return 'string';
});

wordpress custom page not in admin

I am trying to create a page test.php that can use wordpress functions but is not part of the admin/pages section. so basically if I have a link on my single.php or page.php to direct me to test.php not show the 404 but actually show me the contents of test.php. I've heard that i might have to make some changes to the htaccess but I'm not sure how to search for this issue so any help is greatly appreciated.
You can use include('../wp-load.php'); in the top of your php file to get wordpress functionality in to your file then place your file in the root wordpress installation and then you can call your file with your url http://yourdomain.net/test.php
The information for creating page templates, plugins and using functions.php can all be found on the WordPress site.
How to call wordpress functions in custom php script
if ( is_admin() ) {
add_action( 'admin_menu', array( 'adminAddPage' ) );
}
/**
* Callback to add page
*/
public function adminAddPage() {
add_options_page( 'Custom page title', 'Custom page title', 'manage_options', 'custom_page_slug', array('adminPage') );
}
/**
* Page HTML Callback
*/
public function adminPage() {
// your html code
}

Resources