February 22, 2017
January 17, 2017
Wordpress admin - How add custom column in post listing table?
- If you want to add custom column in wordpress admin all post listting, then you just need to add some function on functions.php file.
- Here I try to explain with one example like if you want to add Post ID on admin post listing page.
- Example:
File: wp-content/yourtheme/functions.php
//BELOW FUNCTION FOR DISPLAY HEADER TITLE
add_filter('manage_posts_columns', 'columns_header');
function columns_header('$default') {
$default['post_id'] = 'Post ID';
return $default;
}
//BELOW FUNCTION FOR DISPLAY VALUE ON THAT COLUMN
add_action('manage_posts_custom_column', 'columns_content', 10, 2);
function columns_content($column_name, $post_id) {
if($column_name == 'post_id') {
echo $post_id;
}
}
Enjoy!
January 7, 2017
December 16, 2016
Wordpress temporary session to save any message?
If you need to save any error OR success message on wordpress function.php file OR any other file then please follow below steps:
Here I explain with one success message save on function file and display on home page:
function.php
<?php
function myTempFun() {
if(!session_id()) {
session_start();
}
$_SESSION['my_session_name'] = 'Write here any message';
}
?>
home page template.php
if ( array_key_exists( 'my_session_name', $_SESSION ) ) {?>
<p><?php echo $_SESSION['my_session_name']; ?></p>
<?php
unset( $_SESSION['my_session_name'] );
}
After session display also unset that , So when you refresh page then second time that session not displaying.
Enjoy!
Subscribe to:
Posts (Atom)
The Future of Technology: Emerging Trends to Watch in 2025
Introduction As we navigate through 2025, the technological landscape continues to evolve at an unprecedented pace. Innovations that once se...
-
Put this code between <head>...</head> tag. <script type="text/javascript"> function readURL(input) { ...
-
Yes, normally datatable Ajax file call outside of AngularJs folder structure, If you define ng-click there then it’s not working in An...
-
Using PHP to upload files into MySQL database sometimes needed by some web application. For instance for storing pdf documents or images to ...


