Title: ext103's Replies | WordPress.org

---

# ext103

  [  ](https://wordpress.org/support/users/ext103/)

 *   [Profile](https://wordpress.org/support/users/ext103/)
 *   [Topics Started](https://wordpress.org/support/users/ext103/topics/)
 *   [Replies Created](https://wordpress.org/support/users/ext103/replies/)
 *   [Reviews Written](https://wordpress.org/support/users/ext103/reviews/)
 *   [Topics Replied To](https://wordpress.org/support/users/ext103/replied-to/)
 *   [Engagements](https://wordpress.org/support/users/ext103/engagements/)
 *   [Favorites](https://wordpress.org/support/users/ext103/favorites/)

 Search replies:

## Forum Replies Created

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

 *   Forum: [Hacks](https://wordpress.org/support/forum/plugins-and-hacks/hacks/)
   
   In reply to: [Calling a function in the plugin file](https://wordpress.org/support/topic/calling-a-function-in-the-plugin-file/)
 *  [ext103](https://wordpress.org/support/users/ext103/)
 * (@ext103)
 * [15 years ago](https://wordpress.org/support/topic/calling-a-function-in-the-plugin-file/#post-2067670)
 * you will need to find a “hook” (search the codex for all available hooks) that
   will put your function in the right place.
 * then to call the function you would right it like this:
 * say your function looks like this:
 *     ```
       function(){
       //do stuff here
       }
       ```
   
 * when you call it you change a few characters like this:
 *     ```
       //calling the function
       function();
       ```
   
 * if you are adding it to a hook (say for instance the “the_content” hook)
 *     ```
       add_filter('the_content', 'function', 99);
       ```
   
 * if you just want it on the homepage you would probably need to add the `is_home()`
   check into the function before doing anything.
 *   Forum: [Hacks](https://wordpress.org/support/forum/plugins-and-hacks/hacks/)
   
   In reply to: [is_feed() before template_redirect()?????](https://wordpress.org/support/topic/is_feed-before-template_redirect/)
 *  Thread Starter [ext103](https://wordpress.org/support/users/ext103/)
 * (@ext103)
 * [15 years ago](https://wordpress.org/support/topic/is_feed-before-template_redirect/#post-2062287)
 * okay, should of waited a bit, ive found a fix.
 * adding the `is_feed()` call INSIDE the seo_title() function got it to work.
 * im still sure this is because i was calling the variable before wordpress loads,
   but now its fixed, hope this helps others.
 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [for each $post???? cache data for each post daily](https://wordpress.org/support/topic/for-each-post-cache-data-for-each-post-daily/)
 *  Thread Starter [ext103](https://wordpress.org/support/users/ext103/)
 * (@ext103)
 * [15 years, 4 months ago](https://wordpress.org/support/topic/for-each-post-cache-data-for-each-post-daily/#post-1864564)
 * okay, i think ive figured some of it out, but now have another problem. first
   heres the code i am using to get it working (sort of)
 *     ```
       function seop_update_page_stats(){
       global $post;
       $args = array( 'post_type' => 'page' );
       $myposts = get_posts($args);
       foreach( $myposts as $post ) {
       setup_postdata($post);
       $id = $post->ID;
       $result = stuff i do to get the data
       update_post_meta($id, 'seop_stats', $result);
       }
       }
       ```
   
 * so this code sort of works (i also have the same function for the “posts” page
   type), i can set this up to run off the wordpress cron.
 * problem is this only seems to do some of the posts. i dont this as a timeout 
   either as it doing some old post, and some new ones, but it doesnt seem to update
   all posts.
 * has anyone every had anything similar?
 *   Forum: [Themes and Templates](https://wordpress.org/support/forum/themes-and-templates/)
   
   In reply to: [get_option multiple calls](https://wordpress.org/support/topic/get_option-multiple-calls/)
 *  Thread Starter [ext103](https://wordpress.org/support/users/ext103/)
 * (@ext103)
 * [15 years, 6 months ago](https://wordpress.org/support/topic/get_option-multiple-calls/#post-1750021)
 * is that right?
 * i mean when you call an option, does it only call it once per page?
 * say i had get_bloginfo(‘url’); called 5-6 times on the same page.
 * would that give me 5-6 database calls or one?
 * thanks for posting
 *   Forum: [Themes and Templates](https://wordpress.org/support/forum/themes-and-templates/)
   
   In reply to: [define a theme constant?](https://wordpress.org/support/topic/define-a-theme-constant/)
 *  Thread Starter [ext103](https://wordpress.org/support/users/ext103/)
 * (@ext103)
 * [15 years, 6 months ago](https://wordpress.org/support/topic/define-a-theme-constant/#post-1744353)
 * its not for specific use, its just a suggestion i got from a theme reviewer last
   time i submitted my theme.
 * they said the functions should describe what they do (ie press_3_load_sidebar_1)
 * i think i may go through and do as you suggested, name functions on a different
   basis.
 * i may use your $shortname method for text domain/translation though.
 * do i have to call “global” inside each function i call these?
 *   Forum: [Themes and Templates](https://wordpress.org/support/forum/themes-and-templates/)
   
   In reply to: [define a theme constant?](https://wordpress.org/support/topic/define-a-theme-constant/)
 *  Thread Starter [ext103](https://wordpress.org/support/users/ext103/)
 * (@ext103)
 * [15 years, 6 months ago](https://wordpress.org/support/topic/define-a-theme-constant/#post-1744347)
 * yes i know, but you use it within a function, not to name a function.
 *     ```
       function $shortname.setup(){
   
       }
       ```
   
 * the above code doesnt work.
 *   Forum: [Themes and Templates](https://wordpress.org/support/forum/themes-and-templates/)
   
   In reply to: [define a theme constant?](https://wordpress.org/support/topic/define-a-theme-constant/)
 *  Thread Starter [ext103](https://wordpress.org/support/users/ext103/)
 * (@ext103)
 * [15 years, 6 months ago](https://wordpress.org/support/topic/define-a-theme-constant/#post-1744333)
 * thanks for the reply, but doesnt really help me.
 * i too have a lot of different files linked with functions (shortcodes/help/widgets/
   general/optionspage/etc)
 * i was hoping i could implement something similar to the $shortname for my entire
   functions files.
 * right know i have a theme im working on called “press3”
 * so my functions look like this
 *     ```
       function press_3_widget_load
       function press_3_register_sidebar
       function_press_3_options_page
       ```
   
 * etc.
 * when i want to create a new theme, i need to go through all of these files and
   change the press_3 part to whatever relates to the new theme.
 * but if i could set something up like the shortname you mentioned, i would only
   have to change the original
 *     ```
       &themename =
       ```
   
 * and all functions would work and be named specific to new theme.
 * maybe if this isnt possible i could add in a str replace function right at the
   begining of the original functions.php file???
 *   Forum: [Themes and Templates](https://wordpress.org/support/forum/themes-and-templates/)
   
   In reply to: [help with action hooks](https://wordpress.org/support/topic/help-with-action-hooks/)
 *  Thread Starter [ext103](https://wordpress.org/support/users/ext103/)
 * (@ext103)
 * [15 years, 9 months ago](https://wordpress.org/support/topic/help-with-action-hooks/#post-1625006)
 * thanks, i figured it out before checking back to say thanks.
 * so thank you, all is good.
 * ps. and thanks for not digging at me for using tables 🙁
 * wanna get it working and then style it with a list i think.
 *   Forum: [Themes and Templates](https://wordpress.org/support/forum/themes-and-templates/)
   
   In reply to: [help with action hooks](https://wordpress.org/support/topic/help-with-action-hooks/)
 *  Thread Starter [ext103](https://wordpress.org/support/users/ext103/)
 * (@ext103)
 * [15 years, 9 months ago](https://wordpress.org/support/topic/help-with-action-hooks/#post-1625004)
 * i dont know, how would i check?
 * this code worked fine while in the page and post templates.
 * im trying to move it to a function to clean up the code.
 * maybe you are onto something with the `global $post` thing.
 * how would i implement it into this function?

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