Forum Replies Created

Viewing 11 replies - 1 through 11 (of 11 total)
  • Thread Starter dpimental2021

    (@dpimental2021)

    I think I know what to do. But, my biggest question is, if I have a page called “Research Articles”, and wanted to change the header title of the page, but just that page, how would I do that?

    I know I could use a filter, but how do I use a filter for just one page?

    Thread Starter dpimental2021

    (@dpimental2021)

    Here’s my issue. I have a page that I am posting to. But, I am posting to it from 4 different pages. I would like to update the header on the page to reflect which page I am posting from. Is there a way to set up a filter / hook for just that page, in my child theme, so it updates the header with that information?

    Thread Starter dpimental2021

    (@dpimental2021)

    Thanks Joy.
    Much appreciated. I got it to work πŸ™‚
    dpimental

    Thread Starter dpimental2021

    (@dpimental2021)

    Understood. So, all this is handled in the call back function of the shortcode, correct?

    Thread Starter dpimental2021

    (@dpimental2021)

    Here is the code from the wordpress page exactly how I tried using it.

    Use this page to find all teachings with a specific word or phrase in the title. Type a word or phrase into the box below and click <span style="font-size: .8em;">SUBMIT</span>.
    
    <div id="search"><form action="https://teachings.ssg.church/search-shortcode/" method="post">Search: <input name="term" type="text" /><input type="submit" value="Submit" /></form></div>
    <div id="teachListBrief">
    
    [addtitlesearch sterm=$_POST['term']]

    I have tried using just the $_POST and that didn’t work.
    The form is posting to the same page the shortcode is on.
    So, what am I doing wrong.

    If I put a literal string, such as “world”, it works.
    dpimental

    Thread Starter dpimental2021

    (@dpimental2021)

    I did write my own shortcode. The question is, how do I get form data into the call back function of the shortcode?

    Thread Starter dpimental2021

    (@dpimental2021)

    So, I use this code:

    // Add Shortcode
    function custom_shortcode() {
    
    }
    add_shortcode( '', 'custom_shortcode' );

    And the empty string ” I put in what I want the shortcode to be named.
    And the ‘custom_shortcode’ is the function being connected to the shortcode?
    dpimental

    Thread Starter dpimental2021

    (@dpimental2021)

    I just want to make sure I am following best practices. I found an example and want to make sure it’s correct.

    My goal is to create a plugin and pass a search term to it.
    The plugin would then connect to the database, search the database using the search term as criteria and return a formatted result set.

    So, in the plugin, I was going to do the following.

    1. do_action( ‘my_plugin_hook’ );

    2. add_action( ‘my_plugin_hook’, ‘my_plugin_echo’ );

    3. Create Function
    function my_plugin_echo( $url ){
    echo “The home url is $url”;
    }

    On my page, I was going to do the following.
    1. [my_plugin_hook]

    Am I doing this correctly?
    Can I use the “hook” on any page I want?

    dpimental

    Thread Starter dpimental2021

    (@dpimental2021)

    Much thanks for your assistance.
    I will try creating the plugin.
    dpimental

    Thread Starter dpimental2021

    (@dpimental2021)

    We have a plugin that allows us to enter php code on a wordpress page.
    So, I have some code that takes the input of the text box and uses it for the criteria of an sql query.

    So, I have this code on a page and I want to be able to reuse it, without having the same code on multiple pages.

    I was thinking if there was a way to store the code in one place and then simply call it on the pages it was needed that would be helpful.

    Is there a way to do that?
    dpimental

    Thread Starter dpimental2021

    (@dpimental2021)

    So, here is the actual situation.
    I am modifying pages for a church site.
    Currently, there are queries against recorded teachings (search by Title or by key word in the description or by Scripture reference.

    I am modifying the searches to also search written articles on the site, stored in the database.

    Here is what I wanted to do – and you can tell me “NO. Don’t do that!”.
    I want to take the function I have written on a page and take it out of the page and store it somewhere that I can call it. I would like to call it on the Teaching Search pages as well as call it from pages that only search the articles.

    What is the best method to achieve this?
    dpimental

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