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

SEO Consulting Charlotte NC on "Calling a MySQL stored proc with wpdb"

$
0
0

No one has any idea of how to successfully call a stored procedure using WPDB?


json21 on "Link image to two different places, depending on location / url"

$
0
0

I am using a theme, which displays post images on the main page, and they link to image file (full picture only showing in a browser). I would like to link image on the main page to the single post page, and image on the single post page to the actual image file.

I guess I would need to create a child theme, and add a function there, which would do this. Would you be able to tell me, how something like this could look, or where to look for it?

Main page -> Click on image -> single post page
single post page -> Click on image -> image file

By default it works like this:
Main page -> Click on image -> image file
Single post page -> Click on image -> image file

Thanks.

Pepe Huerta on "HOW-TO: Embed **THE NEW** Google Maps without a plugin or shortcode"

$
0
0

Hi,

There are a lot of tutorials about embedding Google Maps in your posts, but after a long and painful research, I notice that every single tutorial was about embedding **THE OLD** Google Maps platform... the one with the url scheme 'maps.google.com'.

**THE NEW** Google Maps scheme (https://www.google.com/maps/place/) is completely different, and there almost no documentation on how to make it work in WordPress.

So, here is a quick tutorial on how to embed **THE NEW** Google Maps in WordPress posts without a plugin and just pasting the map url in the post body:

1. First, you need an API Key from Google. Follow the instructions at https://developers.google.com/maps/documentation/embed/guide#api_key.

2. Once you have your API Key, we can get into the code. In your favorite theme, open functions.php and add:

<?php
wp_embed_register_handler( 'googlemapsv1', '#https?://www.google.com/maps/place/(.*?)/#i', 'wpgm_embed_handler_googlemapsv1' );
function wpgm_embed_handler_googlemapsv1( $matches, $attr, $url, $rawattr ) {
	if ( ! empty( $rawattr['width'] ) && ! empty( $rawattr['height'] ) ) {
		$width  = (int) $rawattr['width'];
		$height = (int) $rawattr['height'];
	} else {
		list( $width, $height ) = wp_expand_dimensions( 425, 326, $attr['width'], $attr['height'] );
	}
	return apply_filters( 'embed_googlemapsv1', "<iframe width='{$width}' height='{$height}' frameborder='0' scrolling='no' marginheight='0' marginwidth='0' src='https://www.google.com/maps/embed/v1/place?q=" . esc_attr($matches[1]) . "&key=***YOUR-API-KEY***'></iframe>" );
};
?>

Be sure to replace ***YOUR-API-KEY*** with your KEY. Save & close.

3. Test the new code by adding a new post and just pasting a google maps url like this one from The White House:

https://www.google.com/maps/place/The+White+House/@38.896278,-77.0306687,17z/data=!3m1!4b1!4m2!3m1!1s0x89b7b7bcdecbb1df:0x715969d86d0b76bf

That works the same way as just using:
https://www.google.com/maps/place/The+White+House/

The RegEx can be tweaked to allow different URL schemes for the four new modes, detailed here: https://developers.google.com/maps/documentation/embed/guide#modes.

This method only works for 'place' mode, but reading the documentation will get you on track to make the 'directions', 'search' and other modes working.

That's it. I hope it works for you guys (and excuse my english). Any contributions for the code will be appreciated.

natostanco on "Why I am not able to pass arguments through do_action?"

$
0
0

I am trying to pass arguments to the function of a plugin through a do_action, but only the first variable is registered which is the post ID, the second variable is a string and does not get read at all, I have noticed that if I but the variable as number 1 it actually gets read. So the number of arguments is the problem, but I have specified the number of arguments like this:

add_action('save_post', array($this, 'myfunction'), 100 , 2 );

so I don't know why it is not reading it..

Saif Ullah on "Create a default title based on post format status and or aside?"

$
0
0

Let me try ... I will let u know in some time ... First let me test drive it .

anjx on "Function to change page title not works in plugin"

$
0
0

Hi,
I want put a custom page title in a specific page. So, if I'll put a code in functions.php this works fine, but if I'll put this code in my plugin, not works.

The code is:

function wp_myplugin_property_title()
{
	if( is_page('images') ){
		$seotitle = 'custom title';
		return $seotitle;
	}
}

add_filter('wp_title', wp_myplugin_property_title, 100);

lesdossey on "wp-admin defaults"

$
0
0

currently when I open my post editor I see all posts. I'd like to change the default so that it automatically shows drafts.

sandyfischler on "Custom Widget Code"

$
0
0

I've got multiple tabs open with tutorials for creating a custom WP widget and I'm confused since they are all saying slighting different things.

I've created my plugin and it shows up in the plugin list (good so far).

Where I'm challenged is in adding the code to actually create the widget and what order things go in since each tutorial is doing it differently and I'd like to start out with Best Practices.

This where I am so far and I'm already stuck because I have questions....

<?php
/*
Plugin Name: Fuller Donation Widgets
Description: Donation channel widgets
Author: Sandy Fischler
Version: 1
*/
/* Start Adding Functions Below this Line */

class fuller_of_openstrap_donation_page_one extends WP_Widget {
    function fuller_of_openstrap_donation_page_one() {
        parent::__construct(false, $name = __('Fuller Donation Widget One', 'fuller_of_openstrap_donation_page_one') );
    }

Questions:

1) Do I state the class first or register the widget first? I see it done both ways. One tutorial starts out with register widget and another has it much lower in the code.

2) In the WP codex they use parent::__construct, in one tutorial they use parent::WP_Widget which is correct?

Thanks!


expat on "What the best content (not image) slider/rotator??"

$
0
0

What the best content (not image) slider/rotator??

i have set up the posts and pages, so i dont really want to do it again, so is there a good plugin that takes my posts/pages and use the featured images and post content/excerpt and display it on the front?

free or commercial recommendation

thanks

RaybirdDesigns on "Google Custom Search with built-in Search Box"

$
0
0

Hey all, I'm trying to set up Google Custom Search with Google Adsense attached in a site, http://www.lifewithgremlins.com/, but I want to be able to keep the original search box that appears in the top right of the screen, while still linking to the Google search.
I thought inserting it into the searchform.php would work, but it ends up directing to an incorrect page without any searches and the bar takes up the entire width of the site.
I have also tried rewritting the Google code into the same file, dropping their stylizations, and still can't get a direct to the search page that it's meant to direct to.

I am using Basic.

Harris Marfel on "How to Populate Select from PHP Function in Wordpress"

$
0
0

I have a form shown below:

<?php
$list_id = $db_connect->get_results($db_connect->prepare('SELECT * FROM users WHERE wp_ID= %d AND svr_region=%d', $wpid, 1));
?>
<form name = "reset_data" action="<?php the_permalink(); ?>" method="post">
    <select id = "select_id" name="select_id" required>
        <option value="" > - Chose ID - </option>
        <?php
        foreach ($list_id as $list_id) {
            $get_list_id = $list_id->ID;
            $get_list_name = $list_id->name;
            echo '<option value="' . $get_list_id . '" >[' . $get_list_id . '] ' . $get_list_name . '</option>';
        }
        ?>
    </select>
    <select id = "select_role" name="select_role" >
        <option value="" > - Chose Role - </option>
        <?php
        $get_role = GetRoleList($_POST['select_id']);
        echo $get_role;
        ?>
    </select>
    <input type="submit" value="Get Data! »"/>
</form>

How do I create a JQuery or Ajax to disable #select_role if #select_id has an empty value.

#select_id value type is Integer, and after #select_id chosen, it will execute a PHP function GetRoleList ( $_POST['select_id'] ) and returns the result like this '<option value="' . $nick_str . '" >' .$nick_str. '</option>'

rupdog on "WP-Admin hacked and now totally blocked"

$
0
0

Hi,

My wordpress instance has been hacked. I managed to restore the site partially. However, I am not able to access the admin dashboard. Whenever I try to access the wp-admin page I get this message:

"錯誤: 嘗試過多次失敗登入 請在9998小時後再重試。"

I googled it but get nothing back. I translated it and googled the English translation but also go no solution. Does anyone know how this can be fixed?

rogeralsing on "Auto login via IIS / Windows authentication"

$
0
0

I run WP under Win and IIS8.
I've enabled Windows Authentication so that I can get the currently logged in domain user via server code get_current_user()

As I am a complete noob on WP and PHP, what would be the correct way to build a autologin feature?

Should I make it a plugin that somehow hooks into the login flow of WP?
e.g. if a domain user is present, fetch info from AD, sync with WP DB.
If a domain user is not present, show login screen, verify credentials with AD, incase the user access the site externally that is.

I know there are many LDAP/AD plugins, but none of the ones I've seens does auto login.

Bolder Elements on "Private Plugin Auto Updates"

$
0
0

I am so close to finishing up the ability to auto-update my personal (non-repository) plugins, but getting it to work on a network install is a nightmare. I have no other way to include the files for the update than from my plugin's primary file, but this file does not load whatsoever from the network admin because it is not network enabled, only individually per site. This means that the information is never properly loaded into the network plugins page, and if I visit this page, it throws a wp_error and ditches the upgrade information.

Is this an impossible task?

perpetual.design on "Properly Run Pop Up-Javascript in Wordpress"

$
0
0

I have modified and designed a javascript popup for a client. It works perfectly in a test.html page on my client's site.
Test

I now need to run it in wordpress. I know that I need to enqueue and register the stylesheet and javascript. But where? In a custom-functions.php file? The theme automatically includes that file in it's standard functions.php, if cust.. exists.

After that, what would be the best place to put the html? In the footer? On the home page? My goal is for the pop-up to appear only on the homepage. Right now, putting the pure html in a page doesn't work. The display:none css is added by the javascript. As well as the other form functions.

If you look at the test.html source you can see the references to jquery and javascript in the custom popup.js and the styles.css.

I simply need the easiest way to incorporate this standard ajax/php style form into wordpress. I appreciate any help!


sescpapa on "wp enqueue style question"

$
0
0

Okay, according to what I've read here and there across the wordpress forum, the ideal way of calling your stylesheets is by using the wp_register_style and wp_enqueue_style functions in functions.php, which more or less looks like this:

<?php
wp_register_style(
'function_I_named_as_I_pleased',
get_template_directory_uri() . ''
array( 'style1.css, style2.css, style3.css and so on' ),
);
?>

What I don't understand though is if my main style.css-file should be included here. And if it is followed or preceeded by other stylesheets that are all located in a subfolder (called "stylesheets" let's say), how do I code that as an array, given that the location of the main css and the others is not exactly the same?
PS. I am a beginner, so try to keep it simple.

ameljor322 on "unknown link"

$
0
0

Hi,

I did a broken link check and it seems I have 104 broken links of the same link, and this link is not known to me.

This is the link and I have no idea how to get rid of it. Can someone please tell me what this is and if I can get rid of it, please.

destinedjagold on "Disabling Other Categories In Creating Posts"

$
0
0

Hello and good day everyone.
When creating a post, I want it that I can only choose one category from the list. After I chose one, the others will be disabled until I uncheck the one I selected. Is this possible?

Also, is it possible for the post to not be published/turned into a draft if no category is selected?

Thank you~

dave_ac on "Navigation external site - can of worms"

$
0
0

Hi,

I have inherited a project that is a can of worms (There is not the time to rewrite poorly written scripts + I am not slick with WP )

The question is there are two sites wordpress.business.com and micro.business.com.

wordpress.business is working fine and so is micro.business. Wordpress is using a child of elegant themes Divi design

What options or examples are there for querying the wordpress database / site and returning the current main and footer menus and header / banner text?

I have spent today googling and writing a class that will return blocks of code, but it is not a satisfactory method?

Any thoughts or hints?
Many thanks

Palagrin on "Viewing the root of a custom taxonomy"

$
0
0

Hi,

I've created a custom post type with a few custom taxonomies, for example "author". In this taxonomy I've then got the terms.

It's perfectly possible to view archive pages for the terms - example.com/author/term; but what I want to be able to do is see the root, as it where, of the taxonomy at example.com/author and see a list of all the terms in that particular taxonomy.

I've been hunting around and haven't found a way to do this - or am I missing something?

Thanks in advance.

Viewing all 8245 articles
Browse latest View live




Latest Images