• Hi.
    i write some plugin
    and have function that i want run when some one click on url
    i tried use add_action and later do_action

    but they run my function when the page is loading
    but i need run it then some one CLICK on url
    how i can do this ?

Viewing 3 replies - 1 through 3 (of 3 total)
  • You can’t do that with PHP, unless you embed the info in the link URL (like http://example.com/?do=stuff) and with your plugin detect that info.

    Another aproach would be to use javascript: you can use jQuery’s click() event, coupled with some AJAX.

    Thread Starter zx-spectrum

    (@zx-spectrum)

    i also try this
    i write searh2.php file what run then user click on url

    <
    $category == $_GET['c'];
    		<h2 class="pagetitle">Search results</h2>
    		<?php
    		$category = wp_specialchars($c, 1);
    		do_action(do_search_by_category, $category ); ?>

    and put it into themes\default dir that is current active
    and put code like
    <a href="search2.php?c=1">Cat 1</a>" into sidebar

    bun then i click on this url wordpress write “file not found”

    i tried copy this file into www folder
    but when search2.php run its dont see any plugin or wordpress functions

    Thread Starter zx-spectrum

    (@zx-spectrum)

    what i do wrong ?
    some help plz 🙁

Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘How to using plugin function on main page’ is closed to new replies.