• Resolved Zdelete

    (@zdelete)


    Hi, i’d need to put the same content in 3 pages but i get syntax error ??
    Could you help me please?
    Here is the code:

    add_action ('__before_footer' , 'add_content_before_footer', 0);
    
    function add_content_before_footer() {
    	//checks if we are displaying the home page
    	if ( !tc__f( '__is_home' ) )
    		return;
    	?>
    		<div id="my-content-footer">
    			<div class="row-fluid">
    				<div class="span8 text-center">
    					<?php
    						printf('<h2>%1$s</h2>',
    						__('<iframe width="425" height="350" frameborder="0" scrolling="no" marginheight="0" marginwidth="0" src="https://maps.google.it/maps?f=q&source=s_q&hl=it&geocode=&q=Juliae+Felicis,+Via+Lepanto,+Pompei,+NA&aq=0&oq=juliae+&sll=39.029842,16.418107&sspn=3.127716,6.339111&ie=UTF8&hq=&hnear=&t=m&iwloc=A&ll=40.749856,14.50833&spn=0.006295,0.006295&output=embed"></iframe><small><a href="https://maps.google.it/maps?f=q&source=embed&hl=it&geocode=&q=Juliae+Felicis,+Via+Lepanto,+Pompei,+NA&aq=0&oq=juliae+&sll=39.029842,16.418107&sspn=3.127716,6.339111&ie=UTF8&hq=&hnear=&t=m&iwloc=A&ll=40.749856,14.50833&spn=0.006295,0.006295">Visualizzazione ingrandita della mappa</a></small>')
    						)
    					?>
    
    				</div>
    
    				</div>
    		</div>
    	<?php
    }

    [Moderator Note: Please post code & markup between backticks or use the code button. Your posted code may now have been permanently damaged by the forum’s parser.]

    I need to add the same content (in the same position) in other 2 pages. Thanks.

Viewing 5 replies - 1 through 5 (of 5 total)
  • What syntax error? I have no problem with your code.
    Maybe you can just add a semicolon here:

    spn=0.006295,0.006295&output=embed"></iframe>
    <small>Visualizzazione ingrandita della mappa</small>')
    ); //<-- this

    About having that in several pages, just change the conditional tag:
    if ( !tc__f( '__is_home' ) ) like:

    if ( ! ( tc__f( '__is_home' ) || is_page('PAGE_ID_or_PAGE_SLUG') || is_page('PAGE_ID_or_PAGE_SLUG') ) )
        return;

    hope this helps.

    Thread Starter Zdelete

    (@zdelete)

    Yes the problem was after my attempt to display in other pages… trying with your help, now, it shows the content only in home (i tried first with the page id and then with the name, but nothing…).

    if ( !tc__f( '__is_home' ) || is_page('29') )
    		return;
    	?>

    Well I said:

    if ( ! ( tc__f( '__is_home' ) || is_page('PAGE_ID_or_PAGE_SLUG') || is_page('PAGE_ID_or_PAGE_SLUG') ) )
        return;

    so, in your case:

    if ( ! ( tc__f( '__is_home' ) || is_page('29') ) )
        return;

    which isn’t the same thing..
    ??

    Thread Starter Zdelete

    (@zdelete)

    Oops! Yes now it works! Thank you very much!! ??

    You’re welcome ??

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Adding a block of content in pages’ is closed to new replies.