Add custom field under settings general tab in WordPress

WordPress add custom field under settings general tab

As we all know WordPress is very popular and easy to create an application and website in WordPress. Once we need to add custom field example footer social links or content, simply add wp hooks example below (this code snippet will create social links textbox and textarea). As per our Australian client requirement, we add custom fields in WordPress opensource. For WP page speed or security we recommend adding customized code, not plugins.

//general settings could add in function.php or your plugin file
add_action('admin_init', 'my_general_section');

function my_general_section() {
add_settings_section(
'my_settings_section', // Section ID
'Footer Setting', // Section Title
'my_section_options_callback', // Callback function
'general' // Show up on the General Settings Page
);

add_settings_field( 'fcontent', 'Content', 'my_textarea_callback', 'general', 'my_settings_section', array('fcontent' ) );

add_settings_field( 'fbook', 'Facebook', 'my_textbox_callback', 'general', 'my_settings_section', array('fbook' ) );
add_settings_field( 'instagram', 'Instagram', 'my_textbox_callback', 'general', 'my_settings_section', array('instagram' ) );
add_settings_field( 'tlink', 'Twitter', 'my_textbox_callback', 'general', 'my_settings_section', array('tlink' ) );
add_settings_field( 'linkedin', 'LinkedIn', 'my_textbox_callback', 'general', 'my_settings_section', array('linkedin' ) );
add_settings_field( 'youtube', 'Youtube', 'my_textbox_callback', 'general', 'my_settings_section', array('youtube' ) );

register_setting('general','fcontent', 'esc_attr');
register_setting('general','fbook', 'esc_attr');
register_setting('general','instagram', 'esc_attr');
register_setting('general','tlink', 'esc_attr');
register_setting('general','linkedin', 'esc_attr');
register_setting('general','youtube', 'esc_attr');
}

function my_section_options_callback() { // Section Callback
echo '<p>Footer Setting</p>';
}

function my_textbox_callback($args) { // Textbox Callback
$option = get_option($args[0]);
echo '<input type="text" id="'. $args[0] .'" name="'. $args[0] .'" value="' .      $option . '" />';
}

function my_textarea_callback($args) { // Textarea Callback
$option = get_option($args[0]);
echo '<textarea id="'. $args[0] .'" name="'. $args[0] .'">' . $option . '</textarea>';
}

//Get custom field value, anywhere in frontend code.

get_option('fbook');

Connection to storage server failed

vestacp
Roundcube ‘connection to storage server failed’ error in ubuntu first-time vestacp installation
vi /etc/exim4/exim4.conf.template
#CLAMD = yes
vi /etc/clamav/clamd.conf
# AllowSupplementaryGroups yes
vi /etc/dovecot/dovecot.conf
protocols = imap pop3
listen = *
base_dir = /var/run/dovecot/
!include conf.d/*.conf
namespace inbox {
inbox = yes
}
service dovecot restart
change database configurations
vi /etc/roundcube/debian-db.php

 

Install MongoDB, Redis, ExpressJS


How to install Mongo DB
brew update
brew install mongodb

Installing and running MongoDB on Mac OSX for beginners!

Install Redis:
brew install redis

Start Redis server:
Redis-server

Get Redis info:
brew info redis

npm install mongojs –save (to install mongojs for connection with mongoDB with nodejs)
https://github.com/mafintosh/mongojs

nmp init
npm install express –save ( to install express nodejs framework)

Install expressjs framework and run express hello world test application (https://expressjs.com/en/starter/generator.html)

Set environment vairable:
export MONGO_HOST=mongodb://localhost/db

Start nodejs server:
Npm start

On terminal run command mongod to start mongo:

Mongojs module for mongo connection with nodejs
https://github.com/mafintosh/mongojs

For backup or dump mongoDB
mongodump –db databasename (this command will run in terminal)

For import mongoDB go to backup folder and run command in terminal
mongorestore

Basic mongoDB commands or we can use mongoDB Compass for UI: (https://www.mongodb.com/download-center/compass)

1. Create new mongoDB:
Use testdb

2. Create table in mongoDB:
db.createCollection(‘user’)

3. Show table list in mongoDB:
show collections

4. Insert into mongoDB user collection(table):
db.user.insert([{name:’Sam’, email:’info@talkforweb.com.au’},{name:’Jhon’,email:’jhon@talkforweb.com.au’}])

5. Select all rows from user collection (table):
db.user.find()

Auto Append Prepend file in all files

IF we want to include header, footer or any boot file in all files inside our project. We can achieve this using PHP files, .htaccess or php.ini file

1. We need to write in each file of with PHP extension
2. In .htaccess or php.ini file we need to write only once and it will appears in all files automatic.

In PHP file

In php.ini file
# Prepend the file need to specify a relative path
auto_prepend_file = “/public_html/talkforweb/boot.php”

# Append file to bottom of page
auto_append_file = “/public_html/talkforweb/boot.php”

In .htaccess file
# Prepend the file need to specify a relative path
php_value auto_prepend_file “/public_html/talkforweb/boot.php”

# Append file to bottom of page
php_value auto_append_file “/public_html/talkforweb/boot.php”

By searching in detail list we can find php.ini file path but
Some hosting provide not provide access to edit php.ini file in this case we can create new file inside your root folder with name ‘php.ini’ and add above code.

Develop application with Nginx Server

NGINX SERVER

Talkforweb works on nginx web server so as to provide a great ease to access the website. The main application of a web server is to accept and fulfill the requirements of the client for static content from a website. Application server’s main task is to provide the client with access to business logic that generates dynamic content which transforms data to provide the specialized functionality offered by a business, application or service.

Develop application with Nginx Server

KEY POINTS

  •  A website that provides both static and dynamically generated content runs web servers for the static content and application servers to generate content dynamically.
  • A reverse proxy and load balancer sit in front of one or more web servers and one or more web application servers to route traffic to the appropriate server, first based on the type of content requested and then based on the configured load-balancing algorithm.
  • Most load balancer programs are also reverse proxy servers, which simplifies web application server architecture.
  • NGINX are the best-in-class web server solutions used by high-traffic websites.
  • More than 400 million websites worldwide, including the majority of the busiest websites, rely on NGINX to deliver their content quickly, reliably, and securely.
  • It is an extremely efficient reverse proxy and load balancer when deployed in front of web and application servers.

 

Full package [Server maintenance, Backups, Site maintenance, Digital Marketing, Add products/feature ]

Server Setup with AWS (if required)

  • Setup AWS Server [https://aws.amazon.com/free/]
  • setup Ubuntu 16.X (operating system) + nginx server
  • PHP 7.X version (wordpress latest version)
  • Setup RDS database
  • Setup vesta control cpanel [backup, FTP, domain management]
  • nginx web server
  • php-fpm backend server
  • bind9 dns server
  • exim4 mail server
  • clamav-daemon email antivirus
  • spamassassin email antispam
  • cron job scheduler
  • For security:
  •  iptables firewall
  • fail2ban brute-force monitor

Site optimisation, maintenance, Add new product/feature in website

  • Update new version of (WP) PHP code
  • Clean up code (remove unnecessary code)
  • Add CDN for images ( flicker )
  • optimise CSS, HTML, JS, DB
  • Optimise and cache all pages
  • Improve site performance and speed.
  • Will remove unnecessary JS and CSS and WP functions for optimisation
  • server beverage, Enable gzip compression

Digital Marketing Strategy (Plan of Action)

On Page Optimization

  •  Website Analysis
  •  Competitor Analysis
  •  Goals Assessment
  •  Keywords Research
  •  Meta Tag and Description [Recommendations]
  •  Page Title Tag [Recommendations]
  •  check toxic link
  •  keywords in H1, H2, H3 in side page   
  •  image name should be on keywords
  •  no broken links
  •  XML Sitemaps creation and submission in Google Yahoo Bing
  •  Checking of Broken Links
  •  ALT Tag Optimization
  •  HTML Optimization and Modifications
  •  Anchor Text Optimization
  •  Robots.txt Modifications
  •  Meta Verification Code Installation
  •  Google Analytics
  •  Webmaster Installation

 

Off Page Optimization

  •   Directory Submissions
  •   Manual Submissions to handpicked database of directories with good alexa ranks and page ranks
  •   Submission to TOP Directories from relevant categories like Dmoz, yahoo Directory, Jayde etc.
  •   Submission of subpages to top Directories
  •   Press Release Submissions
  •   Press Release Publication and submit to top PR sites each PR like PRLog, SanePR, Prweb etc.
  •   Categorized perfectly and personalized service with all manual submission through experts.
  •   100% manual. No automated software will be used to perform submissions
  •   Detailed report on Press release submission
  •   Free Blog Setup
  •   Free Blog setup on platforms like WordPress, Blogspot, Tumblr.
  •   Blogpost Writing & Publication
  •   Article Submissions
  •   Articles Manually promoted to TOP Article sites Each article like ezine, goarticles, article dashboard etc.
  •   Our experts will register with each article directory, verify email and then submit article for you.
  •   Detailed report where your article has been published
  •   We do all the article submissions manually
  •   Classifieds ads
  •   Blog Comments
  •   Forum postings and Blog comments – High Traffic forum sites
  •   Creating the login id with main and relevant sites
  •   Making the posts in the relevant thread, blogs with your Website URL
  •   Maintaining the posts
  •   Social Bookmarkings
  •   Creating the login id with reputed sites like digg, delocious, StumbleUpon, Technorati.com
  •   Book marking the relevant, theme based sites
  •   Making the book mark popular in famous sites
  •   Digging & Maintaining the sites

 

SMO

  • share link on facebook, twitter, linkedIn, pintereste, stumble, tumbler
  • share link instragram, google plus, dig, digio
  • In starting paid likes on facebook
  • create banner on the bases of current event and post Ex: new year +4 days – 4 days

 

  • 2 Blogs Per Week

 

  • Collect 10 images and modify as per nature of business.
  • create video using above images with proper relevant title (upload on youtube)
  • Create PDF using about images with proper relevent title
  • Add one post, using video <iframe youtube, about text and links, featured image, title, seo keyword, meta keywords, <h1><h2><h3> bold, Italic, Blockquote, Ordered List
  • post this link on social media: pinterest, redit
  • answer on quora and post: https://www.quora.com
  • post on blog spot as per above point

Email campaign

Send effective newsletter to subscribed user.

Our strategy changes time to time we will update points to you according to this.