Routing dynamic numeric slug to custom template

The easiest way is to simply create a custom rewrite endpoint. This is a two-fer. It will create our actual permalink structure and our query var in one go. Do note that after creating the below you will need to resave permalinks: Settings -> Permalinks -> save button. /** * Create Careers Endpoint * * … Read more

Code to pull in a PHP file named after the category ID

<?php foreach((get_the_category()) as $category) { if( file_exists( ‘/path/to/file/to/include/’ . $category->cat_ID . ‘.php’ ) ) include( ‘/path/to/file/to/include/’ . $category->cat_ID . ‘.php’ ); } ?> That should do the trick. If the file doesn’t exist, it just skips it. This can be expensive to do if you have a large amount of categories to loop through, though. … Read more

WordPress Shortcode wrap around div

If by template file you mean a php file in the themes folder, you can call do_shortcode to have the shortcode processor do its magic on your div. EDIT: not entirely sure I understand what you want, but you could try this: <div id=”subscription”> <?php do_shortcode(‘[subscribe]’.call_php_function().'[/subscribe]’);?> </div>

What should I put on my index.php?

index.php is shown whenever wordpress doesn’t find an appropriate page template. Generally people use it as the template for their site’s blog. If you are absolutely sure that it will never be reached, you can leave it empty. Just make sure you have that file present, otherwise the theme will not work As a personal … Read more