Forum Replies Created

Viewing 15 replies - 46 through 60 (of 75 total)
  • Thread Starter alexWP333

    (@alexwp333)

    I found the location of the archive-product.php file, under the templates folder.

    The only thing I need to know now is whether the code above is correct, or if your suggestion to “hook it in to one of the present actions” involves a different code snippet.

    Any code details you can provide would be appreciated.

    Thread Starter alexWP333

    (@alexwp333)

    Thanks James,

    I have two questions:

    First, where can I find the archive-product.php file? I looked in the Storefront parent folder, and just found an archive.php file. I also looked in various folders in plugins > woocommerce, but still don’t see the archive-product.php file.

    Second, when I do get to the archive-product.php file, would the code that I need to add be in this format?

    function add_visual_element () {
    if (is_search()){
    ... code to add visual element here ...
    }
    }
    add_action('posts_selection', 'add_visual_element');

    Thread Starter alexWP333

    (@alexwp333)

    It turns out that I forgot to activate the plugin for the new meta box. My weekend brain was on vacation.

    Thanks again for your help.

    Thread Starter alexWP333

    (@alexwp333)

    OK, I saw that I wasn’t being consistent with the parameters that I had entered. So, I took what you sent me, and put in the same parameters that I had started with, and together it worked.

    Many thanks! Couldn’t have done it without your help.

    <?php
    
        // Retrieves the stored value from the database
        $meta_value = get_post_meta( get_the_ID(), 'meta-text', true );
    
        // Checks and displays the retrieved value
        if( !empty( $meta_value ) ) {
            echo('<p style="color:red;">'.get_post_meta( get_the_ID(), 'meta-text', true ).'</p>');
        }
    
    ?>
    Thread Starter alexWP333

    (@alexwp333)

    The next thing that I’ve tried was to change the code in my single.php file from this:

    <?php
    
        // Retrieves the stored value from the database
        $meta_value = get_post_meta( get_the_ID(), 'meta-text', true );
    
        // Checks and displays the retrieved value
        if( !empty( $meta_value ) ) {
            echo $meta_value;
        }
    
    ?>

    to this:

    <?php
    
        // Retrieves the stored value from the database
        $meta_value = get_post_meta( get_the_ID(), 'meta-text', true );
    
        // Checks and displays the retrieved value
        if( !empty( $meta_value ) ) {
            echo('<p style="color:red;">'.get_post_meta( get_the_ID(), 'user_text_field').'</p>');
        }
    
    ?>

    Now my output text goes to red, which is what I was trying to get to work, but the output itself gives the word “Array” instead of the words that I typed into the input field of the custom metabox.

    Thread Starter alexWP333

    (@alexwp333)

    Thanks. This is my first time setting up a custom metabox, so please bear with me. As a test I tried adding a CSS to change the font color for the output to red.

    In particular, I tried changing this:

    function prfx_meta_callback( $post ) {
        wp_nonce_field( basename( __FILE__ ), 'prfx_nonce' );
        $prfx_stored_meta = get_post_meta( $post->ID );
        ?>
    
            <label for="meta-text" class="prfx-row-title"><?php _e( 'Example Text Input', 'prfx-textdomain' )?></label>
            <input type="text" name="meta-text" id="meta-text" value="<?php if ( isset ( $prfx_stored_meta['meta-text'] ) ) echo $prfx_stored_meta['meta-text'][0]; ?>" />
    
        <?php
    }

    to this:

    function prfx_meta_callback( $post ) {
        wp_nonce_field( basename( __FILE__ ), 'prfx_nonce' );
        $prfx_stored_meta = get_post_meta( $post->ID );
        ?>
    
            <label for="meta-text" class="prfx-row-title"><?php _e( 'Example Text Input', 'prfx-textdomain' )?></label>
            <input type="text" name="meta-text" id="meta-text" value="<?php if ( isset ( $prfx_stored_meta['meta-text'] ) ) echo ('<p style="color:red;">'.$prfx_stored_meta['meta-text'][0].'</p>'); ?>" />
    
        <?php
    }

    I’m either putting the code that you sent me in the wrong file altogether, or my syntax is incorrect, because the browser’s not yet displaying the output text in red.

    Forum: Plugins
    In reply to: feeds not showing
    Thread Starter alexWP333

    (@alexwp333)

    Can anyone help me with this?

    Thread Starter alexWP333

    (@alexwp333)

    Thanks Allen,
    I’m going to open up a new topic about this last question.

    Thread Starter alexWP333

    (@alexwp333)

    Does this mean that the plugin isn’t designed to output multiple feeds from a single blog … a blog which has posts that are assigned to different categories?

    Also, would this cause the web page in question to not display any of the feeds on the first browser viewing of the day, but to display them only after refreshing the browser?

    Thread Starter alexWP333

    (@alexwp333)

    I called my host and they told me that I need turn off a caching button while working on the site. They said that, otherwise, I would make a style change, and it might not show up on the site for a few hours!

    I didn’t realize that this was even necessary. I guess it’s one extra step in the process, but at least I now know what the problem was.

    I wouldn’t have been able to figure this out without you.

    Many thanks Stephen!

    Thread Starter alexWP333

    (@alexwp333)

    No error messages in the Appearance Editor. It just said “file edited successfully”.

    Thread Starter alexWP333

    (@alexwp333)

    When I go to the style.css file in the Appearance Editor of my WordPress Admin I see this:

    #bookPoetryUL {
      margin-left: 0px;
      height: 880px;
    }
    #bookTextbookUL {
      margin-left: 0px;
      height: 445px;
    }

    And when I inspect the site my browser (using Firebug) I see this:

    #bookPoetryUL {
        height: 880px;
    }
    #bookTextbookUL {
        height: 440px;
        margin-left: 0;
    }
    Thread Starter alexWP333

    (@alexwp333)

    That’s what I don’t understand. There are 2 CSS properties in the style.css file, so it should be showing both of those properties on the site. This is the first time I’ve run into something like this.

    I’m completely stumped.

    Thread Starter alexWP333

    (@alexwp333)

    yes, you can see the site at anniefinch.com/AnnieFinchTestSite

    the page that’s giving me trouble is at anniefinch.com/AnnieFinchTestSite/books-2

    the actual HTML in question is:

    <ul id="bookPoetryUL"> content goes here </ul>

    the actual CSS in the style.css file is:

    #bookPoetryUL {
      margin-left: 0px;
      height: 880px;
    }

    When I check the CSS in my browser’s Firebug I see:

    #bookPoetryUL {
      height: 880px;
    }

    So the margin-left property is missing altogether.

    On the same page I have a second

      that has the same basic code:

    <ul id="bookTextbookUL"> content goes here </ul>

    and the CSS in the style.css file for this second

      is:

    #bookTextbookUL {
      margin-left: 0px;
      height: 445px;
    }

    When I view the CSS for this second

      in Firebug, both the margin-left:0px, and the height:445px; are showing up fine.

    Thread Starter alexWP333

    (@alexwp333)

    Yes, in the Edit Post page I am using category filters. I’ve set it up this way because I want to assign certain posts to display on one of the feeds that are on the Home page, and other posts too display on another of the feeds that are on the Home page.

    Is this what you’re referring to with regard to your question as to whether I’m using category filters?

Viewing 15 replies - 46 through 60 (of 75 total)