Jeradin / acf-website-field

Advanced Custom Fields add-on for Website URLs, allows for website URL, title and a checkbox to open externally or internally
59 stars 14 forks source link

Need help with this #1

Closed ericaeide closed 12 years ago

ericaeide commented 12 years ago

Hi. I got everything uploaded to my site via ftp but I'm having trouble getting the code into my functions.php. Can you help me?

Jeradin commented 12 years ago

Hello, So you have the "acf-website-field" folder in your theme folder?

Once you have that, you need to edit your functions.php file and add the following line to activate the field for Advanced Custom Fields.

include_once( rtrim( dirname( FILE ), '/' ) . '/acf-website-field/website_url.php' );

Are you getting any error messages?

ericaeide commented 12 years ago

Yes, the folder is in my current theme folder. When I add that line, I get this:

Fatal error: Class 'acf_Field' not found in /home/content/67/9284167/html/wp-content/themes/shiny/acf-website-field/website_url.php on line 15

ericaeide commented 12 years ago

Whenever I add the code, I have to re-install my functions.php file via ftp because that's all my whole website displays...

www.morrisnilsenfuneralchapel.com

Jeradin commented 12 years ago

That error message suggests that you don't have Advanced Custom Fields plugin active I think but could be wrong on that.

http://wordpress.org/extend/plugins/advanced-custom-fields/

ericaeide commented 12 years ago

Ok. I am able to modify the fields and it shows up in my post editor, so I know it is activated...

I added the code to add a date & time field, and was able to get that one to work, but it was different looking code... I found that one here: http://soderlind.no/archives/2012/03/09/time-picker-field-for-advanced-custom-fields/

Does that help at all?

-----Original Message----- From: Geet Jacobs Sent: Monday, May 14, 2012 5:24 PM To: ericaeide Subject: Re: [ACF-URL-Field] Need help with this (#1)

That error message suggests that you don't have Advanced Custom Fields plugin active I think but could be wrong on that.

http://wordpress.org/extend/plugins/advanced-custom-fields/


Reply to this email directly or view it on GitHub: https://github.com/Jeradin/ACF-URL-Field/issues/1#issuecomment-5703838

ericaeide commented 12 years ago

Would you be willing to install this for me if I gave you my login info? I've tried everything :(

Jeradin commented 12 years ago

I apologize for this, I had the wrong includes in my functions instructions.

Can you download a fresh zip and use the following code in your functions.php file?

register_field('Website_field', dirname(File) . '/acf-website-field/website_url.php');

ericaeide commented 12 years ago

Thank you for checking and fixing it! I am so new at this that I assumed I was doing something wrong, lol. All is working now and it's exactly what I was looking for.

-----Original Message----- From: Geet Jacobs Sent: Tuesday, May 15, 2012 10:43 AM To: ericaeide Subject: Re: [ACF-URL-Field] Need help with this (#1)

I apologize for this, I had the wrong includes in my functions instructions.

Can you download a fresh zip and use the following code in your functions.php file?

register_field('Website_field', dirname(File) . '/acf-website-field/website_url.php');


Reply to this email directly or view it on GitHub: https://github.com/Jeradin/ACF-URL-Field/issues/1#issuecomment-5719173

ericaeide commented 12 years ago

Oops one more thing. When I add a url and check the box "open in a new window", it actually makes it open in the same window. If the box is unchecked, then it opens in a new window.

-----Original Message----- From: Geet Jacobs Sent: Tuesday, May 15, 2012 10:43 AM To: ericaeide Subject: Re: [ACF-URL-Field] Need help with this (#1)

I apologize for this, I had the wrong includes in my functions instructions.

Can you download a fresh zip and use the following code in your functions.php file?

register_field('Website_field', dirname(File) . '/acf-website-field/website_url.php');


Reply to this email directly or view it on GitHub: https://github.com/Jeradin/ACF-URL-Field/issues/1#issuecomment-5719173

Jeradin commented 12 years ago

Hey Eric,

Good catch. You can replace line 271 in the php file to correct this. if($value['internal'] == '1'){ $external = 'target="_blank"';};

What are your thoughts on this, either the default option for all website links is an external link (new window) and when adding the field to give the option to make it internal link?

Or is it better to have the link default as internal link with a user checking if its external?

ericaeide commented 12 years ago

Thanks again, I will add that in! :)

I would say the default should be external link/new window, with a choice to make it open in the same window... I guess just because most sites I've come across seem to do it that way.

Will you be writing any more plugins/custom fields to add on? I wish I knew how to make some!

Erica

-----Original Message----- From: Geet Jacobs Sent: Tuesday, May 15, 2012 4:38 PM To: ericaeide Subject: Re: [ACF-URL-Field] Need help with this (#1)

Hey Eric,

Good catch. You can replace line 271 in the php file to correct this. if($value['internal'] == '1'){ $external = 'target="_blank"';};

What are your thoughts on this, either the default option for all website links is an external link (new window) and when adding the field to give the option to make it internal link?

Or is it better to have the link default as internal link with a user checking if its external?


Reply to this email directly or view it on GitHub: https://github.com/Jeradin/ACF-URL-Field/issues/1#issuecomment-5728197

Jeradin commented 12 years ago

Erica, thanks for your thoughts, I agree and have updated the code to do the external link as default with a "Open in Same window" checkbox.

ericaeide commented 12 years ago

Great. But, question: my links aren't showing up at all now on my posts - I replaced the php file with the new release. Any ideas?

-----Original Message----- From: Geet Jacobs Sent: Wednesday, May 16, 2012 12:20 PM To: ericaeide Subject: Re: [ACF-URL-Field] Need help with this (#1)

Erica, thanks for your thoughts, I agree and have updated the code to do the external link as default with a "Open in Same window" checkbox.


Reply to this email directly or view it on GitHub: https://github.com/Jeradin/ACF-URL-Field/issues/1#issuecomment-5746513

ericaeide commented 12 years ago

Wondering if you saw my last message... After the code update, now my links aren't showing up on post pages.

Jeradin commented 12 years ago

Very sorry Erica, I didnt see your message, oops!

Fixed now, uploaded new file but you can just edit your php file.

Replace line 286 - if($value['url'] == '' ){

ericaeide commented 12 years ago

No problem, I had forgotten about it too, hehe. Still not showing up for me on the front end, even though I uploaded all new files. Can't figure out what's wrong.

Jeradin commented 12 years ago

Hmm, not able to duplicate the error. I am seeing any link I add in my post when I add <?php the_field('field_name') ?> Which I was not before hand I was not before editing the code.

ericaeide commented 12 years ago

Is there any way to download the old code? I'm so bummed! I've tried with new field names and everything.

Jeradin commented 12 years ago

If you can edit the php file we can get it back to before.

like 286 :
if($value['url'] == '' ){ return $value; };

remove all of that except the return $value; part, that should work.

I can email you an older file if you like also.

ericaeide commented 12 years ago

Ugh :( Now I get an error. Sorry about all this. I could PM you an admin login if you'd be willing to look at it - totally up to you, I appreciate all the help you've given me so far! Like I said I'm pretty new at this. 'memorial_link' is the url field that isn't showing up.

I don't have a single.php in my theme so all my code to display the fields is in the index.php... you'd just search for this: <?php echo get_field('memorial_link'); ?>


Jeradin commented 12 years ago

I dont mind logging in and checking it out for you.

PM away!

ericaeide commented 12 years ago

Thanks! Couldn't figure out how to PM so I sent a message thru your website link.

Jeradin commented 12 years ago

That should fix it up!

yay!

ericaeide commented 12 years ago

Nice, thank you for your help!! What had I done wrong? lol

-----Original Message----- From: Geet Jacobs Sent: Tuesday, May 29, 2012 5:54 PM To: ericaeide Subject: Re: [ACF-URL-Field] Need help with this (#1)

That should fix it up!

yay!


Reply to this email directly or view it on GitHub: https://github.com/Jeradin/ACF-URL-Field/issues/1#issuecomment-5998150