The Cache: Technology Expert's Forum
 
*
Welcome, Guest. Please login or register. October 16, 2019, 05:44:16 AM

Login with username, password and session length


Pages: [1]
  Print  
Author Topic: Wordpress plugin issues  (Read 2493 times)
jblz
n00b
*
Offline Offline

Posts: 3


View Profile
« on: October 09, 2009, 04:58:19 PM »

Hi,

I've signed up here after Perkisets shameful plug on Syndk8  Wink

Hello all. Apologies for amount of code posted below and also for getting straight to the point but after a few hours of getting absolutely no where I need post this and take a break ( Violin)


My first issue is this, the plugin I'm using (wpjobads) offers 3 functions in a seperate file which is supposed to make it easier for pulling data from the plugin and inserting into a theme yourself.

Here is what the function is looking for

Code:
wpjobads_template_job_listing(array(
        'enable_frontend' => $wpjobads_options['enable_frontend'],
        'jobs' => $jobs,
        'cat_ID' => $cat,
        'invite' => $invite,
        'widget_invite' => $widget_invite,
        'date_format' => $date_format,
        'gmt_offset' => $gmt_offset
    ));

and in the template file:

Code:
function wpjobads_template_job_listing($args)
{
    $colors = array('fulltime' => '#009900', 'parttime' => '#663366', 'freelance' => '#FE8433', 'internship' => '#000000');
    $labels = array('fulltime' => __('Full Time', 'wpjobads'), 'parttime' => __('Part Time', 'wpjobads'), 'freelance' => __('Freelance', 'wpjobads'), 'internship' => __('Internship', 'wpjobads'));
    extract($args);
?>

I understand this a stupid question but how do I use $args? I've tried replacing it with $cat = 1, and $cat ='1' but I'm sure thats a retarded thing to do.. PHP backs up my theory by giving me this

Quote
Warning: extract() [function.extract]: First argument should be an array in ../wpjobads/wpjobads-template.php on line 7

Can someone please suggest how I can go about setting $args?


I also have another issue   Undecided

The theme I'm using has a search box in the header to search through posts, I would like to change this to search through the job postings instead.

Here is the code for the search form:
Code:
<form method="get" id="searchform" action="<?php bloginfo('url'); ?>/">
 <input type="text" value="<?php the_search_query(); ?>" name="s"
  id="s" size="45" onfocus="this.value=''" />
 <input type="submit" id="searchsubmit" value="<?php _e('Search''arras'?>" />
</form>

And here is the search form that's used within the plugin for the job search widget

Code:
    <form method="get" action="<?php echo attribute_escape($search_url?>">
        <label class="hidden" for="jobsearch"><?php _e('Search Job:''wpjobads'?></label>
        <div>
            <input type="hidden" value="<?php echo attribute_escape($wpjobads_options['post_id']) ?>" name="page_id" />
            <input type="text" value="<?php echo attribute_escape($_GET['search']) ?>" name="search" id="search" />
            <input type="submit" value="<?php _e('Search Job''wpjobads'?>" id="jobsearchsubmit" />
        </div>
    </form>

How can I modify the headers search box to work like the job search?

I understand this is alot to ask for a member with one post but after most of the evening gone and very little accomplished I'm rather fed up and would greatly appreciate any insight/advice on this.

Thanks very much, and if you need extra code snippets to understand please ask.




« Last Edit: October 09, 2009, 05:00:04 PM by jblz » Logged

No links in signatures please
perkiset
Olde World Hacker
Administrator
Lifer
*****
Offline Offline

Posts: 10096



View Profile
« Reply #1 on: October 09, 2009, 05:22:58 PM »

Actually, I like to think of it as shameless rather than shameful Wink

Welcome to the Syndk8 JB.

I'll look your post over and comment in a bit.
Logged

It is now believed, that after having lived in one compound with 3 wives and never leaving the house for 5 years, Bin Laden called the U.S. Navy Seals himself.
perkiset
Olde World Hacker
Administrator
Lifer
*****
Offline Offline

Posts: 10096



View Profile
« Reply #2 on: October 09, 2009, 05:35:18 PM »

@ $args:

it's an array. The best way to see what's there is to do this: find somewhere that it is used correctly. Like, perhaps another theme template. Hack the code and add this:

die('<pre>' print_r($argstrue));

... this will kill your blog, but will output a formatted dump of that array and tell you want's there and how you can reference it. You could also do it right at the beginning of the extract() function ... then you'd see it in action clearly. Then you'll need to do something like:

$args['somevar'] = 1;
$args[0] = 'testing';

You'll essentially be filling the $args array with the values that the extract function is looking for.

@ your second question: bigger than what I've got bandwidth for. I'm not a WP theme/plugin guy, but that seems like an awfully large question...
« Last Edit: October 09, 2009, 05:37:01 PM by perkiset » Logged

It is now believed, that after having lived in one compound with 3 wives and never leaving the house for 5 years, Bin Laden called the U.S. Navy Seals himself.
jblz
n00b
*
Offline Offline

Posts: 3


View Profile
« Reply #3 on: October 09, 2009, 06:25:27 PM »

Thanks Perkiset. I just tried using that code but then my blog changed to a blank screen and nothing more.. possibly because of the way WP handles PHP? More likely because I'm using it in the wrong place.

I will try setting the array options manually in the morning - Please excuse my PHP illiteracy.. I've been learning on and off for a while now, but inbetween the 'off' and 'on' periods I tend to forget alot of even the basic structure/formatting 

About the second issue, what I've pasted above is just two search forms. One that searches through posts, and the other searches through jobs. I'm trying to modify the first one to do what the second one does.. I was hoping it wasn't going to be such a large question Sad haha

thanks again
Logged

No links in signatures please
perkiset
Olde World Hacker
Administrator
Lifer
*****
Offline Offline

Posts: 10096



View Profile
« Reply #4 on: October 09, 2009, 06:36:14 PM »

No worries J.

Re. the $args question: if it came back blank then look at the page source. If there's absolutely nothing there AT ALL then you've got a syntax error and the error reporting level is too high.

If you post the exact stuff (include a little above and below) of where you touched the code I'll look at it and make sure it's OK.

On reflection, the best possible place for you to do this is in the extract function. You should do something like this: (Note that the extract function may or may not look exactly like what I've done here - you'll need to do a little interpretation) You'll need to find which source file contains the extract function. From a shell, you'll be able to find it doing a grep 'function extract(' *.php in the sources directory.

function extract($args)
{
if (
$args) die('<pre>' print_r($argstrue));

// the rest of the original function should be here...
}

Your statement that you are PHP light will not help you with WP - the code is a total cluster fuck and written in the worst, worst possible way. Just even looking at your examples pisses me off (not you, them).
Logged

It is now believed, that after having lived in one compound with 3 wives and never leaving the house for 5 years, Bin Laden called the U.S. Navy Seals himself.
Earl Grey
Rookie
**
Offline Offline

Posts: 38



View Profile WWW
« Reply #5 on: October 09, 2009, 06:54:50 PM »

glad you found your solution

@perk , sorry dude i had to delete the thread because it sort of takes a lot away from syndk8 when someone mentions they are looking for something in syndk8 and you post a link elsewhere.

Sort of creates a loop which means it will never get better
Logged

eWFsbCBhIGJ1bmNoIG9mIG5lcmR5IGZhZ3MgaW4gaGVyZS4gc2VlIHdoYXQgaSB tZWFuPyB5b3Ug
ZXZlbiB1bmRlcnN0YW5kIHRoaXM=
perkiset
Olde World Hacker
Administrator
Lifer
*****
Offline Offline

Posts: 10096



View Profile
« Reply #6 on: October 09, 2009, 07:02:36 PM »

Have you ever even looked at how many times I reference the Syndk8 here?

That's crap man.
Logged

It is now believed, that after having lived in one compound with 3 wives and never leaving the house for 5 years, Bin Laden called the U.S. Navy Seals himself.
jblz
n00b
*
Offline Offline

Posts: 3


View Profile
« Reply #7 on: October 10, 2009, 09:07:54 AM »

Perk, thanks for you responses - I've slept about three times the recommended amount and it looks like I have work my work cut out for me this evening!

Also, with the Syndk8 thing - I believe you were in the right to post your link as here has much more of the info I was asking for, but if Earl is currently trying to build on those sections of his forum I can understand why he deleted it.
Logged

No links in signatures please
Pages: [1]
  Print  
 
Jump to:  

Perkiset's Place Home   Best of The Cache   phpMyIDE: MySQL Stored Procedures, Functions & Triggers
Politics @ Perkiset's   Pinkhat's Perspective   
cache
mart
coder
programmers
ajax
php
javascript
Powered by MySQL Powered by PHP Powered by SMF 1.1.2 | SMF © 2006-2007, Simple Machines LLC
Seo4Smf v0.2 © Webmaster's Talks


Valid XHTML 1.0! Valid CSS!