ext103
Forum Replies Created
-
Forum: Hacks
In reply to: Calling a function in the plugin fileyou 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
In reply to: is_feed() before template_redirect()?????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
In reply to: for each $post???? cache data for each post dailyokay, 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
In reply to: get_option multiple callsis 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
In reply to: define a theme constant?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
In reply to: define a theme constant?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
In reply to: define a theme constant?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_pageetc.
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
In reply to: help with action hooksthanks, 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
In reply to: help with action hooksi 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 $postthing.how would i implement it into this function?