Welcome to the GoFuckYourself.com - Adult Webmaster Forum forums.

You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community you will have access to post topics, communicate privately with other members (PM), respond to polls, upload content and access many other special features. Registration is fast, simple and absolutely free so please, join our community today!

If you have any problems with the registration process or your account login, please contact us.

Post New Thread Reply

Register GFY Rules Calendar Mark Forums Read
Go Back   GoFuckYourself.com - Adult Webmaster Forum > >
Discuss what's fucking going on, and which programs are best and worst. One-time "program" announcements from "established" webmasters are allowed.

 
Thread Tools
Old 01-10-2017, 11:44 PM   #1
incredibleworkethic
Confirmed User
 
incredibleworkethic's Avatar
 
Industry Role:
Join Date: Sep 2009
Posts: 1,502
Quick PHP question

$str .= '<div class="thumb-wrap"><a href="<?php the_field('url'); ?>">';


I know I'm a newb, but this line breaks my code.

Is there a way to call a field "URL" (advanced custom fields) within a string of PHP?

If I hardcode the URL instead of that line of PHP, I can achieve what I want but I'm pulling it from a post because each url is pulled from a custom field.
__________________

Panty Bay Cams - New Live Cam Site Concept!



"The Shift To Live Cams"

Chaturbate Cams Best Model Interaction
LiveJasmin Cams Best Revshare %


Live Cam Girls | Webcam Porn Reviews | LiveJasmin Review
Skype (preferred): JITContent
ICQ: 6260(six)8357

incredibleworkethic is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 01-10-2017, 11:51 PM   #2
Paul&John
Confirmed User
 
Paul&John's Avatar
 
Industry Role:
Join Date: Aug 2005
Location: YUROP
Posts: 6,531
try
Code:
$str .= '<div class="thumb-wrap"><a href="'.the_field('url').'">';
__________________
Paysites do sell, check out SkyWireCash!
Paul&John is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 01-10-2017, 11:59 PM   #3
EddyTheDog
Just Doing My Own Thing
 
EddyTheDog's Avatar
 
Industry Role:
Join Date: Jan 2011
Location: London, Spain, New Zealand, GFY - Not Croydon...
Posts: 15,276
Yeah - It's a quotes thing I'm sure - Need more coffee...
__________________
.
Vacares Web Hosting - I Love These Guys - Professional Dedicated Hosting - Daily backups for all clients...
EddyTheDog is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 01-10-2017, 11:59 PM   #4
incredibleworkethic
Confirmed User
 
incredibleworkethic's Avatar
 
Industry Role:
Join Date: Sep 2009
Posts: 1,502
Quote:
Originally Posted by Paul&John View Post
try
Code:
$str .= '<div class="thumb-wrap"><a href="'.the_field('url').'">';
it's now giving me the blog posts url instead of the custom field's data

Thanks so much for the quick response.
__________________

Panty Bay Cams - New Live Cam Site Concept!



"The Shift To Live Cams"

Chaturbate Cams Best Model Interaction
LiveJasmin Cams Best Revshare %


Live Cam Girls | Webcam Porn Reviews | LiveJasmin Review
Skype (preferred): JITContent
ICQ: 6260(six)8357

incredibleworkethic is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 01-11-2017, 12:05 AM   #5
incredibleworkethic
Confirmed User
 
incredibleworkethic's Avatar
 
Industry Role:
Join Date: Sep 2009
Posts: 1,502
This is me basically trying to link the featured image. Usually templates allow me to hardcode the featured image but this thing is deeply embedded.

PHP Code:
            $str .= '<div class="thumb-wrap"><a href="'.the_field('url').'">';
            if ( 
'gallery' == get_post_format$post->ID ) ) {
                
$str .= tn_moduleSingleSlider$post->ID$options['style'] );
            } elseif ( 
function_exists"has_post_thumbnail" ) && has_post_thumbnail$post->ID ) ) {
                
$featured_thumb tn_get_theme_option'tn_single_post_featured_image' );
                switch ( 
$featured_thumb ) {
                    case  
'full' :
                        
$str .= get_the_post_thumbnail$post->ID'native-image-thumb' );
                        break;
                    case 
'hide' :
                        
$str .= '';
                        break;
                    default:
                        
$str .= get_the_post_thumbnail$post->ID'blog_classic_thumb' );
                };
            }
            
$str .= '</a></div>';
        }; 
__________________

Panty Bay Cams - New Live Cam Site Concept!



"The Shift To Live Cams"

Chaturbate Cams Best Model Interaction
LiveJasmin Cams Best Revshare %


Live Cam Girls | Webcam Porn Reviews | LiveJasmin Review
Skype (preferred): JITContent
ICQ: 6260(six)8357

incredibleworkethic is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 01-11-2017, 12:09 AM   #6
EddyTheDog
Just Doing My Own Thing
 
EddyTheDog's Avatar
 
Industry Role:
Join Date: Jan 2011
Location: London, Spain, New Zealand, GFY - Not Croydon...
Posts: 15,276
Quote:
Originally Posted by incredibleworkethic View Post
it's now giving me the blog posts url instead of the custom field's data

Thanks so much for the quick response.
url will just give the current page address - Try using myURL or something like that...
__________________
.
Vacares Web Hosting - I Love These Guys - Professional Dedicated Hosting - Daily backups for all clients...
EddyTheDog is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 01-11-2017, 12:17 AM   #7
incredibleworkethic
Confirmed User
 
incredibleworkethic's Avatar
 
Industry Role:
Join Date: Sep 2009
Posts: 1,502
Quote:
Originally Posted by EddyTheDog View Post
url will just give the current page address - Try using myURL or something like that...
I'm using advanced custom fields, so they tell us to use the_field (calling the plugin's fields) and the field within the plugin called URL.

To simply my question, I've also added "url" as a custom field in the wordpress post. Any idea how to call on that within my original question?
__________________

Panty Bay Cams - New Live Cam Site Concept!



"The Shift To Live Cams"

Chaturbate Cams Best Model Interaction
LiveJasmin Cams Best Revshare %


Live Cam Girls | Webcam Porn Reviews | LiveJasmin Review
Skype (preferred): JITContent
ICQ: 6260(six)8357

incredibleworkethic is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 01-11-2017, 12:17 AM   #8
incredibleworkethic
Confirmed User
 
incredibleworkethic's Avatar
 
Industry Role:
Join Date: Sep 2009
Posts: 1,502
Quote:
Originally Posted by Paul&John View Post
try
Code:
$str .= '<div class="thumb-wrap"><a href="'.the_field('url').'">';
So here's a visual of what happened:

__________________

Panty Bay Cams - New Live Cam Site Concept!



"The Shift To Live Cams"

Chaturbate Cams Best Model Interaction
LiveJasmin Cams Best Revshare %


Live Cam Girls | Webcam Porn Reviews | LiveJasmin Review
Skype (preferred): JITContent
ICQ: 6260(six)8357

incredibleworkethic is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 01-11-2017, 12:24 AM   #9
EddyTheDog
Just Doing My Own Thing
 
EddyTheDog's Avatar
 
Industry Role:
Join Date: Jan 2011
Location: London, Spain, New Zealand, GFY - Not Croydon...
Posts: 15,276
Quote:
Originally Posted by incredibleworkethic View Post
I'm using advanced custom fields, so they tell us to use the_field (calling the plugin's fields) and the field within the plugin called URL.

To simply my question, I've also added "url" as a custom field in the wordpress post. Any idea how to call on that within my original question?
Change URL in the custom field to myURL (or whatever) - Then use that...

Still only had 2 coffees so could be wrong.....
__________________
.
Vacares Web Hosting - I Love These Guys - Professional Dedicated Hosting - Daily backups for all clients...
EddyTheDog is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 01-11-2017, 04:21 AM   #10
incredibleworkethic
Confirmed User
 
incredibleworkethic's Avatar
 
Industry Role:
Join Date: Sep 2009
Posts: 1,502
OK thanks I'll give it a try.
__________________

Panty Bay Cams - New Live Cam Site Concept!



"The Shift To Live Cams"

Chaturbate Cams Best Model Interaction
LiveJasmin Cams Best Revshare %


Live Cam Girls | Webcam Porn Reviews | LiveJasmin Review
Skype (preferred): JITContent
ICQ: 6260(six)8357

incredibleworkethic is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 01-11-2017, 09:04 AM   #11
incredibleworkethic
Confirmed User
 
incredibleworkethic's Avatar
 
Industry Role:
Join Date: Sep 2009
Posts: 1,502
Tried, still giving the same result.

Interesting problem for sure.
__________________

Panty Bay Cams - New Live Cam Site Concept!



"The Shift To Live Cams"

Chaturbate Cams Best Model Interaction
LiveJasmin Cams Best Revshare %


Live Cam Girls | Webcam Porn Reviews | LiveJasmin Review
Skype (preferred): JITContent
ICQ: 6260(six)8357

incredibleworkethic is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 01-11-2017, 09:12 AM   #12
redwhiteandblue
Confirmed Loser
 
redwhiteandblue's Avatar
 
Industry Role:
Join Date: Jun 2007
Location: Fucking on it
Posts: 1,940
Try echoing out the_field('url') to see what it produces. If it echoes out the url you want, the problem is elsewhere.
redwhiteandblue is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 01-11-2017, 09:40 AM   #13
Barry-xlovecam
It's 42
 
Barry-xlovecam's Avatar
 
Industry Role:
Join Date: Jun 2010
Location: Global
Posts: 15,576
$url needs to be the location of a read of the data maybe. Then $data1 becomes the string or array of the data.
__________________
Vive la résistance -- Carpe diem

Surfers: XloveCam.com >>> Affiliates: $€£ >> XloveCash.com
Sk.why.pe: barry_555_5 -- ICQ: three1896three617
Barry-xlovecam is online now   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 01-11-2017, 10:40 AM   #14
incredibleworkethic
Confirmed User
 
incredibleworkethic's Avatar
 
Industry Role:
Join Date: Sep 2009
Posts: 1,502
Anyone want a few bucks to make this happen for me? I can't get it to work and I really like the theme lol.
__________________

Panty Bay Cams - New Live Cam Site Concept!



"The Shift To Live Cams"

Chaturbate Cams Best Model Interaction
LiveJasmin Cams Best Revshare %


Live Cam Girls | Webcam Porn Reviews | LiveJasmin Review
Skype (preferred): JITContent
ICQ: 6260(six)8357

incredibleworkethic is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 01-11-2017, 10:46 AM   #15
Barry-xlovecam
It's 42
 
Barry-xlovecam's Avatar
 
Industry Role:
Join Date: Jun 2010
Location: Global
Posts: 15,576
PHP: file_get_contents - Manual

try this

file() - Reads entire file into an array
fgets() - Gets line from file pointer
fread() - Binary-safe file read
readfile() - Outputs a file
file_put_contents() - Write a string to a file
stream_get_contents() - Reads remainder of a stream into a string
stream_context_create() - Creates a stream context
$http_response_header
__________________
Vive la résistance -- Carpe diem

Surfers: XloveCam.com >>> Affiliates: $€£ >> XloveCash.com
Sk.why.pe: barry_555_5 -- ICQ: three1896three617
Barry-xlovecam is online now   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 01-11-2017, 10:48 AM   #16
sarettah
I'll make you famous...
 
sarettah's Avatar
 
Industry Role:
Join Date: Oct 2002
Location: Kansas City, Misery
Posts: 6,671
Quote:
Originally Posted by incredibleworkethic View Post
Anyone want a few bucks to make this happen for me? I can't get it to work and I really like the theme lol.
I sent you a pm.

.
__________________
Free Cams at Camfoxes.com
sarettah is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 01-11-2017, 11:11 AM   #17
marlboroack
So Fucking Fanned
 
Industry Role:
Join Date: Jul 2010
Location: ☣
Posts: 8,619
skype me really quick I'll do it
marlboroack is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 01-11-2017, 11:14 AM   #18
sarettah
I'll make you famous...
 
sarettah's Avatar
 
Industry Role:
Join Date: Oct 2002
Location: Kansas City, Misery
Posts: 6,671
Quote:
Originally Posted by marlboroack View Post
skype me really quick I'll do it
Yeah, like anyone would let you into their server.

Go away scammer.

.
__________________
Free Cams at Camfoxes.com
sarettah is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 01-11-2017, 11:26 AM   #19
Colmike7
(>^_^)b
 
Colmike7's Avatar
 
Industry Role:
Join Date: Dec 2011
Posts: 5,447
+1 for Sarettah.

If you still need help, email me and I'll figure it out later tonight.
__________________
High Stuff
Colmike7 is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 01-11-2017, 12:05 PM   #20
incredibleworkethic
Confirmed User
 
incredibleworkethic's Avatar
 
Industry Role:
Join Date: Sep 2009
Posts: 1,502
Quote:
Originally Posted by sarettah View Post
I sent you a pm.

.
Thanks to each and everyone for their help.

Sarettah is more than kind and good karma should be hitting him often in his lifetime!

He identified an error on my end, even though everyone's ideas were legit.

Thanks again!
__________________

Panty Bay Cams - New Live Cam Site Concept!



"The Shift To Live Cams"

Chaturbate Cams Best Model Interaction
LiveJasmin Cams Best Revshare %


Live Cam Girls | Webcam Porn Reviews | LiveJasmin Review
Skype (preferred): JITContent
ICQ: 6260(six)8357

incredibleworkethic is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 01-11-2017, 12:19 PM   #21
sarettah
I'll make you famous...
 
sarettah's Avatar
 
Industry Role:
Join Date: Oct 2002
Location: Kansas City, Misery
Posts: 6,671
Hey,

You r welcome but I should have been able to do that without having you send me the file. lol. I ran into something very similar a while back on something I was working on but forgot about it until I was looking at the file.

For the record in case anyone searches on this at some point:

The problem was that the wrong function was being used.

the_field() echoes the value in the field to the page.

get_field() pulls in the value.

So the change was changing the_field() to get_field() and it all worked as expected.

https://www.advancedcustomfields.com...ces/the_field/

.
__________________
Free Cams at Camfoxes.com
sarettah is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 01-11-2017, 01:23 PM   #22
RyuLion
 
RyuLion's Avatar
 
Industry Role:
Join Date: Mar 2003
Location: San Diego & South FL
Posts: 27,543
Quote:
Originally Posted by sarettah View Post
Hey,

You r welcome but I should have been able to do that without having you send me the file. lol. I ran into something very similar a while back on something I was working on but forgot about it until I was looking at the file.

For the record in case anyone searches on this at some point:

The problem was that the wrong function was being used.

the_field() echoes the value in the field to the page.

get_field() pulls in the value.

So the change was changing the_field() to get_field() and it all worked as expected.

https://www.advancedcustomfields.com...ces/the_field/

.
Woot woot!!
RyuLion is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 01-11-2017, 01:52 PM   #23
Bladewire
StraightBro
 
Bladewire's Avatar
 
Industry Role:
Join Date: Aug 2003
Location: Monarch Beach, CA
Posts: 23,983
Quote:
Originally Posted by sarettah View Post
Hey,

You r welcome but I should have been able to do that without having you send me the file. lol. I ran into something very similar a while back on something I was working on but forgot about it until I was looking at the file.

For the record in case anyone searches on this at some point:

The problem was that the wrong function was being used.

the_field() echoes the value in the field to the page.

get_field() pulls in the value.

So the change was changing the_field() to get_field() and it all worked as expected.

https://www.advancedcustomfields.com...ces/the_field/

.
You are awesome!
__________________


Skype: CallTomNow

Bladewire is online now   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 01-11-2017, 02:48 PM   #24
blackmonsters
Making PHP Work
 
blackmonsters's Avatar
 
Industry Role:
Join Date: Nov 2002
Location: 🌎🌅🌈🌇
Posts: 13,586
Quote:
Originally Posted by sarettah View Post
Hey,

You r welcome but I should have been able to do that without having you send me the file. lol. I ran into something very similar a while back on something I was working on but forgot about it until I was looking at the file.

For the record in case anyone searches on this at some point:

The problem was that the wrong function was being used.

the_field() echoes the value in the field to the page.

get_field() pulls in the value.

So the change was changing the_field() to get_field() and it all worked as expected.

https://www.advancedcustomfields.com...ces/the_field/

.

__________________
New Chaturbate and Bongacams Plugin For Wordpress

Works with all Wordpress themes so you get the design you want

Skype : econfirmpro
blackmonsters is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 01-11-2017, 03:59 PM   #25
Struggle4Bucks
So Fucking Wanked
 
Struggle4Bucks's Avatar
 
Industry Role:
Join Date: May 2011
Location: Lissabon
Posts: 2,944
When I read "php" I always get a headache...
Usually 2 weeks later another headache because of the invoice...

I'm out...
__________________
Retired at 39! What about you you whiny cunt?
Struggle4Bucks is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 01-11-2017, 04:09 PM   #26
incredibleworkethic
Confirmed User
 
incredibleworkethic's Avatar
 
Industry Role:
Join Date: Sep 2009
Posts: 1,502
This is the best part of gfy. I've met some great people here. Keep your head out of the shit threads and you're good. Poo threads by currentlysober are great too!
__________________

Panty Bay Cams - New Live Cam Site Concept!



"The Shift To Live Cams"

Chaturbate Cams Best Model Interaction
LiveJasmin Cams Best Revshare %


Live Cam Girls | Webcam Porn Reviews | LiveJasmin Review
Skype (preferred): JITContent
ICQ: 6260(six)8357

incredibleworkethic is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 01-11-2017, 06:41 PM   #27
sarettah
I'll make you famous...
 
sarettah's Avatar
 
Industry Role:
Join Date: Oct 2002
Location: Kansas City, Misery
Posts: 6,671
Quote:
Originally Posted by Struggle4Bucks View Post
When I read "php" I always get a headache...
Usually 2 weeks later another headache because of the invoice...

I'm out...
I can get rid of that 2 week later headache for you.

I bill in advance ;p

.
__________________
Free Cams at Camfoxes.com
sarettah is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 01-11-2017, 06:42 PM   #28
sarettah
I'll make you famous...
 
sarettah's Avatar
 
Industry Role:
Join Date: Oct 2002
Location: Kansas City, Misery
Posts: 6,671
Quote:
Originally Posted by incredibleworkethic View Post
Poo threads by currentlysober are great too!
GFY, your source for PHP and POO

.
__________________
Free Cams at Camfoxes.com
sarettah is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Post New Thread Reply
Go Back   GoFuckYourself.com - Adult Webmaster Forum > >

Bookmarks

Tags
$str, question, php, quick
Thread Tools




©2000-, AVN Media Network Inc



Powered by vBulletin
Copyright © 2000- Jelsoft Enterprises Limited.