help to write a custom php script to settingup yoast priority to pages or posts

The solution should is this: add_filter( ‘wpseo_xml_sitemap_post_priority’, ‘my_custom_post_xml_priority’, 10, 3 ); function my_custom_post_xml_priority( $return, $type, $post) { if($type == ‘page’) { switch ($post->ID) { case ‘8’: case ‘395’: case ‘342’: $return = 0.9; break; case ‘5’: $return = 1.00; break; case ‘620’: case ‘703’: case ‘603’: case ‘688’: case ‘695’: case ‘614’: case ‘684’: case … Read more

RTL/LTR frontend switcher

Ok. I resolved it in this way. Let’s say that we have a CSS-file rtl.css, which contains rules for right-to-left content direction. Add menu items: Appearance->Menus->Select a menu to edit->Edit menus->Custom links. URL – ?language=rlt (or something like this), Link text – RTL (for example) URL – ?language=ltr, Link text – LTR Create a plugin: … Read more

Using a switch statement in WordPress

If you wanted to use your switch statement, you could use: switch ($post->post_name){ case ‘home’: $content=”How much money….”; break; case ‘about’: $content=”We design….”; break; case ‘services’: $content=”At the….”; break; case ‘blog’: $content=”Find out whats….”; break; case ‘portfolio’: $content=”Unique, Beautiful….”; break; case ‘contact’: $content=”Get in touch to….”; break; case ‘privacy-policy’: $content=”How much money….”; break; case ‘terms-and-conditions’: … Read more

Switch to other theme at URL

Given that this is an older question and the mention plugin is very much depreciated, both the WordPress core and themes have changed greatly since then. Nowadays, most themes are mobile-friendly and will conform based on the amount of screen space is being used to visit a website.

switch a theme different per user role

There’s current_user_can( ‘CAPABILITY’ ); (see @Codex Users & Roles to find the appropriate cap for your targeted role), that you can use to determin what theme you want to display. You can also check for is_user_logged_in() if you just want to differentiate between non-logged in and logged in users. Then you have the switch_theme() function. … Read more