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

Jason Ho on "How can i add something after body tag by a plugin?"

$
0
0

How can i add something after body tag by add_action?
THANKS


picus on "Request for another php function"

$
0
0

Hi,
pardon the probably stupid question but I'm a newbie to plugin development.
I need to do a sort of product catalogue.
I've prepared the mysql tables, the db accessor php classes and the domain objects. Now I'm able to read and print (via Div tags) a list of products (picture, name, price).
This is realized using a shortcode in a static wp page.

Now the question is: which is the better way to invoke another php function that, after a product is clicked, print another list of the selected product features?

Thanks in advance
Fabio

dannymh on "Using $_GET variables as a shortcode attribute"

$
0
0

Hi,

I am writing a plugin and considering using shortcodes to accomplish this, information is going to be passed from page to page. In doing so a variable is going to be passed and I want to take that variable and use it for the shortcode.

So the first page would be

http://mysite/comps/

under that would be a whole lot of links like

comp1
comp2

comp1 would link to http://mysite/comps/comp/1

etc

I want to then grab the variable of comp=1 and pass that to the shortcode so the shortcode would take you to the comp page and the rewrite_endpoint('comp', ...)

would pick up that the rest are variables and values. And I can have a short code of something like

[myshortcode_comp comp=$_GET["comp"]]

Not sure exactly whether this is possible but if it is can anyone possibly help out here?

Cheers
Dan

hasanrang05 on "add_filter with get_search_query executing 4 times"

$
0
0

I am trying to get search query string to submit custom table and count how many time these string searched

my table column
id(int), keyword(varchar), count(int)

everything i made my way but problem is when submit search form its count 4 times code following bellow.

function search_count($search) {

		//table column id, keyword, count
		// intial value 1, wordpress, 1
		global $wpdb;
		$table = "wp_search_count";
		$wpdb->query("UPDATE $table SET count = count+1 WHERE keyword = '$search'");

return $search;

}
add_filter( 'get_search_query', 'search_count');

i have started count value 1 and after submit search form its should be 2 but i get 5 for count value

Please kick me on the way ...
Thanks in Advance.

chadev on "Meaning of code"

$
0
0

Could anyone please tell me the meaning or implication of each line of code? Thanks
$excerpt = preg_replace(" (\[.*?\])",'',$excerpt);

$excerpt = strip_shortcodes($excerpt);

$excerpt = strip_tags($excerpt);

$excerpt = substr($excerpt, 0, 250);

$excerpt = substr($excerpt, 0, strripos($excerpt, " "));

$excerpt = trim(preg_replace( '/\s+/', ' ', $excerpt));

olddocks on "Adding a color picker to theme options page"

flatrader on "Has my site been hacked ? or Not ?"

$
0
0

Hello all !

I've had a website up and running for over a year now and after installing a firewall plugin, I notice on the reports, IP's from non-registered members trying to access my admin section. Am I reading this wrong or is it an actual attempt to hack the site ? I've had a few different IP address with the same warnings below

Here is the firewall warning:

IP: 66.177.166.30 [ IPWHOIS Lookup ] [ Add To Firewall Blacklist ] [ Add To Firewall Whitelist ] 2014/01/21 20:35:25
Info Page Request URI: /wp-admin/admin-ajax.php?action=dropdown-child-categories
Info Visitor IP was neither whitelisted nor blacklisted. Firewall checking started.
Warning All page request parameters were whitelisted (either by page or by parameters).

IP: 66.177.166.30 [ IPWHOIS Lookup ] [ Add To Firewall Blacklist ] [ Add To Firewall Whitelist ] 2014/01/21 20:43:49
Info Page Request URI: /wp-admin/admin-ajax.php
Info Visitor IP was neither whitelisted nor blacklisted. Firewall checking started.
Warning All page request parameters were whitelisted (either by page or by parameters).

Peter Wilson on "Browser Tab Description"

$
0
0

I will start by saying that I am totally new to all this so please bear with me. I have developed a Website using Theme: Twenty Twelve and have the Wordpress SEO plugin by Yoast. This has helped me focus specifically on page titles and meta descriptions. However, the page title appears as the heading to the browser tab whereas I would prefer it to show the Site Title as defined in General Settings & if possible to also show the site logo. Is this possible ?


jules_thestar on "error in plugin development"

$
0
0

hi am new to plugin development, i have red few books.I would like to develop my first plugin for social sharing,but am getting few errors in following code.

<?php
   $social_sharing_toolkit = new MR_Social_Sharing_Toolkit();
   echo $social_sharing_toolkit->create_bookmarks();
?>

For a better look at a plugin developed with this functionality, look at celibatemonk http://www.celibatemonk.com/

Anyone know what is causing this?
thanks in advance

speedster on "Search results in subpage"

$
0
0

Hi,
I would like to show search results in a specific subpage.
Is it possible to "embed" search results generated by search.php in some subpage template?
Thanks.

appleisle on "Post Author URL displays Username NOT Nickname"

$
0
0

I have found earlier requests on this Username appearing in the URL but no real answers & most were 4 to 5 years old - so here goes again:

PROBLEM: Posts are created and display the Nickname (Not Login Username) yet when you click on that Nickname to see a summary of all the posts by that person the URL that appears reverts to:www.??????/author/username/

ISSUE is this gives the "hacker" your real Log In Username. Yes I know we all should have good passwords but as a general WP user I could not believe this is a standard WP code action.

I have just last night had many attempts to hack in at Log In (protected by All In One WP Security & Firewall) and was amazed they had my Username to attempt to crack in (NO it is not Admin!).

That prompted me to think they had cracked into my DB to get the username, then I found via searching the Forum some notes about the problem and sure enough I check my site and bingo the Post Summary for a nickname provides the Username...!!!!

I saw there is a Plug-in SX_Username is this the ONLY OPTION or am I missing some standard WP code/setting issue?

Any help much appreciated.

Mrurka on "Displaying parent, sub and sub-sub Categories, each on different pages."

$
0
0

Greetings all!

I have some data that I need to categorize in 3 parts. For example, one item may be in Category "Farm Products" / sub-Category "Dairy" / sub-sub-Category "Cheese".

I am looking to have all top-level Categories (Farm Products) display on a page and upon clicking one, it brings you to a page listing that top-level categories children (Dairy). And upon clicking that (Dairy), it brings you to a page listing the next line of children (Cheese).

I'm wondering how I can display this, page by page.

Any hints or suggestions on where to look or how to start is very much greatly appreciated. Thank you

Luke Janicke on "Walker class for comments"

$
0
0

Can anyone point me to any good (and by that I mean slightly “For Dummies”) guides on using a walker class for comments?

I just started writing a callback function to customize wp_list_comments() and I checked the codex where I noticed this…

'walker'
( Walker object ) Provide a custom Walker class object to use when rendering the comments. This is the primary method of customizing comment HTML.

Really? The primary method of customizing comment HTML. The Internet doesn’t agree. Mostly.

Anyone point me to a good introduction and example?

dcurran on "301 redirect and redirect_canonical conflict"

$
0
0

I have run into a problem with some 301 redirects. I have a few 301 redirects set up using the simple 301 redirect plugin and they work fine when the site is not using www. however when www. is included in the address they do not work. mysite.com/example redirects to mysite.com/example/page however http://www.mysite.com/example just goes to the index page.

I contacted my host and they said to check my config for anything using Wordpress's redirect_canonical feature. I did and I can't find anything. The site is a multisite install.

Can someone point me in the right direction on how to solve this?

AlphaGolf_fr on "Adding a version number to CSS (and JS) files"

$
0
0

I'd like to append a build number to the CSS and JS file names of my plugin, instead of ?ver=3.8, so that the latest version of the files are sent to the browser with new releases of my plugin.

As per the Codex, I'm using this and it works fine, I do see the build number appended to my filename:
wp_enqueue_script( 'wp-symposium-toolbar', plugins_url( 'js/wp-symposium-toolbar.js', __FILE__ ), array( 'jquery' ), $wpst_buildnr );

But I'm using this and it doesn't work:
wp_enqueue_style( 'wp-symposium-toolbar_admin', $adminStyleUrl, array(), $wpst_buildnr );

Note that these variables are correctly set. Any suggestion why it doesn't work?

Thanks


Sam on "PHP script for Ipad PDF download"

$
0
0

I reviewed 10's of link with many offered soultions but have not made any inroad.
I have a simple php script

header("Pragma: public");
header("Expires: 0");
header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
header("Cache-Control: private",false);
if (!Operating_System_Is_IOS)
{
  header("Content-disposition: attachment; filename=gwcc-bylaws.pdf");
}
header("Content-type: application/pdf");
readfile("www.gwcc.org.nz/wp-content/uploads/2014/01/gwcc-bylaws.pdf");

that does not work. I also tried
header('Content-disposition: inline; filename=' .urlencode('gwcc-bylaws.pdf'));

instead. Still not working.
Does anyone know how to set up a PHP to have a file downloaded (or displayed) on Ipad?
Thanks.

Luke Janicke on "How to REALLY customise comment_form()?"

$
0
0

Using comment_form() you can customise most of the comment form using arguments or filters.

But what you can’t customise is the HTML that wraps the whole comment form.

Namely…

<div id="respond" class="comment-respond">
    <h3 id="reply-title" class="comment-reply-title"><small><a rel="nofollow" id="cancel-comment-reply-link" href="/1#respond" style="display:none;">Click here to cancel reply.</a></small></h3>
    <form action="http://www.mydomain.com/wp-comments-post.php" method="post" id="" class="comment-form">

[Here is where the customisable parts go. I filtered them out to see just what HTML output isn’t covered by arguments/filters.]

        <p class="form-submit">
            <input name="submit" type="submit" id="" value="" />
            <input type='hidden' name='comment_post_ID' value='1' id='comment_post_ID' />
            <input type='hidden' name='comment_parent' id='comment_parent' value='0' />
        </p>
    </form>
</div><!-- #respond -->

And this is the ONLY bit I want to change.
Are there some arguments or filters I don’t know about?
Maybe I just have to code the comment form manually…

Jason Ho on "Problem with last_post_redirect_load_plugin_textdomain!"

$
0
0

Hi,
i want to use last_post_redirect_load_plugin_textdomain on a plugin
but when i use code

$plugin_wp_content_plugin_dir = dirname(plugin_basename( __FILE__ ));

function last_post_redirect_load_plugin_textdomain() {
	global $plugin_wp_content_plugin_dir;
	load_plugin_textdomain('last-post-redirect', false, $plugin_wp_content_plugin_dir.'/lang/');
}
add_action('plugins_loaded', 'last_post_redirect_load_plugin_textdomain');

It didn't work.(echo __("111", 'last-post-redirect'); it should be 222)
My Wordpress is zh_TW and the file in lang/ is last-post-redirect-zh_TW.mo and last-post-redirect-zh_TW.po
HELP!

AidanG on "Creating a search query"

$
0
0

[Moved to Hacks forum]
Hello, I'm using a search mod called Advanced Search (read more on it here: http://wpadvancedsearch.com/) and essentially what I want to do is push my search from one page - the one that the user inputs their query - to a results page that takes the query and displays the results. Below I will post my php from each page.

For searchpage.php:
Here is the php:

<?php
/*
Template Name: Search Page
*/

session_start();

$args = array();
$args['form'] = array(
                    'action' => 'http://adgo.ca/uoftclubs/search-results/');
$args['wp_query'] = array(
                        'post_type' => 'post',
                        'order' => title);
$args['fields'][] = array(
                        'type' => 'meta_key',
                        'format' => 'checkbox',
                        'label' => 'Pick Your Campus:',
                        'compare' => 'IN',
                        'meta_key' => 'campus',
                        'values' => array('utsg' => 'UTSG', 'utsc' => 'UTSC', 'utm' => 'UTM'));
$args['fields'][] = array(
                        'type' => 'search',
                        'placeholder' => 'Search for a club!');
$args['fields'][] = array(
                        'type' => 'submit');

$my_search_object = new WP_Advanced_Search($args);
?>

and the relevant html:

<div class="main-search">
        <?php $my_search_object -> the_form(); $_SESSION['searchquery'] = $my_search_object; ?>
    </div>

and then for the search-results.php:
the php and html:

<div id="search-results">
        <?php
        session_start();
        $my_search = $_SESSION['searchquery'];
        $temp_query = $wp_query;
        $wp_query = $my_search->query();
        if ( have_posts() ):
            while ( have_posts() ): the_post(); ?>
                <article>
                    <h4><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h4>
                    <?php
                    if ($post->post_type == 'gs_field') the_field('description');
                    else the_excerpt();
                    ?>
                </article>
            <?php
            endwhile;
        else :
            echo '<p>Sorry, no clubs matched what you searched.</p>';
        endif;

        $my_search->pagination();

        $wp_query = $temp_query;
        wp_reset_query();
        ?>
    </div>

I have it set up so I created two pages in wordpress, one for each of these templates. You can see in the first page that I'm using the

$args['form'] = array(
                    'action' => 'http://adgo.ca/uoftclubs/search-results/');

to submit the form to my results page. I'm also using "$_SESSION" variables to carry "$my_search_object" to the next page.

The issue is, when I make the query and it redirects to my results page, the query itself doesn't carry over (i.e. no matter what I search every single post will appear on the results page). When I have the results page code on the same one as the query page, the search function works perfectly.

There is no doubt in my mind that there are some very poor errors made here. I'm learning so I'd appreciate being taught as you correct my mistakes.

Let me know if you need anything to help you figure out what's going wrong.

BloggingStudio on "Jetpack sharing - Error code: -32601"

$
0
0

Hi All,

I am trying to add facebook and Google plus connections in sharing settings. Getting below error message. Earlier, I had facebook connection but tried to change it. Now it doesn't work.

Error Message:
Something which should never happen, happened. Sorry about that. If you try again, maybe it will work. Error code: -32601

Steps I have already tried:
1. Re-installed latest Wordpress
2. Deactivate sharing from jetpack and reactivate back
3. Tried multiple times.
4. Also tried searching the error code on this forum and elsewhere.

this is my blog url, just in case you want to have a look:
http://www.technologynext.org/

Thanks in advance.
Subodh

Viewing all 8245 articles
Browse latest View live




Latest Images