• Resolved bwhit

    (@bwhit)


    Day one for me and wordpress so sorry if this question is silly. I’m trying to place some flash in my template using document relative linking versus absolute linking. I’m using the swfobject code to place it and am finding that on my main page it works great like it’s supposed to. However, once you go a level or two down into the article and comment areas, the swf disappears.

    Is there some work around I missed? Thanks in advance.

Viewing 8 replies - 1 through 8 (of 8 total)
  • Make sure that the code that you’re placing isn’t in a file that isn’t globally shown, such as index.php. If you want it to show on all pages, you’ll need to put it in your header.php, footer.php, or sidebar.php (if your site has one) files.

    Thread Starter bwhit

    (@bwhit)

    It’s actually in the “header.php” file. “../swf/thefile.swf” takes me from “header.php” to where the file is located. Shows up perfectly fine on the main page but once you click through to an article it loses the embedded file. It displays the alternative content I specified which is just some random text at the moment. That is what lead me to be believe there’s some issue with the file paths.

    Oh, if you’re using “../”, it is an issue with the paths. It’s much better to use <?php get_stylesheet_directory() ?> for an absolute path. See if that solves your problem.

    Thread Starter bwhit

    (@bwhit)

    right. thanks, i’ll have to look up how to use that : ) wasn’t joking when i said this was my first day.

    Thread Starter bwhit

    (@bwhit)

    Yeah so, sorry, but I really don’t understand what that function is doing. Looked at the info here on wordpress along with looking at the “theme.php” file the function is in. I realize it’s just my lack of knowledge currently but it seems silly to me that there wouldn’t be an allowance for some standard directory linking. I just need to know how to point to a few files on my server w/out the need for a direct “www….”

    Moderator Ipstenu (Mika Epstein)

    (@ipstenu)

    🏳️‍🌈 Advisor and Activist

    I just need to know how to point to a few files on my server w/out the need for a direct “www….”

    The problem here is that I believe WordPress translates the relative link, based on what page you’re on.

    Example: From http://domain.com if you called ../swf/thefile.swf that file clearly doesn’t exist. You can’t go up from root 🙂 And from http://domain.com/foo/bar/index.php it would be looking in http://domain.com/foo/swf/thefile.swf

    See how that causes problems?

    So as Wex said, it’s better to use <?php get_stylesheet_directory() ?>

    You do this: <?php get_stylesheet_directory() ?>/swf/thefile.swf and that translates to http://domain.com/wordpress/wp-content/themes/yourtheme/swf/thefile.swf and every thing should work 🙂

    Thread Starter bwhit

    (@bwhit)

    yeah i understand all that was going on. i think i was just screwing myself up with not knowing where all this stuff lived. anyway, that really helped. it seems that “<?php bloginfo(‘stylesheet_directory’); ?>” did the trick though, but you got me off in the right direction! much appreciated.

    Thread Starter bwhit

    (@bwhit)

    Thanks for the help Ipstenu + Wex. Site’s up now, still a bit in progress, but moving forward nonetheless.

    http://brettastico.com/relaunch/randomthings/

Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘easy question i hope on document relative linking’ is closed to new replies.