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. |
|
Discuss what's fucking going on, and which programs are best and worst. One-time "program" announcements from "established" webmasters are allowed. |
|
Thread Tools |
12-03-2018, 06:37 AM | #1 |
Confirmed User
Industry Role:
Join Date: Jan 2011
Location: Somewhere in Germany
Posts: 815
|
Simple Wordpress / Php-code question. HELP
Hey guys.
My php skills are something around 8%, so I need a little help. In my theme, I want to add the following php code: Code:
if( function_exists('the_ad_placement') ) { the_ad_placement('placement_after_vote'); } Code:
$return .= "<div class='wp-hotornot-title'><h2>$header</h2></div>"; Code:
$return .= "<div class='wp-hotornot-title'>if( function_exists('the_ad_placement') ) { the_ad_placement('placement_after_vote'); }</div>"; The stuff before and after the edited line still works, so it does not mess everything up. But I don't know, why it's displayed as plain text. It's a php-file of a plugin I use, so of course, there is more code including php open and end snippet. Any help would be appreciated.
__________________
I know, my english is bad. But your german might be even worse |
12-03-2018, 08:04 AM | #2 |
l8r
Industry Role:
Join Date: Oct 2002
Posts: 13,507
|
$return .= "<div class='wp-hotornot-title'>";
if( function_exists('the_ad_placement') ) { $return .=the_ad_placement('placement_after_vote'); } $return .="</div>"; . |
12-03-2018, 09:50 AM | #3 |
Confirmed User
Industry Role:
Join Date: Dec 2016
Posts: 960
|
Delete
|
12-04-2018, 01:58 AM | #4 | |
Confirmed User
Industry Role:
Join Date: Jan 2011
Location: Somewhere in Germany
Posts: 815
|
Quote:
Note to myself: Buy sarettah a beer.
__________________
I know, my english is bad. But your german might be even worse |
|
12-05-2018, 02:19 AM | #5 |
Confirmed User
Industry Role:
Join Date: Jan 2011
Location: Somewhere in Germany
Posts: 815
|
Argh, did not work as expected.
Well, the code works, yeah, but it messes my layout up a little. Any chance to put the code Code:
if( function_exists('the_ad_placement') ) { the_ad_placement('placement_after_vote'); }
__________________
I know, my english is bad. But your german might be even worse |
12-09-2018, 08:59 AM | #6 | |
l8r
Industry Role:
Join Date: Oct 2002
Posts: 13,507
|
Quote:
You can very easily put it inside of <h2> tags. You can do: $return .= "<div class='wp-hotornot-title'><h2>"; if( function_exists('the_ad_placement') ) { $return .=the_ad_placement('placement_after_vote'); } $return .="</h2></div>"; Or: $return .= "<div class='wp-hotornot-title'>"; if( function_exists('the_ad_placement') ) { $return .="<h2> . the_ad_placement('placement_after_vote') . "</h2>"; } $return .="</div>"; The first one, the h2 tags will always be there even if there is nothing inside of them. The second one the h2 tags will only be there when the ad placement is there. Probably does not matter at all but could depending on what other code you have going on in there. . |
|
12-09-2018, 11:35 AM | #7 |
l8r
Industry Role:
Join Date: Oct 2002
Posts: 13,507
|
Ooops. Had a mistake in there, left out a quote mark.
Or: $return .= "<div class='wp-hotornot-title'>"; if( function_exists('the_ad_placement') ) { $return .="<h2>" . the_ad_placement('placement_after_vote') . "</h2>"; } $return .="</div>"; That's right now. . |