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

iu101 on "woocommerce variable price position"

$
0
0

Hello,

I was to know if its possiable to place the real time price on top of the variable menu on the product page?

please see attached link:

screen shot

thanks,


pdstudio on "IF logged in, show logout link doesnt work"

$
0
0

Hy,
I want to make a logout link for the logged in users.
I inserted this code to my template file:
<?php if ( is_user_logged_in() ) { echo "<a href=\"" . wp_logout_url( 'http://www.deependfx.com' ); ."\" title=\"Logout\">You are now logged in. Click here to log-out.</a> }; ?>
but I get an error:

Parse error: syntax error, unexpected '.'

What am I doing wrong?

edow on "get_avatar shows the same avatar for all users"

$
0
0

I have the following code to show the user avatars in the comment section:
<img src=\"".get_avatar_url(get_avatar( $comment->comment_author_email, 50 ))."\" class=\"tooltip\" title=\"$like->comment_author\">

My functions file contains this code so it returns the avatar url only:

function get_avatar_url($get_avatar){
    preg_match("/src='(.*?)'/i", $get_avatar, $matches);
    return $matches[1];
}

I use the plugin https://wordpress.org/plugins/simple-local-avatars/ to upload a custom avatar.

The plugin is working great, but with the above code every user avatar in the comment section shows the same avatar instead of their own avatar. If I look in the admin section the avatars showing the right avatar for each user.

Can anyone help me with this. I can't find out what I'm doing wrong.

Even <?php echo get_avatar( $id_or_email, $size, $default, $alt ); ?> isn't working.

This is the rest of the code which shows the comments:

<div class="post-comments">
			<div class="upvoters" id="votes">
			<?php $comments = get_comments( array('post_id' => get_the_ID(),) );
			$likes = array();
			$unlikes = array();
			foreach( $comments as $comment ) {
				if('unlike' == $comment->comment_content ) $unlikes[] = $comment;
					else $likes[] = $comment;
			}
			echo '<h3>'.count($likes).' bezoekers vinden dit leuk</h3>';
			echo '<div class="upvoter-img">';
			foreach( $likes as $like )
				echo("<img src=\"".get_avatar_url(get_avatar( $comment->comment_author_email, 50 ))."\" class=\"tooltip\" title=\"$like->comment_author\">");
			echo '</div>';
			?>
			</div>

			<div class="downvoters">
			<?php
			echo '<h3>'.count($unlikes).' bezoekers vinden dit niet leuk</h3>';
			echo '<div class="downvoter-img">';
			foreach( $unlikes as $unlike )
				echo("<img src=\"".get_avatar_url(get_avatar( $comment->comment_author_email, 50 ))."\" class=\"tooltip\" title=\"$unlike->comment_author\">");
			echo '</div>';
			?>
			</div>

			<div class="clearBoth"></div>
		</div>

Hopefully anyone can help me out.

rodeored on "Do the instance ids change for each instance?"

$
0
0

I'm using the all in one calendar.
I originally assumed that each event instance would be permanently tied to a row in the wp_ai1ec_event_instances table, so therefore I could always refer to that night's particular show by the id of that instance. However that no longer seems to be true.

For example, when I first created an event, one particular instance had an id of 11. But after I created some other events with other instances, the id of what was instance 11 was now instance 1004.

Does that make any sense? Do the ids of already existing instances change when you add more instances? If that's true, how do I refer to one particular show? Isn't there some field somewhere that permanently refers to a particular instance?

Diamons on "Limit account to one login at a time?"

$
0
0

I want to prevent 2 people from using one accoubt login simultaneously. If Person A logs in and then Person B logs in, Person A should be logged out.

How would I go about doing that?

robotrop on "function that returns score of most related post. (YARPP)"

$
0
0

I'm making the base of wordpress posts using Automatic Featured Image Posts Plugin. I added some functionality to the plugin, like post title = image name.

But some of the image names are very similar. Curently, I'm manually using YARPP to check the similarity score. I want to do it semi-automatic, something like: if it's over modify the title ($title = '!!'.$title; ).

----
In the readme.txt I found yarpp_related() but it returns (html ready) related items, without the score.

I tried to figure out which function could return the score of the most similar item (based only on title). Or a string containg the score. But, I feel so lost in the yarpp code.

Pete on "Conditional based on whether the current cat has a child category"

$
0
0

I'm having trouble getting the syntax correct?

<?php // conditional based on whether the current cat has child categories... or not
$cat_id = get_query_var('cat');
$catlist = wp_list_categories('echo=0&orderby=id&title_li=&child_of=' . $cat_id); ?>
<?php if (get_categories('parent=' . $cat_id)) { ?>
<h1>The current cat has a child cat</h1>
<?php else {  ?>
<p>The current cat doesn't have a child cat</p>
<?php } ?>

I think it's the end part...

<?php else {  ?>
<p>The current cat doesn't have a child cat</p>
<?php } ?>

Thanks... I'm sooo bad at php!

Pete

john_aku on "enqeue_script not working in plugin"

$
0
0

I have the following code in my plugin. The problem is that it does not enqeue jquery and the scripts. This is the code

add_action('wp_enqueue_scripts', 'my_scripts');
function my_scripts() {
	global $post;

	wp_enqueue_script('jquery');

	//register and enque scripts
	wp_register_script('myjs_script', plugins_url('js/myscript.js', __FILE__), array('jquery'));
	wp_enqueue_script('myjs_script');

	//register and enque styles
    wp_register_style('myjs_script_styles', plugins_url('css/my.css', __FILE__));

    wp_enqueue_style('myjs_script_styles');

}

KarlN on "Modifying Author Pages"

$
0
0

I would like to add some information from the database to the bottom of the bio on the author page.

I am doing this via a plugin, I have the data entry ready to go but I can't figure out how to pull the information from the database and add it to the page.

Obviously I don't expect an exact answer, but if someone could point me in the right direction I would appreciate it.

Jessica on "How To Replace The WP-Amin Login Page With A Custom Login Page"

$
0
0

I am trying to figure out how to do the following:
Either be able to add text to the WP-Login Page above and below the logo,
Or
Create a custom login page that will be used instead of the default login page.

I have been looking for tutorials on how to do this and I have not found exactly what I am looking for. The wordpress codex seems to allude to how to create a custom login page but I am a little confused by it.

Can anyone help me figure this out?

Thanks in advance for your time.

jronder on "removing pingback"

$
0
0

I was told to drop my meta pingback. I have it disabled in settings-discussion, if that is the same. Can somebody advice how can I do it please?

thank you very much,
July Ronder

untara06 on "I Need HELP! My WPblog HACKED by TURKISH HACKER !"

$
0
0

Please help me, Im a new blogger..

My blog hacked 3 days ago .

In view blogs written ' Blog Hacked by Artist ( Turkish Hacker ) ' with music background . Here I show screenshoot ....

http://i327.photobucket.com/albums/k444/mygalertsaz/HackedByArtist_zps9d9d2c3b.png

On the blog title and wp login I see code like this :

+ADw-BODY bgColor+AD0 black +AD4 +ADw-p ... white size +AD0 4+AD4-TURKiSH HACKER +ADw-/font+AD4 +ADw-embed ... +ADw-TITLE+AD4-Hacked By HaYaL-ET-06 +ADw-/TITLE+AD4 ...

After browsing to find out how to solve it but still doesnt work ,
these are the steps I did :

- Uninstall and remove all plugins ,
- Uninstall and delete all theme and install new theme ,
- delete all the files in the host exception wordpress wp-content , wp - config .
- Remove .htaccess
- Upload wordpress 3.8.1 file manually with FileZilla except wp-content , wp-config, and readme

, ... still no change .

I checked in the database ,..

- On wp_option the option_name column blogname I find strange code as in his title , then I change it with my blog name . I have not checked all the database because I dont know what kind of code must be found .

After that , the changes seen , codes on title and display wp-login lost .

But, the blog still like the picture on the link above . When trying to access the blog , I saw a glimpse of the homepage before layout the image appears .

- For a while I rename index.php and put a new index with the message that the blog is being repaired .

Now , I dont know what else to do .

anyone can help me, please? ?

is there any other files that should be deleted in the database?

EWSEL on "Getting Member Function Error"

$
0
0

Hallo,

i made a custom post loop query to load a meta data.
I get this error:
Fatal error: Call to a member function have_posts() on a non-object in /home/usr/public_html/wp-content/themes/skin/tabs/lib/link_tab.php on line 98

Code from link_tab.php line 98-104

while ( $linktab->have_posts() ) : $linktab->the_post();
$custom_fields = get_post_custom();
global $post;
$link_tab = get_post_meta($post->ID,'link_tab', true );
foreach ( $link_tab as $key => $value ) {
require_once ('linksload.php'); //php code file
$link = new Link( $value );
?>

i can not see any error its work perfekt if i use the $value as url

Smaandar on "$25.00 turns into .00, Is something removing my punctuation and numbers?"

$
0
0

Hello all,

I currently am working on writting a custom php script, that is being imported to a Word Press page through PHP via the 'insert-PHP' plugin. But that is not the intent of this post. Inside my script I have it print prices, such as '$25.00', through echo. Outside of Word Press it works wonderfully, and without the '$' symbol it continues to work. However, with the '$' symbol, while in Word Press, it removes everything from the '$' symbol to the next space, period, or non integral character.

This means that '$25.00' Turns into '.00'.

My question, is does Word Press have any built in filtering that is, well, filtering this out? If so, is it possible to override this filter and not remove these characters?

Thanks in advance,
~Smaandar

kshilpa1385 on "WordPress Login credentials Pass to another site"

$
0
0

[Moved from Your WordPress which is NOT a support forum.]

hi,

I have 2 websites one is in wordpress and another is in asp.net.

I want pass login credentials of wordpress to asp.net

So please tell me how should do it?

I am new in wordpress, so please help me.


chachalady on "Native gallery shortcode output- title attribute"

$
0
0

Hello,
I would like to avoid installation of any other gallery plugin since Native wordpress gallery does everything I need (I even managed to add fancybox class and rel ...) EXCEPT ONE THING :
- there is no title attribute (and I need one in a> tag ... )

I know it is a "wordpress way" now : gallery shortcode generate the output without title , text we write inside image title is outputed in 'alt' like this:

<a class="fancybox" href="http://www.mydomain.com/..my-image.jpg" rel="galleryGroup">
<img class="attachment-thumbnail" width="150" height="150" alt="MY TITLE" src="http://www.mydomain.com/..my-image-thumb.jpg">
</a>

I need this:

<a class="fancybox" title="MY TITLE" href="http://www.mydomain.com/..my-image.jpg" rel="galleryGroup">
<img class="attachment-thumbnail" width="150" height="150" alt="MY TITLE" src="http://www.mydomain.com/..my-image-thumb.jpg">
</a>

Since the title is "picked up" in alt there must be the way to use it and write/ echo it in title attribute.

I really need it to work with gallery shortcode, when inserting gallery to post or page.
( title attr. while inserting single image is not so important right now ... it can be added manualy if needed ...)

If it means to hack the core wordpress file - so be it.!
I can live with that one and only hack - I will add it when updating wordpress ...

If there is other way please help - I was browsing through forums for days now with no luck ( either I messed up with code or syntax or the solution was not what I need ..)

I believe the code for gallery shortcode output is in wp-includes/media.php - don't know how to get the title from the image data and display it as title attribute in tag ...

Thanks,
ChachaLady

artspacepatchogue on "Someone is redirecting my site"

$
0
0

I just took over the wordpress website for a gallery I managing. In the comment section I notice a lot of people talking about sales and materials from other countries, than people have told me that when they go to the site they often get redirected to another site. It seems that someone have redirected our site for black market sales, how do I stop this? But they are also using the comment section for communicating.

Samnabz on "Post Category Name - Allow HTML?"

$
0
0

Hi all,

I was wondering if anyone could please instruct me on how I can allow HTML in the post category name field in the admin panel.

Here's a screenshot: http://oi60.tinypic.com/3486khz.jpg

Any help with this is greatly appreciated.

Thank you.

urbanrich on "How can you create anchor links in menu drop down?"

$
0
0

Hiya all

I'm trying to change menu links into anchor links. I have a page called 'Menu' that I would like to have a drop down list with links that jump to certain parts of the page i.e 'Burgers'. Then users can jump from another page directly to the linked area of the 'Menu' page.
I've read a few different topics discussing how to do this, but seem unable to get it to work for me.
Can anybody please give me any advice how I can achieve this?

Vaughan on "How to make Displayname & nicknames Unique"

$
0
0

I've seen many requests for this, but no solutions. So a colleague and I spent the last few hours figuring this out.

It's quite dirty, but does the job, just place it in your theme functions.php on a single site, or in a functions.php file inside your mu-plugins folder on a multisite.

The script will also scan existing users (if your site already has many) and any non unique display names will be updated and replaced with username.

I know this isn't totally ideal, but any suggestions for dealing with existing users or improvements are always welcome.

// Make nickname & display_name unique
// and automatically change non unique nicks & display name to username
// in case you already have existing users
// by Ashok & Vaughan Montgomery
/*
 * adding action when user profile is updated
 */
add_action('personal_options_update', 'check_display_name');
add_action('edit_user_profile_update', 'check_display_name');
function check_display_name($user_id) {
        global $wpdb;
    // Getting user data and user meta data
        $err['display'] = $wpdb->get_var($wpdb->prepare("SELECT COUNT(ID) FROM $wpdb->users WHERE display_name = %s AND ID <> %d", $_POST['display_name'], $_POST['user_id']));
    $err['nick'] = $wpdb->get_var($wpdb->prepare("SELECT COUNT(ID) FROM $wpdb->users as users, $wpdb->usermeta as meta WHERE users.ID = meta.user_id AND meta.meta_key = 'nickname' AND meta.meta_value = %s AND users.ID <> %d", $_POST['nickname'], $_POST['user_id']));
    foreach($err as $key => $e) {
        // If display name or nickname already exists
        if($e >= 1) {
            $err[$key] = $_POST['username'];
            // Adding filter to corresponding error
            add_filter('user_profile_update_errors', "check_{$key}_field", 10, 3);
        }
    }
}
/*
 * Filter function for display name error
 */
function check_display_field($errors, $update, $user) {
        $errors->add('display_name_error',__('<span id="IL_AD9" class="IL_AD">Sorry</span>, Display Name is already in use. It needs to be unique.'));
        return false;
}
/*
 * Filter function for nickname error
 */
function check_nick_field($errors, $update, $user) {
        $errors->add('display_nick_error',__('Sorry, Nickname is already in use. It needs to be unique.'));
        return false;
}
/*
 * Check for duplicate display name and nickname and <span id="IL_AD2" class="IL_AD">replace with</span> username
 */
function display_name_and_nickname_duplicate_check() {
    global $wpdb;
    $query = $wpdb->get_results("SELECT * FROM $wpdb->users");
    $query2 = $wpdb->get_results("SELECT * FROM $wpdb->users as users, $wpdb->usermeta as meta WHERE users.ID = meta.user_id AND meta.meta_key = 'nickname'");
    $c = count($query);
    for($i = 0; $i < $c; $i++) {
        for($j = $i+1; $j < $c; $j++) {
            if($query[$i]->display_name == $query[$j]->display_name){
                wp_update_user(
                        array(
                              'ID' => $query[$i]->ID,
                              'display_name' => $query[$i]->user_login
                        )
                    );
            }
            if($query2[$i]->meta_value == $query2[$j]->meta_value){
                update_user_meta($query2[$i]->ID, 'nickname', $query2[$i]->user_login, $prev_value);
            }
        }
    }
}
// Call the function
display_name_and_nickname_duplicate_check();

/*
 * Calling the display_name_and_nickname_duplicate_check() again when a new user is registered
 */
add_action( 'user_register', 'check_nickname', 10, 1 );
function check_nickname() {
    display_name_and_nickname_duplicate_check();
}
Viewing all 8245 articles
Browse latest View live




Latest Images