Forum Replies Created

Viewing 9 replies - 1 through 9 (of 9 total)
  • Forum: Hacks
    In reply to: Editing header.php
    Thread Starter JamiesWright

    (@jamieswright)

    I got it to work with
    $fp = fopen(get_stylesheet_directory().'/'."header.php","r");
    Thanks!

    Forum: Hacks
    In reply to: Editing header.php
    Thread Starter JamiesWright

    (@jamieswright)

    Hi,
    I’m getting this error from the code:

    Warning: filesize() [function.filesize]: stat failed for http://localhost:8888/wordpress/wp-content/themes/twentyeleven/header.php
    Warning: fread() [function.fread]: Length parameter must be greater than 0
    Warning: fopen(http://localhost:8888/wordpress/wp-content/themes/twentyeleven/header.php) [function.fopen]: failed to open stream: HTTP wrapper does not support writeable connections
    Warning: fwrite() expects parameter 1 to be resource, boolean given
    Warning: fclose() expects parameter 1 to be resource, boolean given

    From what I’ve read, the first 2 errors could be the cause of the directory not being writeable. I’m using MAMP for hosting, is this because I’m working on this locally?

    Forum: Hacks
    In reply to: Editing header.php
    Thread Starter JamiesWright

    (@jamieswright)

    thanks. but I’m still not quite sure how I would achieve that. would I be using fopen and fread as suggested by IridescentShadow above? would I encounter permission error by default if I use this approach? I’m only interested in editing the header.php file at this moment.

    Forum: Hacks
    In reply to: Editing header.php
    Thread Starter JamiesWright

    (@jamieswright)

    yes, I’ve considered that aspect, but I figured I would do it for the more popular themes and see how it goes. but I’ll first have to find out the way to edit the theme files directly from the plugin, which I think should be possible as there are WordPress filters to change the header image etc. I’m wondering if there are any actions/ filters for this, or do I have to get the theme file from the plugin, edit, and replace the original file.

    Forum: Hacks
    In reply to: Editing header.php
    Thread Starter JamiesWright

    (@jamieswright)

    I’m thinking if there would be any WordPress action or filter to achieve this as well? I have gone through quite a bit of research, but have not found anything related to such a topic which is why I think I may be going in the wrong direction.

    I understand that it will be easier if I was creating a theme option, which will enable me to add functions more easily. But I’m hoping to achieve that with a plugin, that has no control of the theme files. All the plugin will do is check for the user’s theme, and add the relevant code in the respective places. Thanks.

    Forum: Hacks
    In reply to: Editing header.php
    Thread Starter JamiesWright

    (@jamieswright)

    Thanks for your input. I have tried the code but it gives me this error

    ‘Warning: filesize() [function.filesize]: stat failed
    Warning: fread() [function.fread]: Length parameter must be greater than 0′

    I’m assuming that the directory is not right, or the permission is not set correctly. I’m not sure what is the default setting for writing in the theme files. I’m hoping that the plugin I’m writing should be able to edit the theme files without any permissions to be set, but I’m not sure if that’s possible.

    I think the code would go something like:
    if get_current_theme() == ‘Twenty-Eleven’
    Find </hgroup>
    Insert <?php theFunction() ?> after </hgroup>

    What would you think is the best way to achieve this?

    Thread Starter JamiesWright

    (@jamieswright)

    Hi,
    Thanks a lot. It’s working. ( ‘image_’ + $i ) was the wrong operator to use. Thanks!

    Thread Starter JamiesWright

    (@jamieswright)

    Thanks for your response. I believe the network setup is in the WP main site? And I do not have access to that. I’m only adding the files with ftp manager.

    I believe that the path is correct. index file is in the directory with css, and js folders. and from the index, css is called with css/style.css. Everything is working locally. The webpage is calling for the right path from the web server, but it gives an error 301 (moved permanently).

    I’m pretty positive it’s not a problem with the path, because I’ve tried placing the stylesheet in the same folder as the index, and linking it with just href=”style.css” but it still does not fetch the css file.

    What I actually meant to say is if it’s possible to upload a html site without running WP, onto a server running WP multisite? I’m have limited knowledge in this area, and I appreciate your input.

    Thread Starter JamiesWright

    (@jamieswright)

    I’m not sure if the .htaccess matches as I’m only using GoDaddy’s FTP file manager to access the files. But I’ve edited the .htaccess to this code.

    RewriteEngine On
    RewriteBase /
    RewriteRule ^index\.php$ – [L]

    # uploaded files
    RewriteRule ^([_0-9a-zA-Z-]+/)?files/(.+) wp-includes/ms-files.php?file=$2 [L]

    # add a trailing slash to /wp-admin
    RewriteRule ^([_0-9a-zA-Z-]+/)?wp-admin$ $1wp-admin/ [R=301,L]

    RewriteCond %{REQUEST_FILENAME} -f [OR]
    RewriteCond %{REQUEST_FILENAME} -d
    RewriteRule ^ – [L]
    RewriteRule ^([_0-9a-zA-Z-]+/)?(wp-(content|admin|includes).*) $2 [L]
    RewriteRule ^([_0-9a-zA-Z-]+/)?(.*\.php)$ $2 [L]
    RewriteRule . index.php [L]

    All the WordPress site themes are working properly. The only thing that isn’t working is the html site which I’ve uploaded. The url loads the index file, but could not locate the CSS directory, images and js directory too. An attempt to browse the css directory through the browser leads to an error page.

    Is it actually possible to upload a non-wordpress site into a server running WP multisite? I’m not sure what other information I could provide at the moment, please let me know if there’s anything I could provide. Thanks!

Viewing 9 replies - 1 through 9 (of 9 total)