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

Ary on "show a link to download the post image"

$
0
0

Hi ,
I want to show the download link of the post image ,
so far, this code returns the cropped image that I want from the media in the post

<?php the_post_thumbnail('thumbnail-name3', '222', '444', array( "center", "center")) ?>

but I want to show the download link for the above thumb image in the post !

can anyone tell me how can I do this ?

Thanks


omgrite on "Displaying one post type within another"

$
0
0

Hi all,

I hope I am posting this in the correct part of the forum. I am currently creating a website and wish to use additional post types to the standard Posts and Pages.

For example, I want to add the post type 'Actors', which when clicked will be very similar to a page because it will have information about a particular actor.

I then want to add the post type 'Films', which will contain a small amount of information about a film. From the admin panel I'd like to create a new Film, and then while creating it I'd like the option to select from a tick list of all of the Actors that I have created, so that the film then displays on the actors page. The Films post type will only display a small amount of information, so it doesn't need to be clickable.

Is this something that is feasible for a fairly experienced web designer or should I invest in the skills of a developer?

Thanks for your replies.

DanielHultman on "Is widget/sidebar showing in current page?"

$
0
0

Hi!
I'm developing a plugin/widget that will be deployed at a couple hundred sites. Most of the sites have sidebars. The sites all look different and uses a vast variation of themes. The plugin is a mu-plugin and I'm automatically adding a widget to an active sidebar. If an active sidebar doesn't exists I'm hooking into get_footer function to display the content. However, the problem is that some sites only have a sidebar on the start page.

I need a general solution to check if either the widget or sidebar is active on "current page" i.e is widget active on the contact page, or is the sidebar active on the about page. The content should only be displayed once.

Is there a way to do this?

I appreciate all the help I can get.

Chris Huff on "Add admin notices when using Wordpress filters"

$
0
0

I'm calling my plugin's function via a filter (wp_handle_upload_prefilter), so I can't just directly write a notice as output, correct? At least, when I tried doing that, it interrupted Wordpress and would not continue processing the upload.

I'm currently trying to nest a function within the main function, which actually works slightly better, but still doesn't seem to allow Wordpress to continue processing the upload either (it just uploads it, then gets stuck on "Crunching"). So how can I write a notice or error to the user?

Here's some relevant code I'm working on.

function aou_upload_file($file) {

    $file_no_ext = preg_replace('/\\.[^.\\s]{3,4}$/', '', $file['name']);

    // Determine if the file can be uploaded
    if (strpos($file['type'],'video') !== false) {
        $mediatype = 'movies';
        }
    elseif (strpos($file['type'],'audio') !== false) {
        $mediatype = 'audio';
        }
    else {
        function aou_not_supported_notice(){
            echo '<div class="error"><p>File type not supported.</p></div>';
            }
        add_action('add_attachment', 'aou_not_supported_notice');
        return $file;
        }
    }

add_filter('wp_handle_upload_prefilter','aou_upload_file');

emfjsullivan on "How to generate an HTTP request after form submission"

$
0
0

I'm new to wordpress and am looking for advice on how to do the following:

plugin: Contact Form 7

I have a form the user fills out which contains their email address. When they click "Submit", after the email address format has been verified, I generate an email to the user but I would also like to generate an http get request which contains the email address just entered - http://HOST/email=EMAIL. This notifies another system to do processing for that email.

How and where can I insert some code to generate a simple request like this? I see there is a wp_remote_get() command, but I'm not sure where I could put that since modifying the plugin code is not recommended. Maybe a webhooks type plugin is available?

Any suggestions?

Thanks

ltdJ on "Sharing Unknown image on Facebook"

$
0
0

Hi guys,
I've been trying to fix the share image on my blog so that when it shares on Facebook people can see that it's a video and Facebook sees it as a video- Not only have I not figured that out, now I'm sharing the image a sleeping cat and I don't know where it came from. I never added it. Sometimes it also shares a picture that I had but deleted. I'm using and old theme- Luxury- I keep trying to find that image but can't figure it out. I added and ran WP Super Cache and that did not help.
Thanks for your help.

dan1974 on "Make Wordpress conform to Americans With Disabilities Act"

$
0
0

The Americans With Disabilities Act says that for computers equipped with screenreading software the links must say the link name when moused over and make a sound when clicked. How do I do this with wordpress?

morreke on "Woocommerce // Add text under place order button on checkout page"

$
0
0

Hello,

i want to add some text on the checkout page under the place order button. Any idea how i do that ?


adstrakt on "Woocomerce Change Tax Name on Existing Orders"

$
0
0

Woocomerce Change Tax Name on Existing Orders.
Please can some help with this.

admiralchip on "require('fpdf/fpdf.php') not working in wordpress plugin?"

$
0
0

Hello,

I have the FPDF library in a folder called fpdf and that folder is in my custom plugin folder. The problem is, whenever I try to use require('fpdf/fpdf.php'); to make use of it, I end up getting an error that no such file or directory exists. I really want to get it to work.

Any idea why that's happening?

sddd on "I use theme geniess, How to add code"

latin_l3oi on "Get ID of custom post type within nested shortcodes"

$
0
0

Hi, I'm currently having trouble getting the ID of a custom post type from within a nested shortcode. I'm not sure if this is possible.

Further information to describe my scenario:

  • I've created an "Activity" custom post type
  • I've created a shortcode called "activity" which displays the contents of an activity custom post type based on its ID, this can be set using the shortcode attributes
  • I've created a shortcode called "textarea" which displays a textarea within an acitivty custom post type

The issue that I'm having is that I'm trying to get the "Activity ID" from within the Textarea shortcode but I can't figure a way of doing this.

Please see a diagram via this link to better describe my situation:

https://www.dropbox.com/s/a9bgyjdq9m92qpg/WP-Support---Get-ID-within-Nested-Shortcodes.png?dl=0

I'd appreciate any help with this issue.

Thanks!

Lancelotkiin on "Trouble with Wordpress Ajax Login System - 302"

$
0
0

Hi,

I'm trying to create a simple Ajax Login system with Wordpress.
Unfortunately, every time the "wp_signon" function is fired, my system failed and the only information I have is this one :

POST myurl/wp-admin/admin-ajax.php - 302 Found
GET myurl/?login = failed - 200 Found

So, whether I try to log in with the good informations or not, my JS script goes in the "error part" of my Ajax function.

Can anyone tell me what I a doing wrong? It will be much appreciated!

Many thanks!

JS :

jQuery(document).on('submit', loginForm, function(event) {

	event.preventDefault();

	var usernameVal = jQuery('.modal-login .login-form #user_login').val();
	var passwordVal = jQuery('.modal-login .login-form #user_pass').val();
	var remembermeField = jQuery('.modal-login .login-form #rememberme');
	var securityVal = jQuery('.modal-login .login-form #security').val();

	if ( remembermeField.prop('checked') ) {
		var remembermeVal = 'true';
	} else {
		var remembermeVal = 'false';
	}

	jQuery.ajax({
		type : "post",
		url : data_front_end_users_management.ajaxurl,
		dataType: 'json',
		data: {
			action: 'AuthUserAjax',
			username: usernameVal,
			password: passwordVal,
			rememberme: remembermeVal,
			security: securityVal
		},
		success: function(data) {

			if ( data['answer'] === 1 ) {

				modalAlert( msgRow, msgAlert, msgContent, false, 'alert-success', 'alert-danger', data['message'] );

			} else {

				modalAlert( msgRow, msgAlert, msgContent, false, 'alert-danger', 'alert-success', data['message'] );

			}

		//END success
		},
		error: function () {

			modalAlert( msgRow, msgAlert, msgContent, false, 'alert-danger', 'alert-success', defaultError );

		}

	//END ajax
	});

//END jQuery(document).on('submit', loginForm, function(event)
});

ACTION :

function AuthUserAjax() {

	$LoginController = new FELoginController();

	$value = array();
	$value['answer'] = 0;
	$value['message'] = '';

	$username = trim($_POST['username']);
	$password = trim($_POST['password']);
	$rememberme = $_POST['rememberme'];
	$security = $_POST['security'];

	if ( $LoginController->checkAuthInfosFilled( $username, $password ) ) {

		$user = $LoginController->UserAuth( $username, $password, $rememberme );

		if ( $user ) {

			if ( is_wp_error( $user ) ) {

				$value['answer'] = 0;
				$value['message'] = $user->get_error_message();

			} else {

				$value['answer'] = 1;
				$value['message'] = 'Success.';

			}

		//END if ( $user )
		} else {

			$value['answer'] = 0;
			$value['message'] = 'Wrong username or password.';

		}

	} else {

		$value['answer'] = 0;
		$value['message'] = 'Please, enter your username and your password.';

	}

	$data = json_encode($value);

	die( $data );

//END AuthUserAjax
}

add_action( 'wp_ajax_AuthUserAjax','AuthUserAjax' );
add_action( 'wp_ajax_nopriv_AuthUserAjax','AuthUserAjax' );

CONTROLLER :

public function UserAuth( $username, $password, $rememberme ) {

	if ( check_ajax_referer( 'ajax-login-nonce', 'security' ) ) {

		$creds = array();
		$creds['user_login'] = $username;
		$creds['user_password'] = $password;

		if ( $rememberme == 'true' || $rememberme == true ) {
			$creds['remember'] = true;
		} else {
			$creds['remember'] = false;
		}

		$user = wp_signon( $creds, false );

		return $user;

	} else {

		return false;

	}

//END UserAuth
}

gps961 on "Query Syntax help"

$
0
0

I'm trying to modify a query so that the WHERE condition tests that a field equals the login of the user. I know the first part is correct but I cannot work out how I describe the login. It currently goes;

WHERE 'Org' = user_login

but user_login doesn't work.

Does anyone know how I should correct this.

Thanks

peowdie on "How to: Pull random string to wordpress, refreshed by button click?"

$
0
0

I'm looking for a way to take a random line from either a txt file or mySQL database (or third option?) and display on a website. Instead of getting a new line on every page refresh, I would like it to refresh on it's own at the click of a button.

Here's an example of my idea, in case that's a help for anyone.

Imagine a question like "How should I travel?", and a button that says "Give me an idea", then at every click you get a fine random line - "Car", "Boat", "Plane", "Flying Bowl of Ceral" and so on.

I would prefer any way that's using the least resources of the server, and if possible a way to keep people from getting access to all the lines.

I hope someone can help me. :)

Thanks,
Jonas.


king-a-s on "Duplicate default Comments system"

$
0
0

I need a code (plugin) to duplicate default comments system and use it with CPT
and duplicate all settings and modified it

anyone can help me?

thanks

mhz.alsaedi on "Duplicate items in Wordpress menu left pages list"

$
0
0

When navigating to Appearance --> Menus in the dashboard, on the left side where all the pages are listed (to be added), I see duplicates. The page 'home' shows three times, even though there is only one 'home' page in my site.

Is there a DB entry in phpMyAdmin, or an option somewhere to trim those?

If I'm posting in the wrong category, please let me know, this is my first time here in a long time. Thank you so much!

p.s: I looked at relevant questions and none of them had an answer.

jonelp on "Custom CSS Image Link"

$
0
0

Newbie here,

I'm looking to insert a image link (working as a CTA button) in the upper part of my homepage on the left hand, top corner. But I don't know what CSS code I would need in order to acheive this?

Any help would be greatly appreciated!

B Bouch on "how to create a custom form price calculator"

xrundel1 on "function - get_calendar()"

$
0
0

Is it possible to modify get_calendar() function so it wouldn't call ALL posts for the day?

Website have few thousands posts daily and about 50-60K posts monthly, so archive calendar could load page and DB forever.

All I need is simple check if date have posts or not. Practically every day have posts. In other words need just simple solution for calendar where date work as link to: mydomain.com/date/2015/07/01/ without loading all posts/titles for every date.

Calendar have it own page/template.

Any suggestions or ideas?

Viewing all 8245 articles
Browse latest View live




Latest Images