jbh
Forum Replies Created
-
Forum: Fixing WordPress
In reply to: As Admin, I Can't Load My Custom Plugin FunctionsUnless the idea is that only menu pages, since we assign a permission level, can be accessed that way (page.php?page=function_name)
So, if I want to create 3 unique functions that are not pages, I can’t call them separately such as admin.php?function=function2_name? Instead, I must create them and call them in a function that IS part of the navigation menu?
I guess I can do that, I just wanted to see if that is something which is forced on us.
Thanks.
Forum: Fixing WordPress
In reply to: As Admin, I Can't Load My Custom Plugin Functions.
Thank you, for this!
Forum: Fixing WordPress
In reply to: Redirect To Other Page Before Blog Page/Post Loads?Nevermind, I use wp_redirect. I hope this helps. For those not familiar, search wp_redirect() and it will give you the code/etc you need. Good luck.
Forum: Hacks
In reply to: 2 Quick Q's Regarding Post ManipulationThe delay is the connectivity issue and then the way I manipulate the entire post of these long pages to look for tokens. I am building functions to use shortcode method that you used so I can pull and remove data more efficiently.
One method I am experimenting with is
$response = wp_remote_get($url3);
Problem is when I try to replace a token through $content and
output it (on a test site) it’s now not showing it:function shortcode_plain() { return 'plain token'; } # add_shortcode('listings_page','shortcode_plain'); # I'd like to use shortcode to strip out a value somehow # turn [total_listings=5] into 5 # Of course, since this api exists, maybe it's best to just change the tokens to apply to # what it expects. That is the perfect last resort, I'd wager. # It looks as if shortcode_example2 can do it function shortcode_stripvalue($attr) { echo "Yes, We Were Able To Strip From [total events]!<br>"; $url3="https://www.site.com/calendar-2/demo_new.php?mo=$mo&yr=$yr&total_listings=$total_events&showCat=$category&view_method=list" $response = wp_remote_get($url3); $content=str_replace("[listings_page]",$r3,$content); return $content; } add_shortcode('total','shortcode_stripvalue'); add_filter('the_content',shortcode_stripvlaue);
Now it shows nothing. Strange…
Forum: Hacks
In reply to: 2 Quick Q's Regarding Post ManipulationYeah, I am not using conditionals with those connectors, such as “If this page has this token, connect with this $result.
So it’s probably connecting three times (3 connections for 3 unique types of tokens used for 3 types of pages) and causing that delay. If I sniff out the token and use a conditional to assign one connection per page/token, I might see a difference…
Forum: Hacks
In reply to: 2 Quick Q's Regarding Post Manipulationlol, thanks. I appreciate it. I will use a ‘sniffer’ like that as well as continue to learn more about the shortcode api
The reason I use the http method is because I need to turn the token
into the url and it doesn’t allow me to include dynamic full url’s on the server. I tried curl earlier and the load time was horrendous.Ty, for now.
Forum: Hacks
In reply to: 2 Quick Q's Regarding Post ManipulationThe dream is to have main.php run most of the pages/posts and do nothing other than filter through the_content with the post_loop function.
Then, at the same time, detect IF a token exists in a page and if not, I include a separate page with their own the_content filter.
So it’s not possibly loading 2 at once/etc.
It’s the inability to quickly, without a million explode statements/etc, determine IF a page that the user visits has a token that is causing me headaches.
Ty , again. I hope that I am clear.
Forum: Hacks
In reply to: 2 Quick Q's Regarding Post ManipulationMy tokens are not registered as shortcodes. It’s this part of the api i am not familiar with.
Yeah, each page that has a token is given one so I can use that data to interact with the 3rd party calendar script. I’ll research that link.
One question. Does having a potential ‘double the_content’ filter, as well as explode statements, for posts with a fair amount of text to sift through, cause these delays?
Pages without the tokens load quickly, btw
Thanks. I’ve lost a full weekend dealing with this. I appreciate your time.
Forum: Hacks
In reply to: 2 Quick Q's Regarding Post ManipulationIf I need to create 2 txt files with full code I can
but I figured this helps explain why it might be delayed.My theories are:
A.) Too poor of a design to strip the token data (explode)
B.) Two filters for these pages. The pages that load slowly are the ones with the TOKENS. Do the two filters for ‘the_content’ add to the load time, maybe?Forum: Hacks
In reply to: 2 Quick Q's Regarding Post ManipulationThanks, Mark. I’ll try the ID trick in a moment. To answer your question, along with posting code, here is where I am…
I have a page that has a postloop function. What it does is initially look for 3 page id’s and, if it finds 1 of the 3 pages is loaded, it creates order forms. Outside of that loop, I include a page for calendar functionality (using a 3rd party calendar script)
so I include that page such as
include(“calendar_page.php”);
I displayed it BEFORE the post_loop.
In that page, I try to find 3 types of tokens:
[listings_page]
[total_events=5] // that # is hard coded when a user creates a page, it can be 5, 10 or anything they want.
[categories_5|10|22]So calendar_page.php runs the functionality to find the tokens, remove them from visibility, and strip the values so it can display calendar data. It works, but it’s slooow.
I also include that code in another post_loop type function (different name) so I am using TWO filters, one for main.php and
one for calendar pages. I wonder if that is causing issues?Anyway, here is some of the code:
function calendar_replace($content) { global $user_ID; global $post; global $category; $thePostID = $post->ID; # Some code to determine variables for the calendar script # Following code is to determine values in the TOKENS $list_category=explode("[category=",$content); $category_piece=$list_category[1]; $list_category_total=explode("]",$category_piece); $category=$list_category_total[0]; # Let's do it now for Events # SAME CONCEPT - Explode/etc to find values in tokens # Will save you from reading all of the code.. # I then use the rest of the code to find other vals I need # that are not coming from tokens. # Now, we create url's that we can include which involves # finding a url with the 3rd party calendar script # so we can display events based on the tokenized data # in this page's post $url1="https://domain.com/calendar-2/show_listings.php?mo=$mo&yr=$yr&cat=$cat=$category&total_listings=$total_events"; $url2="https://domain.com/calendar-2/demo.php?mo=$mo&yr=$yr&total_listings=$total_events&showCat=$sc&view_method=$ext"; $url3="https://domain.com/calendar-2/demo_new.php?mo=$mo&yr=$yr&total_listings=$total_events&showCat=$category&view_method=list"; $request = new WP_Http; $result = $request->request( $url1 ); $result2 = $request->request( $url2 ); $result3 = $request->request( $url3 ); # At this point, we just have to tell the script to # replace the post's content with the added 3rd party # calendar data, which was pulled from the 3 url's above $content=str_replace("[calendar_events]",$r1,$content); $content=str_replace("[calendar]",$r2,$content); $content=str_replace("[listings_page]",$r3,$content); # Then we return $content and add the filter.
So it’s main.php loading the normal pages, having it’s own post loop and filter for ‘the_content’. Inside this page, outside of the loop (at the bottom, after the filter) I include the calendar page
The calendar page uses explode/php functions to strip out the values in tokens, I create the urls (dynamic urls) to display ‘event data’ for each page and then I add that to another filter for ‘the_content’
TY for your time!
Forum: Fixing WordPress
In reply to: My Plugin Is SLowing Down The SiteOne thing I noticed. One of the files requires curl commands
because I have no other way of using a dynamic include (Where I can include a file with querystrings, this host doesn’t support it)I wonder if that is what’s causing the delay, as with this plugin, it’s probably loading those curl commands each time. I wonder if creating a way to block out these functions if it’s not a certain page that they request would help…
Forum: Fixing WordPress
In reply to: Adding Options For When People Submit A PostThanks for your reply
Since I am developing a plug-in, I can look into how they do it.
I just am trying to learn more the way to tell wordpress “add my fields to your ‘new post’ section without me editing your pagesI’ve learned how to work with the loop and create admin panels, I guess this is my last ‘challenge’. Ty for the link, I will check out the ‘custom fields’ to see if it can help.
It’s just hard to wrap my brain around what to do as there is so much documentation, which isn’t a bad thing ??
Forum: Fixing WordPress
In reply to: Adding Options For When People Submit A PostIn short, I just need to know which support documentation will show me how to edit the single.php/new post template without having to edit the actual page itself when I create my plug-in function.
Thanks
Forum: Fixing WordPress
In reply to: Admin Codex Question – Load Function That’s Not A Page…Than you. I just can’t believe something so useful, and basic, is so hard to find.