Support » Fixing WordPress » php text widget code repair

  • I am trying to fix my php text widget code; it should display a scrolling box with contents from a URL on my site (http://worldesquire.com). It is on homepage and shows :404 error page not found.

    Existing code: <div><iframe src=”&lt:?php echo home_url ( ): ?>/wp-content/themes/lawfirm/content.html” width= “100%” height=”400″></iframe><div>

    URL I want to display: http://worldesquire.com/?page_id=302

    I need help doing it. I can’t write code. I don’t want to mess it up any more than i already have. Thanks.

Viewing 8 replies - 1 through 8 (of 8 total)
  • try:

    <div><iframe src="<?php echo home_url( ); ?>/wp-content/themes/lawfirm/content.html" width= "100%" height="400"></iframe><div>

    URL I want to display: http://worldesquire.com/?page_id=302

    in this case, try:

    <div><iframe src="<?php echo get_permalink(302); ?>" width= "100%" height="400"></iframe><div>
    Thread Starter worldesquire

    (@worldesquire)

    thanks alchymyth, but it didnt work. it took out, the iframe, the white background, the request box and other things. it also pushed up the bottom section of the page.

    are you sure you inserted the code into a php enabled content section?

    if not, try to avoid the php code and hardcode the iframe url;

    <div><iframe src="http://worldesquire.com/wp-content/themes/lawfirm/content.html" width= "100%" height="400"></iframe></div>

    (also corrected the closing div at the end of that line to </div>)

    Thread Starter worldesquire

    (@worldesquire)

    Alchymyth, I tried out the 1st code you sent again (<div><iframe src=”<?php echo home_url( ); ?>/wp-content/themes/lawfirm/content.html” width= “100%” height=”400″></iframe><div>) and the iFrame and contents did come on but 1)no white background (90% invisible)and the entire right side bar or column content was moved to the bottom of the left side bar or column.

    but 1)no white background (90% invisible)and the entire right side bar or column content was moved to the bottom of the left side bar or column.

    this is du to the wrong <div> at the end of the line; change that to a proper closing </div>;
    I corrected that already in my latest suggestion for hardcoding the link;

    here again the correct code:

    <div><iframe src="<?php echo home_url( ); ?>/wp-content/themes/lawfirm/content.html" width= "100%" height="400"></iframe></div>

    Thread Starter worldesquire

    (@worldesquire)

    alchymyth, your genius knows no bounds!!! It worked perfectly well and the iFrame is restored and looks way better than before. Thanks a million.

    Any suggestions about how i can change the background of the iFrame text to look like the “light blue background” in right side bar iFrames? Oh, and you are indeed a genius i do declare!

    try to add something like this to style.css:

    .hentry iframe { background:#f9f9f9; margin-top:20px; }

    or very specific for the one page only:

    #post-5.hentry iframe { background:#f9f9f9; margin-top:20px; }

    Thread Starter worldesquire

    (@worldesquire)

    alchymyth Thanks. Where do i find this “style.css” file?

Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘php text widget code repair’ is closed to new replies.