Recent Articles
Home » Posts filed under PLUGINS
Showing posts with label PLUGINS. Show all posts
Showing posts with label PLUGINS. Show all posts
Thursday, September 26, 2013
Thursday, September 26, 2013
- 0 Comments
Hiii, we all know that wordpress installation is very easy on any platform but installing plugins, widgets and themes other than as provided with the wordpress causes some problem on platforms other than windows i.e. on Linux or Mac. It asks you to enter FTP details like Hostname, FTP username , FTP password and connection type to provide with your installation. The error screen looks like :
So, in this post I will be telling how to solve this error in Linux platform. It has been tested by me on the Ubuntu version of Linux.
How to solve this error:
It is very easy to solve this error and to solve it , just follow the simple steps :
1. Just go to the directory in which you have installed or placed your wordpress folder.
2. Then in that folder just open the file "wp-config.php".
3. In that "wp-config" file just write the lines any where in the file as given below :
define( 'FS_METHOD', 'direct' );
define( 'FS_CHMOD_DIR', 0777 );
define( 'FS_CHMOD_FILE', 0777 );
4. Then save that file and now again try to install anything like plugin,widget or new theme in your wordpress and now error will be gone.
1. Just go to the directory in which you have installed or placed your wordpress folder.
2. Then in that folder just open the file "wp-config.php".
3. In that "wp-config" file just write the lines any where in the file as given below :
define( 'FS_METHOD', 'direct' );
define( 'FS_CHMOD_DIR', 0777 );
define( 'FS_CHMOD_FILE', 0777 );
4. Then save that file and now again try to install anything like plugin,widget or new theme in your wordpress and now error will be gone.
Hope you like this post……..Please Comment…………!!!!!!!!!
Originally posted at Mycodestock.
Monday, September 16, 2013
Monday, September 16, 2013
- 0 Comments
Hiiii, if you are developing a wordpress plugin then you might
encounter a problem of how to show your custom data in wordpress admin
listing.
Here is the code to show a listing of any wordpress table in WP admin section with a delete facility by making a plugin .
Two fIles are used to implement these functionality :
- Plugin-name.php : This file is the main plugin file whose name is same as the name of your plugin.
- Listing.php : In this file the records of the table are fetch from the database, which you want to display in your admin section.
Below is the code in both of the files mentioned above :
Plugin-name.php :
<?php
/*
Plugin Name: Plugin-name
Description: Your Description
*/
?>
<link rel=”stylesheet” href=”<?php echo $plugins_url;?>/nhscomment/css/jquery-ui.css” />
<script src=”<?php echo $plugins_url;?>/nhscomment/js/jquery-1.9.1.min.js” type=”text/javascript”></script>
<script src=”<?php echo $plugins_url;?>/nhscomment/js/jquery-ui-1.10.2.custom.js” type=”text/javascript”></script>
/*
Plugin Name: Plugin-name
Description: Your Description
*/
?>
<link rel=”stylesheet” href=”<?php echo $plugins_url;?>/nhscomment/css/jquery-ui.css” />
<script src=”<?php echo $plugins_url;?>/nhscomment/js/jquery-1.9.1.min.js” type=”text/javascript”></script>
<script src=”<?php echo $plugins_url;?>/nhscomment/js/jquery-ui-1.10.2.custom.js” type=”text/javascript”></script>
<?php
global $wpdb;
add_action(‘admin_menu’, ‘menu_page’);
function menu_page() {
$page_title = ‘Title of page’;
$menu_title = ’tiltle that shows in menu’;
$capability = ‘manage_options’;
$menu_slug = ‘seo friendly url’;
$function = ‘table_listings’; //function to call
add_menu_page($page_title, $menu_title, $capability, $menu_slug, $function);
}
$page_title = ‘Title of page’;
$menu_title = ’tiltle that shows in menu’;
$capability = ‘manage_options’;
$menu_slug = ‘seo friendly url’;
$function = ‘table_listings’; //function to call
add_menu_page($page_title, $menu_title, $capability, $menu_slug, $function);
}
function table_listings() {
global $wpdb;
require_once(dirname(__FILE__).’/includes/listing.php’);
}
global $wpdb;
require_once(dirname(__FILE__).’/includes/listing.php’);
}
add_filter( ‘wp_nav_menu_items’, ‘menu_item’, 10, 2 );
function menu_item ( $items, $args ) {
if (is_single() && $args->theme_location == ‘primary’) {
$items .= ‘<li>Show whatever</li>’;
}
return $items;
}
function menu_item ( $items, $args ) {
if (is_single() && $args->theme_location == ‘primary’) {
$items .= ‘<li>Show whatever</li>’;
}
return $items;
}
if($_GET['comment_id'])
{
$record_id=$_GET['record_id'];
$delete_sql=”delete from “.$wpdb->prefix.”table_name where id=’”.$record_id.”‘”;
$wpdb->query( $delete_sql );
}
?>
{
$record_id=$_GET['record_id'];
$delete_sql=”delete from “.$wpdb->prefix.”table_name where id=’”.$record_id.”‘”;
$wpdb->query( $delete_sql );
}
?>
Listing.php :
This section i have developed for comment section :
<script>
$(function() {
$( “.comment” ).tooltip();
});
</script>
<div id=”admin_wpfes”>
<h3>Comment Lists</h3>
<?php
$pagenum = isset( $_GET['pagenum'] ) ? absint( $_GET['pagenum'] ) : 1;
$limit = 10;
$offset = ( $pagenum – 1 ) * $limit;
$total = $wpdb->get_var( “SELECT COUNT(`id`) FROM “.$wpdb->prefix.”table_name” );
$num_of_pages = ceil( $total / $limit );
$page_links = paginate_links( array(
‘base’ => add_query_arg( ‘pagenum’, ‘%#%’ ),
‘format’ => ”,
‘prev_text’ => __( ‘«’, ‘aag’ ),
‘next_text’ => __( ‘»’, ‘aag’ ),
‘total’ => $num_of_pages,
‘current’ => $pagenum
) );
$(function() {
$( “.comment” ).tooltip();
});
</script>
<div id=”admin_wpfes”>
<h3>Comment Lists</h3>
<?php
$pagenum = isset( $_GET['pagenum'] ) ? absint( $_GET['pagenum'] ) : 1;
$limit = 10;
$offset = ( $pagenum – 1 ) * $limit;
$total = $wpdb->get_var( “SELECT COUNT(`id`) FROM “.$wpdb->prefix.”table_name” );
$num_of_pages = ceil( $total / $limit );
$page_links = paginate_links( array(
‘base’ => add_query_arg( ‘pagenum’, ‘%#%’ ),
‘format’ => ”,
‘prev_text’ => __( ‘«’, ‘aag’ ),
‘next_text’ => __( ‘»’, ‘aag’ ),
‘total’ => $num_of_pages,
‘current’ => $pagenum
) );
if ( $page_links ) {
echo ‘<div><div style=”margin: 1em 0″>’ . $page_links . ‘</div></div>’;
}
echo ‘<div><div style=”margin: 1em 0″>’ . $page_links . ‘</div></div>’;
}
echo ‘</div>’;
if ($comments = $wpdb->get_results(“SELECT * FROM “.$wpdb->prefix.”table_name ORDER BY id DESC LIMIT “.$offset.”,”.$limit)) {
$comment_no=0;
$url=”http://”.$_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'];
?>
<table>
<thead>
if ($comments = $wpdb->get_results(“SELECT * FROM “.$wpdb->prefix.”table_name ORDER BY id DESC LIMIT “.$offset.”,”.$limit)) {
$comment_no=0;
$url=”http://”.$_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'];
?>
<table>
<thead>
<tr>
<th> Table Headers</th>
</tr>
</thead>
<tbody>
<?php
$url = $url . ‘&record_id=’;
foreach ($comments as $comment) {
if ($comment_no&1) {
echo “<tr class=\”alternate\”>”;
} else {
echo “<tr>”;
}
$comment_no=$comment_no+1;
</tr>
</thead>
<tbody>
<?php
$url = $url . ‘&record_id=’;
foreach ($comments as $comment) {
if ($comment_no&1) {
echo “<tr class=\”alternate\”>”;
} else {
echo “<tr>”;
}
$comment_no=$comment_no+1;
echo “<td>$comment->username</td>”;
echo “<td>$comment->email</td>”;
echo “<td class=’comment’ style=’cursor:pointer;’ title=’”.$comment->comment.”‘>”;
echo substr($comment->comment,0,50).”…”;
//echo “<span class=’comment’ style=’display:none;’>$comment->comment</span>”;
echo “<td>$comment->email</td>”;
echo “<td class=’comment’ style=’cursor:pointer;’ title=’”.$comment->comment.”‘>”;
echo substr($comment->comment,0,50).”…”;
//echo “<span class=’comment’ style=’display:none;’>$comment->comment</span>”;
echo “</td>”;
echo “<td>$comment->star</td>”;
echo “<td>$comment->date_from</td>”;
echo “<td>$comment->date_to</td>”;
echo “<td>$comment->added_on</td>”;
echo “<td><a href=\”$url$comment->id\” onclick=\”if(confirm(‘Are you sure you want to delete user with ID $comment->id?’)) return; else return false;\”>Delete</a></td>”;
echo “</tr>”;
}
echo “<td>$comment->star</td>”;
echo “<td>$comment->date_from</td>”;
echo “<td>$comment->date_to</td>”;
echo “<td>$comment->added_on</td>”;
echo “<td><a href=\”$url$comment->id\” onclick=\”if(confirm(‘Are you sure you want to delete user with ID $comment->id?’)) return; else return false;\”>Delete</a></td>”;
echo “</tr>”;
}
?>
</tbody>
</table>
<?php
}
?>
</div>
<?php
}
?>
</div>
Hope you like this post……..Please Comment....!!!!!!
Originally posted at Mycodestock.
Subscribe to:
Posts (Atom)

