Well, it looks like my latest idea proved correct. Simply including the index file for wordpress was enough to get permalinks working for blog posts.
$app->slim->notFound(function() use($app) {
//to make pretty url's work with turdpress, we must see if that request was intended for our blog route.
if(strpos($app->slim->request->getPath(),'/blog/') !== false){
include __DIR__ . '/../../blog/index.php';
}else{
$app->args['title'] .='404 Not Found';
$app->args['scripts'] = 'js/404.js';
echo $app->loadTemplate('404.twig')->render($app->args);
}
});
I am curious to know if anyone thinks this is dangerous.
Related Posts:
- How to get URL of current page displayed?
- Disable Attachment Pages Completely
- how to get permalink structure with php
- Facebook Comment Count
- How to Remove Parents Category Permalink from Posts
- add_rewrite_rule with bottom priority doesn’t handle the WordPress pages
- Put a link to a category round a hard coded A HREF
- How is WordPress manipulating the posts like there are folders?
- wordpress upgrade has broken my permalinks
- Featured image fallback link to permalink
- Do changes to WordPress permalink custom structure affect old urls?
- WordPress custom slug (endpoint) and compare all links
- Add prefix to link url
- 200 Rewrite blog post links
- php script to change slug in post automatically
- wp_trim_words() does not work with my code Am I doing any mistake in my code?
- Changes in permalink structure in WordPress and how to apply to in-site links
- WordPress Persistent connection rule does not work for “posts”
- WordPress every page is 404 not found including admin resources
- WordPress returning 404 for multisite pages
- How to use $_GET function WordPress backend
- Create custom permalinks to show Custom Post Type’s relationship?
- How to get post permalink url without a href
- get_template_directory_uri() providing wrong path for img
- stripping tags from excerpt in WordPress is not working
- Change product_base programmatically
- Divi change project category slug
- Custom post type permalinks do not appear using the link functions
- How to Handle Going Backwards in Navigation When Referrer in PHP/JavaScript won’t work?
- Remove slugs from custom posts type
- .html end of URl affected to SEO?
- Search only working on front page (index) , not working on other pages
- how to edit a specific post slug using a php code?
- Creating a Category Taxonomy
- WordPress theme showing blank page
- Strip hashtag off permalink with php
- Insert PHP code in Text
- Permalinks: site.com/post-tite vs site.com/post-id/post-title for SEO and Speed
- Can not call .php files after switching to %postname%
- WordPress permalink issue
- Change permalink structure specific category
- understand what code is doing when prepending /blog
- Custom URL for multiple categories hierarchy
- WordPress redirects to localhost
- Allow two posts (from different categories) to have the same slug
- Test the existence of a page/article by its URL, taking in consideration the URL rewriting by filters
- 404 on old link after changing post url
- url not using query string no longer working
- Custom PHP form needs refresh to load page correctly
- Child-Theme Category View with modified permalinks (%category% removed)
- Rewrite rule not working, but only when parameter is text
- How does Permalink work with the AMP plugin after Removing Parent Permalink Catalog from Posts
- Get WordPress username to customize url
- Permalink doesn’t navigate to post (changes only url)
- Post permalink buttons all going to the first post
- Permalink changes after several minutes after saving post
- How to edit button permalink inside function.php using a child theme?
- WordPress/NGINX not respecting the category URL for new posts
- WordPress generates weird permalinks
- Permalink like example.com/taxonomy/post_type/postname
- How do I stop my form from adding code to current page URL instead of re-directing. Been stuck for days
- image on homepage disappeared due to change of permalink name
- Custom content using in_category
- What is the proper way to call a function (from functions.php) on a link click?
- How do I generate formatted permalinks as specified in backend options?
- 403 Forbidden Localhost Wamp Apache Php
- redirect 301 with special character like WIX site “#!”
- Permalinks and custom PHP application
- How to solve 404 permalink errors on nginx server
- Some links broken after updating WordPress version
- add_rewrite_rule questions
- Weird slug in archives permalink
- WordPress Rewrite Issue
- Newly published content gives 404 on wordpress
- set new link as permalink
- Multiple URL from Custom post name
- echo variable containing html and the_permalink();
- append links with unique number string
- get_permalink returning first letter
- Get permalink for a post from inside WordPress and route to a related site
- custom data in url
- Make a permalink to the most recent blog post
- PHP code for link with text
- Remove /category/ from category (archive) page URLs (without using a plugin)
- Accessing WordPress Functions get_permalink() in Vanilla PHP?
- WordPress add parameters with friendly url structure
- Add any username as link prefix and show data from that specific user’s profile on wordpress pages – with no login required
- how to goto specific page number including title with permalink
- How to extract URLs from wordpress taxonomies
- WordPress 6.1.1 UTF8 Slug Limit Increase
- why css file not link?how to create permalink?
- Block PHP Files Nginx
- How does the ternary operator work in the wordpress loop post?
- Advanced Meta Query for Large Calendar Website (12k+ posts) (175k+ wp_postmeta rows)
- Whats the proper way to use a php stylesheet in a wordpress theme? [duplicate]
- Is there any way to get a drop down list of time zones?
- Post Views Code Hacks
- Closing WP_LINK_PAGES DIV ID w/After Argmuent
- Using transients to store form notifications
- How to query a staging database?