Quantcast
Channel: WordPress › Support » Forum: Hacks - Recent Topics
Viewing all 8245 articles
Browse latest View live

Websiteguy on "Settings page truble"

$
0
0

I am trying to make a plugin with a settings page, but when I upload it there was an error.

This is the HTML:

*

Plugin Name: Stops Core, Theme, and Plugin Updates

Version: 0.2

Plugin URI: http://wordpress.org/plugins/stops-core-theme-and-plugin-updates/
Author: <a href="http://profiles.wordpress.org/kidsguide"><a href="http://profiles.wordpress.org/kidsguide">Websiteguy</a></a>

Description: A Simple Wordpress Plugin That Deletes All Updating of Plugins, Themes, and Even The Wordpress Core.

Compatible with WordPress 3.6+.

*/

<?php
function msp_add_admin_menu() {
add_options_page(
'Stops Updates Page',
'Stops Updates',
'manage_options',
'msp-stops-updates-page',
'msp_display_settings_page'
);
if(isset($_POST['msp_save'])) {
add_action("admin_head-$page",'msp_save_settings_handler');
}
}
add_action('admin_menu','msp_add_admin_menu');

function edit_theme_settings() {
    if ( get_option('sold_text') == true ) { $display = 'checked'; }
    else { $display = ''; }
    update_option( 'sold_text', $display );
?>

<p>Check if you don't won't updates of it</p> 

<input type="checkbox" name='Plugin_Updates' id='Plugin' value="1" <?= checked( get_option('Plugin'), 1, false );?> />
<input type="checkbox" name='WordPress_Core_Updates' id='Core' value="1" <?= checked( get_option('Core'), 1, false );?> />
<input type="checkbox" name='Theme_Updates' id='Theme' value="1" <?= checked( get_option('Theme'), 1, false );?> />

cwizards on "Link formatting problem when concacting a variable"

$
0
0

I have been trying to build a list of items with an onClick event but the link keeps on formatting incorrectly! Can anyone advise how to correct this please.
$name=$myrows->display_name; ="Fred Marshall"
echo "<UL><li><a onclick=$('#searchUsers').val('$name');>$name</a></li></ul>";
I have also tried
echo "<UL><li><a onclick=$('#searchUsers').val('" . $name . "');>$name</a></li></ul>";
with the same result :-
<a marshall');="" onclick="$('#acf-field-owner').val('16837');$('#searchUsers').val('Fred">Fred Marshall</a>
note the words Fred and Marshall are not together in the val() function!

Steeven on "Add a coloumn in admin users panel"

$
0
0

Hi

How can I add a coloumn in the users table in the admin panel? The coloumn should show content of a specific proporty of the user.

The content that I am talking about, is the value of a field that I have made with the WP-Members plugin. So maybe that coloumn is not combined with the original wordpress-fields.

Also this value should be possible to quick-edit directly from the users table (it's a dropdown field), so you don't have to click on every user to edit their info individually.

How can I do this? Thanks.

danishsameer on "Need Fwd Text Button"

$
0
0

Hello Everyone

i need little help..i want to insert a button in every post automitcally when any user click that button the text of that post automatcally go to the text area of form which i m using in my site u can see button in sms4smile site

in the last of everypost there is a button named send/forward this sms to anyone in pakistan when you clcick that button the text automtically go to textbox please check n if anyone knows about that please tell me

thanks,

Regards,
Danish

com800 on "Faulty text wrap for block items in multi-sentence paragraphs."

$
0
0

Whenever any block item with a float-left style command (div, table, image with caption) is placed in mid-sentence in a multi-sentence post paragraph, what SHOULD happen is that all sentences of the paragraph wrap smoothly and contiguously around the entire paragraph.

But what DOES happen is that the system automatically places a
tag after the last word before the placed block. And then, at the end of that placed block adds a <p> tag immediately in front of the second segment of the insertion-point sentence, breaking the structure of the paragraph and leaving a space break.

How do I stop this from happening? I want to achieve smooth text wraps around block items inserted mid-sentence into a paragraph.

dubzzdigital on "Adding a Pinterest button with php code?"

$
0
0

Hi all,

I have the website Cottage Flair and I am wanting to add a Pinterest button next to the "Newsletter" one in the purple bar of the homepage. I have tried editing the php functions myself but can't for the life of me figure it out. If anyone could please help it would be much appreciated! Cheers!

This is what I am looking at:

/****************************************************************************************/

if ( ! function_exists( 'attitude_home_slogan' ) ) :
/**
* Display Home Slogan.
*
* Function that enable/disable the home slogan1 and home slogan2.
*/
function attitude_home_slogan() {
global $attitude_theme_options_settings;
$options = $attitude_theme_options_settings;

$attitude_home_slogan = '';
if( ( !$attitude_home_slogan = get_transient( 'attitude_home_slogan' ) ) && ( !empty( $options[ 'home_slogan1' ] ) || !empty( $options[ 'home_slogan2' ] ) ) ) {

if ( "0" == $options[ 'disable_slogan' ] ) {
$attitude_home_slogan .= '<section class="slogan-wrap clearfix"><div class="container"><div class="slogan">';
if ( !empty( $options[ 'home_slogan1' ] ) ) {
$attitude_home_slogan .= esc_html( $options[ 'home_slogan1' ] );
}
if ( !empty( $options[ 'home_slogan2' ] ) ) {
$attitude_home_slogan .= '<span>'.esc_html( $options[ 'home_slogan2' ] ).'</span>';
}
$attitude_home_slogan .= '</div><!-- .slogan -->';
if ( !empty( $options[ 'button_text' ] ) && !empty( $options[ 'redirect_button_link' ] ) ) {
$attitude_home_slogan .= ''.esc_html( $options[ 'button_text' ] ).'<!-- .view-work -->';
}
$attitude_home_slogan .= 'Newsletter<!-- .view-work -->';
$attitude_home_slogan .= '</div><!-- .container --></section> <!-- .slogan-wrap -->';
}

set_transient( 'attitude_home_slogan', $attitude_home_slogan, 86940 );
}
echo $attitude_home_slogan;
}
endif;

/****************************************************************************************/

GrumpyBum84 on "Simple Menu"

$
0
0

Hi All,

I have been working with PHP for some time now and thought I would give WordPress a shot, but I am getting lost on some basic functionality and I have been pulling my hair out trying to understand what I am doing so wrong.

All I am after is a simple menu item for settings and despite all my research I cannot do it :(
My code is as follows,

add_action('admin_menu', 'testPluginMenu');

function testPluginMenu() {
	add_options_page('Testing Plugin', 'Testing 3 Plugin', 'administrator', 'test-plugin', 'pluginAdminMenu');
}

function pluginAdminMenu() {
	echo '<h1>Test Plugin Admin Menu</h1>';
	echo '<p>This is a test</p>';
}

Code I copied off the WordPress Codex Site, http://codex.wordpress.org/Adding_Administration_Menus

/** Step 2 (from text above). */
add_action( 'admin_menu', 'my_plugin_menu' );

/** Step 1. */
function my_plugin_menu() {
	add_options_page( 'My Plugin Options', 'My Plugin', 'manage_options', 'my-unique-identifier', 'my_plugin_options' );
}

/** Step 3. */
function my_plugin_options() {
	if ( !current_user_can( 'manage_options' ) )  {
		wp_die( __( 'You do not have sufficient permissions to access this page.' ) );
	}
	echo '<div class="wrap">';
	echo '<p>Here is where the form would go if I actually had options.</p>';
	echo '</div>';
}

The problem is, the code from codex works and mine does not.
I am pulling my hair out trying to find out what makes then different but the more I go over these the more they look to be the same patteren and code set :(

Can anyone please point this out to me? Yes, I want you to point out my noob mistake as I am going crazy just trying to sort this basic function.

Thanks all

hisayama on "secret key"

$
0
0

Hi My name is Hiro.
My website is hacked!! Please some body help me...

I can not do login.
And I can see database, pass word and ID is normal but I couldn't enter the dashboad..

I tried secret key but I wrote down secret key at config but I dont know how to log in then...

Do somebody have good advice or any solutions?

King regard,


gerald@wpcustoms on "SQL: change post custom field to CPT post taxonomy"

$
0
0

Hello,

the setup is as follow:
I have regular posts with a custom field: actor = 'tom hanks'
for advanced management I now created a custom post type (actors) and added "tom hanks" as a post within that actors taxonomy.
Via plugin 'Advanced custom fields' I connected the custom taxonomy (actors) to the regular posts so I can select 'tom hanks' on the regular post page.

This can be done manually (check the custom field value and click the according actors category) but there are way more than 1500 posts and many other similar custom field values.

Do you have any idea how that can be solved via SQL query or function?

in one line:
get customfield 'actors' and move to taxonomy('actors') for that post.

If somebody can please help me out with the query for a mysql or similar you would definitely make my day :)

Thanks for taking the time.
gerald

anespa on "How to convert a plugin to API"

$
0
0

Dear friends,
I am using a wordpress application & a non-wordpress web site for an activity logging purpose . My need is , I have some plugins in my
wordpress APP that must be converted as a Common API , which can use by both for my wordpress app & web app . Do any one can advise how it can do?
I checked xmlrpc for same purpose . But don't get much idea .

I refer urls below
Convert API to Wordpress Plugin

Is it possible to extend Wordpress XMLRPC interface from a plugin?

Is there a wordpress plugin for creating an API from your site?

Please reply me with a solution asap

Thanks,
Anes

Cyril Batillat on "Handle field repetition with Settings API"

$
0
0

Hi,

I read a lot of stuff about Settings API, but I can't see how to handle this kind of functionnality :

I would like to display multiple options (eg: First Name, Last Name), and to be able to clone theses fields via a button (eg "Add a row"), letting the user make an other entry with the same fields (like repeater field in Advanced Custom Fields plugin).

Last but not leat, if possible, saving all this stuff in a single serialized option would be great.

Any ideas ?
Thanks.

scdwb on "Custom users.php column to Order by user_meta"

$
0
0

Hello,

I've added a new sortable column to the Users.php page in the WordPress admin (Users > All Users).

This works really well and the new column is populated by a custom user_meta value. Here is the code:

// Register payment_pending_count sortable column
add_filter('manage_users_columns', 'add_payment_pending_column');
function add_payment_pending_column($columns) {
    $columns['payment_pending_count'] = 'Payment Pending Count';
    return $columns;
}

add_filter( 'manage_users_sortable_columns', 'add_payment_pending_column_sortable' );
function add_payment_pending_column_sortable( $columns ){
	$columns['payment_pending_count'] = 'payment_pending_count';
	return $columns;
}

add_action('manage_users_custom_column',  'show_payment_pending_column_content', 10, 3);
function show_payment_pending_column_content($value, $column_name, $user_id) {
if ( 'payment_pending_count' == $column_name )
return get_user_meta($user_id, 'payment_pending_count', true);
return $value;
}

This displays a nice new "sortable" column and I can click the column. However, the problem is finding a solution on how to tell WordPress to sort by this custom user_meta value. The following function doesn't work and WordPress still sorts by the default setting of the "username" when I try and sort this new custom column:

function payment_pending_column_orderby( $vars ) {
    if ( isset( $vars['orderby'] ) && 'payment_pending_count' == $vars['orderby'] ) {
        $vars = array_merge( $vars, array(
            'meta_key' => 'payment_pending_count',
            'meta_type'    => 'numeric',
        ) );
    }
    return $vars;
}
add_filter( 'request', 'payment_pending_column_orderby' );

I think I'm nearly there, I just need to be able to sort by this custom user meta. By default, the WordPress users.php page already lets us sort by the user's email, name and username. And these are all user_meta values. I've tried searching in the core code of WordPress to see if I can replicate how it's been done with these values but I've been unable to find the right code. I may just need pointing in the right direction.

Many thanks,
Steven

halben on "Add custom register link to menu"

$
0
0

I'm trying to add a register link when the user is not logged in, it should display the register link in the top navigation.

I have the following:

if (is_admin() || $args -> theme_location != 'top_navigation')
		return $items;

	if (is_user_logged_in())
		$link = '<a href="' . wp_logout_url() . '" title="' . __('Logout') . '">' . __('Logout') . '</a>';
	else
		$link = '<a href="' . wp_login_url() . '" title="' . __('Login') . '">' . __('Login') . '</a>';

//This is where the new code would go.

	return $items .= '<li id="log-in-out-link" class="menu-item menu-type-link">' . $link . '</li>';

I only have the $link variable and if I add another variable, the code will break. Can someone please assist me?

Thanks,
Hal

[Bump deleted - http://codex.wordpress.org/Forum_Welcome#No_Bumping

shmk on "password_reset hook missing argument 2"

$
0
0

I'm trying to attach a function to the password_reset hook:

function my_password_reset($user, $new_password){
    /* actions */
}
add_action('password_reset', 'my_password_reset');

But it returns me the error that the second parameter, the plain password, is not passed to my function.

Warning: Missing argument 2 for my_password_reset()

I can't understand what is wrong with my function, anyone could help me?

HansBlancke on "Custon database don't work"

$
0
0

Hello,
I am not a perfect programmer but please help me. I want to post a form to my custom database in wordpress. I have tryed a lot of things and normal it is working but in wordpress it don't. For programming in php I have to add [insert_php] from a plugin otherwise php don't work in wordpress.

Please help me.
Hans

[insert_php]
/* Config Values - You need to know these */
$db_host = 'MYCODE';
$db_user = 'MYCODE';
$db_pass = 'MYCODE';
$db_name = 'MYCODE';

/* Connect to the new database */
$externalQuery = new wpdb($db_user, $db_pass, $db_name, $db_host);

If($_POST['verzenden']) {

$sStraat=$_POST['Straat'];

if($externalQuery->insert('rittenAdressen', array 'straat' => $sStraat ) == false) wp_die('Database Insertion failed'); else echo 'Database insertion successful<p />';

  }
else
  { 

[/insert_php]

<form action="" method="post">

Streetname: <input type="text" name="Straat">

<input type="submit" name="verzenden" value="verzenden">
</form>

[insert_php]
} // end else no post['submit']
[/insert_php]

[Please post code & markup between backticks or use the code button. Your posted code may now have been permanently damaged by the forum's parser.]


AlexanderBeloev on "Recent posts carousel shortcode"

$
0
0

Hello there,

First off I want to introduce myself.

My name is Alex, I am 23 and I have started learning wordpress a couple of months ago.

I wanted to ask you a question about shortcodes. I have the following code, that I want to transform into a wordpress shortcode with 3 variables: title, number_of_posts and category. I have tried a lot of different ways, but simply it doesn't work. Here is the code I have:

<h3>You may also like...</h3>
<div class="list_carousel responsive">
	<ul id="foo2">
		<?php
			$args = array( 'numberposts' => '5' );
			$recent_posts = wp_get_recent_posts( $args );
			foreach( $recent_posts as $recent ){
				if ( has_post_thumbnail($recent["ID"])) {
					echo '<li><a href="' . get_permalink($recent["ID"]) . '" title="Look '.esc_attr($recent["post_title"]).'" >' . get_the_post_thumbnail($recent["ID"], 'large') . '</a>
					<a href="' . get_permalink($recent["ID"]) . '" class="carousel-post-title" title="Look '.esc_attr($recent["post_title"]).'" >' .   $recent["post_title"].'</a> </li>';
				}
			}
		?>
	</ul>
	<div class="clearfix"></div>
	<a id="prev2" class="prev" href="#"><</a>
	<a id="next2" class="next" href="#">></a>
</div>

Thank you all in advance!

Regards,

Alex :)

utcwebdesign on "Capability not working for add_menu_page"

$
0
0

Hi,
hope fully someone can help as Im pulling my hair out with this one.

I have added a custom admin page which works fine as an admin. I have set the capability to "read" so that any role can access it.
When logged in as an anything other than an admin the new page can be seen but when trying to save changes it displays the infamous message "cheatin' uh?"

Please tell me where I am going wrong here...

add_action( 'admin_menu', 'mytheme_options' );
function mytheme_options() {
	// Add theme options page to the addmin menu
	add_menu_page( 'Site Options', 'Site options', 'read', 'theme_options', 'mytheme_home_page' );
}

[Please post code & markup between backticks or use the code button. Your posted code may now have been permanently damaged by the forum's parser.]

Howdy_McGee on "Post Media Library Default View"

$
0
0

I'm looking for a way to change the default view of the "Add Media" library on every post page.

I'd like it to show only images added the the page instead of All of the media library.

Either that or Id like it to default to "Upload To" instead. For a large website all the images in the media library can become cumbersome so i'd like an alternative.

Filip on "Order events by custom date (todays date not displaying)"

$
0
0

Hello guys,
i was wondering if you could help me with something.

i have a snippet displaying a list of upcoming events ordered by a custom field "date".

the thing is, events happening "today" are not featured. how can i display events including the ones that happen in the current day?

thank you in advance for any help i can get

redletter on "wp_nav_menu() fallback not receiving vars"

$
0
0

I developed a custom walker class to implement the Bootstrap 3.0 menu structure so menus can be edited using the WordPress menu editor.

https://github.com/twittem/wp-bootstrap-navwalker

Everything works great except for the $fallback_cb which is used by default when the theme is installed. I read in the codex that

$fallback_cb
(string) (optional) If the menu doesn't exist, the fallback function to use. Set to false for no fallback. Note: Passes $args to the custom function.

The issue seems to be that the wp_page_menu function is not receiving the $args from the wp_nav_menu() declaration.

Here is my current wp_nav_menu() declaration.

<?php
wp_nav_menu( array(
      'menu'           => 'primary',
      'theme_location' => 'primary',
      'depth'          => 2,
      'container'      => false,
      'menu_class'     => 'nav navbar-nav',
      'fallback_cb'    => 'wp_page_menu',
      'walker'         => new wp_bootstrap_navwalker())
);
?>

Can anyone offer some insight into how I might resolve this issue?

Viewing all 8245 articles
Browse latest View live




Latest Images