Wordpress Themes - WP Forum at BFA

Wordpress Themes - WP Forum at BFA (http://forum.bytesforall.com/index.php)
-   Plugins & Atahualpa (http://forum.bytesforall.com/forumdisplay.php?f=16)
-   -   [SOLVED] php code banner inside bfa_post_parts.php (http://forum.bytesforall.com/showthread.php?t=23852)

denisrobinzon Dec 30, 2016 03:36 AM

[SOLVED] php code banner inside bfa_post_parts.php
 
1 Attachment(s)
Hello and HNY. Please tell me. How to correctly add the banner code so that it appears in the center of the page and only single post page (not excerpts)?

PHP Code:

<?php codbanner(1); ?>

I'm add here in bfa_post_parts.php:

PHP Code:

//        $bfa_toss = the_title('','',false); 
    // in those cases
[b]<div align="center">codbanner(1);</div> [/b]
    $bfa_temp_title = get_the_title();
    if ( $bfa_temp_title == '' ) { ?>
        <a href="<?php the_permalink() ?>" rel="bookmark" title="<?php _e('Permanent Link','atahualpa')?>">Permalink</a><?php 
<div align="center">codbanner(1);</div>

but, after that, the wordpress crashes.

Then, I'm add only the string:
codbanner(1);
PHP Code:

    // in those cases
    
codbanner(1);
    
$bfa_temp_title get_the_title();
    if ( 
$bfa_temp_title == '' ) { ?> 

I saw the following:

Attachment 2780

but I need the middle and only single post page?!

juggledad Dec 30, 2016 10:11 AM

You can't just mix HTML and PHP you have to escape it properly. Do a google search to see how it is done.

denisrobinzon Jan 3, 2017 10:44 AM

1 Attachment(s)
Quote:

Originally Posted by juggledad (Post 114692)
You can't just mix HTML and PHP you hae to escape it properly. Do a google search to see how it is done.

Ok, I'm found how to add a test message in single page, above the title of the post.
PHP Code:

if (is_single()) {
echo 
'<div align="center">Text in center</div>';} 

and received the following result (in attach):
Attachment 2781
but how, now add php code with banner instead of 'Text in center'
I tried the following option:
PHP Code:

if (is_single()) {
echo '<div align="center"><?php codbanner(1); ?></div>';}

but without result, please help!!!?

juggledad Jan 3, 2017 04:42 PM

Now you trying to escape into PHP while in PHP. Try this:
HTML Code:

if (is_single()) {
echo '<div align="center">'; codbanner(1); echo '</div>';}


denisrobinzon Jan 4, 2017 04:29 AM

Quote:

Originally Posted by juggledad (Post 114706)
Now you trying to escape into PHP while in PHP. Try this:
HTML Code:

if (is_single()) {
echo '<div align="center">'; codbanner(1); echo '</div>';}


Great, work fine now!!!! Thank you for learning!


All times are GMT -6. The time now is 02:58 PM.

Powered by vBulletin® Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.