[BUSINESS] php... I'm stuck!

Discussion Of All Legal Topics Is Fine Anything Goes. Be Respectful of Others. No Personal Information or Attacks.
All Traffic, Link, Banner, Push Notification and Advertising, Offers & Requests Here,.
Domains & Websites For Sale and Requests Here.
Keep One thread per person & No More Than 1 Weekly Bump.
Post Reply
User avatar
HeidiHoe
Verified Member
Verified Member
Posts: 1653
Joined: February 3rd, 2018, 12:20 pm
Title: Resident Genius

[BUSINESS] php... I'm stuck!

#1

Post by HeidiHoe » March 7th, 2019, 11:52 pm

I slapped a little plugin together for displaying chaturbate WL cams using shortcode (with parameters) in pages or txt widgets. It works great except that the plugin content insists on displaying 1st in the content and above the widget title. I've scoured wordpress.org looking for a fix and I can't seem to figure out how to fix it. One suggestion I saw was to wrap the add_shortcode(... in add_action('init',... . Well it didn't work. I can use it as is but it's driving me batshit crazy. I've spent several days now screwing with it and I can't figure out wtf is doing this. Does anyone here have any suggestions on what I need to do to fix this? The plugin is running right now at https://nerdalert.site/cams/
The Fourth Turning Is Here

Colmike7
Banned
Banned
Posts: 1670
Joined: May 23rd, 2018, 12:21 pm
Title: (>^-^)b

#2

Post by Colmike7 » March 8th, 2019, 12:10 am

So, since you're using short codes, I'm going to guess that you're also using things like echo.
In WP fine print:

Code: Select all

Note that the function called by the shortcode should never produce output of any kind. Shortcode functions should return the text that is to be used to replace the shortcode. Producing the output directly will lead to unexpected results. This is similar to the way filter functions should behave, in that they should not produce expected side effects from the call, since you cannot control when and where they are called from. 
So, let's say there are echos in the shortcode, that will a lot of times cause WP to calculate those before the header.
To fix this, you have to make echos in the function variables, then return like "return $html;"




User avatar
HeidiHoe
Verified Member
Verified Member
Posts: 1653
Joined: February 3rd, 2018, 12:20 pm
Title: Resident Genius

#3

Post by HeidiHoe » March 8th, 2019, 12:16 am

Colmike7 wrote: ↑
March 8th, 2019, 12:10 am
So, since you're using short codes, I'm going to guess that you're also using things like echo.
In WP fine print:

Code: Select all

Note that the function called by the shortcode should never produce output of any kind. Shortcode functions should return the text that is to be used to replace the shortcode. Producing the output directly will lead to unexpected results. This is similar to the way filter functions should behave, in that they should not produce expected side effects from the call, since you cannot control when and where they are called from. 
So, let's say there are echos in the shortcode, that will a lot of times cause WP to calculate those before the header.
To fix this, you have to make echos in the function variables, then return like "return $html;"
AHA!!! That's got to be it. There's a couple of echos. To brain dead to figure out how to correct this right now but I get what you're saying and it makes sense. Cool :)
The Fourth Turning Is Here

Colmike7
Banned
Banned
Posts: 1670
Joined: May 23rd, 2018, 12:21 pm
Title: (>^-^)b

#4

Post by Colmike7 » March 8th, 2019, 12:20 am

Cool, let me know if that doesn't fix it and we'll figure it out. :)




User avatar
HeidiHoe
Verified Member
Verified Member
Posts: 1653
Joined: February 3rd, 2018, 12:20 pm
Title: Resident Genius

#5

Post by HeidiHoe » March 8th, 2019, 1:02 am

Colmike7 wrote: ↑
March 8th, 2019, 12:20 am
Cool, let me know if that doesn't fix it and we'll figure it out. :)
By George that was it! I tried it and Widget title is now above. I guess I'll be cleaning out the rest of the echos. You're a life saver. I should have posted several days ago. Thanks!!!
The Fourth Turning Is Here

Colmike7
Banned
Banned
Posts: 1670
Joined: May 23rd, 2018, 12:21 pm
Title: (>^-^)b

#6

Post by Colmike7 » March 8th, 2019, 2:25 am

HeidiHoe wrote: ↑
March 8th, 2019, 1:02 am
Colmike7 wrote: ↑
March 8th, 2019, 12:20 am
Cool, let me know if that doesn't fix it and we'll figure it out. :)
By George that was it! I tried it and Widget title is now above. I guess I'll be cleaning out the rest of the echos. You're a life saver. I should have posted several days ago. Thanks!!!
Awesome! Glad it worked :)




User avatar
HeidiHoe
Verified Member
Verified Member
Posts: 1653
Joined: February 3rd, 2018, 12:20 pm
Title: Resident Genius

#7

Post by HeidiHoe » March 8th, 2019, 2:45 am

Colmike7 wrote: ↑
March 8th, 2019, 2:25 am
Awesome! Glad it worked :)
It's already fixed! Thanks again.
The Fourth Turning Is Here

User avatar
AlexO
Verified Member
Verified Member
Posts: 6396
Joined: February 10th, 2018, 5:37 pm
Title: I like Celebrities

#8

Post by AlexO » March 9th, 2019, 8:43 am

I learned this from this thread
Give me celebrity porn :twisted:

User avatar
HeidiHoe
Verified Member
Verified Member
Posts: 1653
Joined: February 3rd, 2018, 12:20 pm
Title: Resident Genius

#9

Post by HeidiHoe » March 12th, 2019, 4:24 pm

Colmike7 wrote: ↑
March 8th, 2019, 2:25 am
HeidiHoe wrote: ↑
March 8th, 2019, 1:02 am
Colmike7 wrote: ↑
March 8th, 2019, 12:20 am
Cool, let me know if that doesn't fix it and we'll figure it out. :)
By George that was it! I tried it and Widget title is now above. I guess I'll be cleaning out the rest of the echos. You're a life saver. I should have posted several days ago. Thanks!!!
Awesome! Glad it worked :)
You've got mail...
The Fourth Turning Is Here

STICK
Verified Member
Verified Member
Posts: 178
Joined: February 25th, 2018, 7:28 am

#10

Post by STICK » March 13th, 2019, 9:30 am

Wher do you go to learn the simple stuff to be able to do your own php modifications to a page.




User avatar
HeidiHoe
Verified Member
Verified Member
Posts: 1653
Joined: February 3rd, 2018, 12:20 pm
Title: Resident Genius

#11

Post by HeidiHoe » March 13th, 2019, 10:02 am

STICK wrote: ↑
March 13th, 2019, 9:30 am
Wher do you go to learn the simple stuff to be able to do your own php modifications to a page.
w3schools.com
The Fourth Turning Is Here

Colmike7
Banned
Banned
Posts: 1670
Joined: May 23rd, 2018, 12:21 pm
Title: (>^-^)b

#12

Post by Colmike7 » March 13th, 2019, 1:11 pm

STICK wrote: ↑
March 13th, 2019, 9:30 am
Wher do you go to learn the simple stuff to be able to do your own php modifications to a page.
Not really sure. But, making my first website when I was like 10 in the late 90s plus working with people from Chemical Abstracts on web design growing up and getting CISCO certified in web development in high school helped a lot. I never formally learned PHP, just learned by looking at things and looking up what I needed to know.




misterporn
Verified Member
Verified Member
Posts: 879
Joined: May 24th, 2018, 4:21 pm

#13

Post by misterporn » March 15th, 2019, 12:31 pm

I would love to be stuck in a closet with




User avatar
HeidiHoe
Verified Member
Verified Member
Posts: 1653
Joined: February 3rd, 2018, 12:20 pm
Title: Resident Genius

#14

Post by HeidiHoe » March 15th, 2019, 1:26 pm

misterporn wrote: ↑
March 15th, 2019, 12:31 pm
I would love to be stuck in a closet with
lol
The Fourth Turning Is Here

minkal
Verified Member
Verified Member
Posts: 139
Joined: October 2nd, 2018, 6:57 pm

#15

Post by minkal » March 17th, 2019, 2:00 pm

HeidiHoe wrote: ↑
March 13th, 2019, 10:02 am
STICK wrote: ↑
March 13th, 2019, 9:30 am
Wher do you go to learn the simple stuff to be able to do your own php modifications to a page.
w3schools.com
One of the best places to learn




[BUSINESS] php... I'm stuck!

Post Reply