Forum Replies Created

Viewing 15 replies - 16 through 30 (of 40 total)
  • Thread Starter WPOso

    (@wordpress-oso)

    Thanks.

    Thread Starter WPOso

    (@wordpress-oso)

    Sorry, I forgot to add that I’m using the theme twenty seventeen.

    Forum: Fixing WordPress
    In reply to: Unwanted Comments
    Thread Starter WPOso

    (@wordpress-oso)

    Weird; I checked to see if I had already posted, but I didn’t see any post at all, so I figured it had been rejected.

    Anyway, I think I am using Aksismet. I’ll check out WordPress Zero Span. Thanks.

    Forum: Fixing WordPress
    In reply to: Adding Polls
    Thread Starter WPOso

    (@wordpress-oso)

    Good tips; thanks.

    Thread Starter WPOso

    (@wordpress-oso)

    Thanks for the tips. I didn’t even know my WordPress site used AJAX.

    Thread Starter WPOso

    (@wordpress-oso)

    Thanks, I’ll check those out.

    Thread Starter WPOso

    (@wordpress-oso)

    I found a couple custom fields plugins. Can you list any plugins that help you include PHP files? Thanks.

    Thread Starter WPOso

    (@wordpress-oso)

    Actually, this turned into two problems, one of which I just solved. As you suggested, I created a new folder – mu-plugins – put my file inside it, and it does autoload.

    However, I still need to know how to write includes.

    The file inside my mu-plugins folder is fine for creating echo values, but if I want to actually display something at the beginning of an article or at the bottom of the page, then I need to be able to insert an include in the proper location.

    Also, I’m eventually going to put some database-driven reference tables on some of my pages, so I’ll have to include separate files that feature queries and a lot of styling, etc.

    Anyway, what’s the proper way to write an include?

    Thread Starter WPOso

    (@wordpress-oso)

    Thanks.

    Thread Starter WPOso

    (@wordpress-oso)

    That will vary. On the county pages, the post content will probably consist entirely of a block of text defined in an include.

    In other cases, I may make posts that look like this…

    This is an article about a species of antelope, the impala.
    $Info
    Impala are popular symbols.

    $Info could then be replaced by something I want to display on all antelope pages.

    In other cases, there might be a block of text that I want to display at the end of every article. It’s really all over the map.

    EDIT:

    It would probably make sense to include TWO files, one before my post content and the other at the end.

    The first could be used to 1) display images or content that I want to display before my post and 2) define PHP variables that I want to echo in the body of my post. The second would then display items I want to display at the end of the post, such as links to related articles.

    Thread Starter WPOso

    (@wordpress-oso)

    It will probably have a series of echo values and PHP switches. For example…

    $CountyIntro = 'If you live in '.$MyCounty.', we want to hear from you.'

    Then I could paste $CountryIntro into a post and use str_replace(‘$CountyIntro’, $CountyIntro, $Article)

    Or I could create a switch based on URL’s:

    switch($MyURL)
    {
     case 'adams-country':
     echo $CountyIntro;
     break;
     default:
     break;
    }

    The file could also feature includes to additional include files as needed.

    Thread Starter WPOso

    (@wordpress-oso)

    OK, I copied functions.php into my child theme folder, added that code and uploaded, but the page still displays nothing.

    I think the problem is it isn’t “connecting” with my custom field. The name of the custom field was “County Intro.” I just changed it to “county,” but it still doesn’t work.

    Thread Starter WPOso

    (@wordpress-oso)

    OK, the shorcode page offers the following example:

    //[foobar]
    function foobar_func( $atts ){
    	return "foo and bar";
    }
    add_shortcode( 'foobar', 'foobar_func' );

    If my custom field is titled “County Intro,” then how would I modify that? Something like this?:

    //[foobar]
    function foobar_func( $atts ){
    	return "County Intro";
    }
    add_shortcode( 'foobar', 'foobar_func' );

    Also, I don’t see where they explain WHERE to paste the code.

    Forum: Fixing WordPress
    In reply to: PHP Includes 101
    Thread Starter WPOso

    (@wordpress-oso)

    Thanks.

    Thread Starter WPOso

    (@wordpress-oso)

    Thanks.

Viewing 15 replies - 16 through 30 (of 40 total)