What is the best way to build home pages with a lot of sections for distributable themes [closed]

Due to historical context implementation of static front pages in WordPress is, simply put, a horror. This is not something it was meant to do originally and the way it was bolted on at a certain point is opposite of smooth. Under these constraints it would be hard to impossible to say what would be … Read more

Dynamic assign a custom template to custom post type posts

locate_template search template only in themes then to use a file outside themes, you can use the filter template_include like that add_filter(“template_include”, function ($template) { $post = get_queried_object(); if ( is_single() && (“features” === $post->post_type) ) { // absolute path to the template file $template = __DIR__ . “/../../template/my_features_template.php”; } return $template; });

How can I load 2 random pages?

You can redirect users from home page to random page with this code (paste it to your functions.php) function my_homepage_redirect() { if ( is_home() || is_front_page() ){ $page = get_posts( [ ‘post_type’ => ‘post’, ‘posts_per_page’ => 1, ‘category’ => 1, // your category ID ‘orderby’ => ‘rand’, ‘fields’ => ‘ids’ ] ); if ( empty( … Read more

Strip from the_tags() output

Well, you can use the DOM object to change/remove tags and their parameters. See here for all the details https://stackoverflow.com/questions/3820666/grabbing-the-href-attribute-of-an-a-element Code would be something like this: (this sample changes the class of all H1 elements to be ‘a_new_class’, removing any existing classes) $html = “<h1 class=”the_old_class”>A Heading</h1>”; $dom = new DOMDocument; libxml_use_internal_errors(false); // supress errors … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)