Forum Replies Created

Viewing 15 replies - 211 through 225 (of 231 total)
  • I also had to put a php.ini file with the upload_max_filesize setting in the wp-admin directory.

    Since I’m on dial-up, I haven’t tested whether that’s the only necessary location or if the one in the uploads directory is also needed.

    My blog is in a subdirectory of my site, so WP’s behavior in this regard may be different.

    (I also included a post_max_size setting, but again don’t know if that was necessary — I can’t tell if WP is using the POST method.)

    Thread Starter ericr23

    (@ericr23)

    The link to show it not working is now using the get_posts() code, so it is working. The link to show it working is still using the loop code. If you want to see the loop code not working, insert the following into a page:

    <script language="JavaScript" src="https://www.wind-watch.org/documents/jsfeed.php" />
    Thread Starter ericr23

    (@ericr23)

    That last sentence should read, What could be preventing the original loop code, which works for 2 of the blogs, from working with the 3rd blog?

    I have had some success with this trick. Create a PHP page (say, jsfeed.php) in the root directory of your WordPress blog. It will be, however, called as a Javascript page. Depending on what information you want, the PHP is used to create the content for Javascript. For example, a simple list of titles:

    while (have_posts()) : the_post(); ?>
    document.write("<a href='<?php the_permalink() ?>'><?php the_title(); ?></a>");
    <?php endwhile; ?>

    This is called on an HTML page with:

    <script language="JavaScript" src="https://bloglocation/jsfeed.php" />

    Thanks, Otto42. $cat_obj->category_nicename works.

    Otto42, you’re quite right. I went with my option at first because I understood it better. Now that I’ve taken some time to learn about that wp_query business, though, it doesn’t seem to provide access to the slug for building a nonhierarchic link (guatemala instead of …/locations/south-america/guatemala/). Does it? I tried:

    $cat_obj = $wp_query->get_queried_object();
    $cat_slug = $cat_obj->cat_nicename;
    echo $cat_slug;

    but that returned nothing.

    Don’t take it personally, whooami. Of course I read about your plug-in, and I was grateful for your suggestion. But, as I noted on the other thread, it did not appear to do what I needed, which is simply to automatically provide the link to the category RSS feed on that category’s archive page. Your insistence only referred to the description already on your plug-in page without clarification or extra description to answer my question. Besides, adding a few lines of PHP to my index page is much better than adding another plug-in.

    Here’s what I came up with: the first is nonhierarchic, the second full hierarchy. I use te first to appear at the top of a category archive page.

    <a href="https://www.wind-watch.org/news/category/
    <?php
    $theCategory = single_cat_title("",false);
    $theCategorySlug = $wpdb->get_var("SELECT category_nicename FROM $wpdb->categories WHERE cat_name='$theCategory'");
    print $theCategorySlug;
    ?>
    /feed/rss2/"><font "style="background:#FF6600;color:#FFFFFF;font-size:92%;" "><b>&nbsp;RSS2&nbsp;</b></font> for this category</a>
    <a href="
    <?php
    $theCategory = single_cat_title("",false);
    $theCategoryID = $wpdb->get_var("SELECT cat_ID FROM $wpdb->categories WHERE cat_name='$theCategory'");
    $theCategoryLink = get_category_link($theCategoryID);
    print $theCategoryLink;
    ?>
    feed/rss2/"><font "style="background:#FF6600;color:#FFFFFF;font-size:92%;" "><b>&nbsp;RSS2&nbsp;</b></font> for this category</a>
    Thread Starter ericr23

    (@ericr23)

    Nice plug-in, but it doesn’t appear to do what I’m asking, which is, e.g., if the Rhode Island category page is displayed, a link for the Rhode Island category RSS feed is provided.

    I came up with the following. The first is what I will use. The second provides the link with the full category hierarchy.

    <a href="https://www.wind-watch.org/news/category/
    <?php
    $theCategory = single_cat_title("",false);
    $theCategorySlug = $wpdb->get_var("SELECT category_nicename FROM $wpdb->categories WHERE cat_name='$theCategory'");
    print $theCategorySlug;
    ?>
    /feed/rss2/"><font "style="background:#FF6600;color:#FFFFFF;font-size:92%;" "><b>&nbsp;RSS2&nbsp;</b></font> for this category</a>
    <a href="
    <?php
    $theCategory = single_cat_title("",false);
    $theCategoryID = $wpdb->get_var("SELECT cat_ID FROM $wpdb->categories WHERE cat_name='$theCategory'");
    $theCategoryLink = get_category_link($theCategoryID);
    print $theCategoryLink;
    ?>
    feed/rss2/"><font "style="background:#FF6600;color:#FFFFFF;font-size:92%;" "><b>&nbsp;RSS2&nbsp;</b></font> for this category</a>

    Suppose you want to provide a link to the RSS feed at the head of a category archive page. How would you generate that automatically?

    If not the feed link, then the URL of the specific category, to which “feed/rss2/” could be added. This can be done in The Loop with the_category().

    Or the category slug, which can be prefixed by “www.domain.com/blogdirectory/category/” and followed by “feed/rss2/”. This can be done in The Loop with get_the_category().

    Outside of The Loop, I get the name of the category with single_cat_title(), but that returns the name, not the slug (e.g., Rhode Island instead of rhode-island).

    Thread Starter ericr23

    (@ericr23)

    I found the options listed in the wp-include file and used the following settings: <?php wp_dropdown_categories('show_option_all=All categories&orderby=name&hierarchical=1'); ?>

    Thread Starter ericr23

    (@ericr23)

    That looks like a good suggestion, but I must be missing something about it. It appears to set the $olderrorlevel variable to the new error_reporting() level (0, to turn it off), not to the pre-existing level.

    Thread Starter ericr23

    (@ericr23)

    I’ve come up with this, which seems to work:

    <?php
    error_reporting(0);
    if (! mysql_connect('db1host', 'db1user', 'db1pass') || ! mysql_connect('db2host', 'db2user', 'db1pass'))
    {
    echo ("blah blah blah");
    include_once('nwwfooter.inc');
    echo ("</body></html>");
    die();
    }
    error_reporting(E_ALL ^ E_NOTICE); //default restored
    ?>

    I put it in a separate file called from the index page (<?php include_once(‘thefile.php’); ?>).

    Thread Starter ericr23

    (@ericr23)

    Well, I thought (slow on the uptake), why not do what wpdb.php is doing — just test the database connections?! I’m working that out now, using mysql functions. If anyone can save me some time, I sure would appreciate it.

    Thread Starter ericr23

    (@ericr23)

    My efforts continued, following many examples from the web, since I still have those pictures from the Coppermine database. But all my efforts were never able to capture the errors. Then I noticed that the PHP manual says, “The following error types cannot be handled with a user-defined function: E_ERROR, E_PARSE, E_CORE_ERROR, E_CORE_WARNING, E_COMPILE_ERROR, E_COMPILE_WARNING, and most of E_STRICT raised in the file where set_error_handler() is called.” So that’s why WordPress checks the database in a way that doesn’t raise a PHP error and it can display its own error page.

    Because both the Coppermine and the WordPress databases are likely to be down at the same time, I’ll rearrange the home page so that WordPress is called first (Coppermine lacking the database access check that WordPress does).

Viewing 15 replies - 211 through 225 (of 231 total)