Migrate the posts of a category to another blog as a custom taxonomy

I'm running a multisite WordPress, and I need to so the following migration between 2 blogs: All the posts of a sub-category X that has the parent category programs from the blog A. To the blog B under a sub-taxonomy X that has a parent custom taxonomy programs. Blog A doesn't have the taxonomy programs, it only has it as a parent category. Blog B has the taxonomy programs already created, but doesn't have it as a category. And I …
Category: Web

Using Switch Statement to Change Image According to Last Digit of Topic ID

I am trying to build a function, which gives out different image-urls, according to the last digit of bbp_get_topic_id(). This is, what i've got so far: function bg_image_topic_titlearea() { $letztezifferimgs = substr("'.bbp_get_topic_id().'", -1); switch ($letztezifferimgs) { case "0": echo "https://test.bewusstewelt.de/wp-content/uploads/2016/10/Blockaden-lösen-2.jpg"; break; case "1": echo "https://test.bewusstewelt.de/wp-content/uploads/2016/09/Das-Leben-ist-ein-Spiel-2.jpg"; break; case "2": echo "https://test.bewusstewelt.de/wp-content/uploads/2017/02/Bedürfnisse-erkennen-3.jpg"; break; case "3": echo "https://test.bewusstewelt.de/wp-content/uploads/2016/08/Selbsterkenntnis-sich-selbst-finden2-1.jpg"; break; case "4": echo "https://test.bewusstewelt.de/wp-content/uploads/2016/11/Reinkarnation-Wiedergeburt-2.jpg"; break; case "5": echo "https://test.bewusstewelt.de/wp-content/uploads/2016/10/Intuition3.jpg"; break; case "6": echo "https://test.bewusstewelt.de/wp-content/uploads/2016/07/Manchmal-muss-man-loslassen-3.jpg"; break; case "7": echo "https://test.bewusstewelt.de/wp-content/uploads/2016/07/Manchmal-muss-man-loslassen-3.jpg"; break; case "8": echo "https://test.bewusstewelt.de/wp-content/uploads/2017/02/Pfad.jpg"; …
Category: Web

Replace the page url with a menu link?

i want to make a multilangual site, where the secondary language is a copy of the site in a different folder. For example: Primary language url: example.com Secondary language url: example.com/en So there are two websites with the same content, only the language and the directory are different. I want to create a "language switcher menu item" that dynamically changes the page url. For example: if i'm on the example.com/about page after clicking the "language switcher menu item", i want …
Category: Web

How can I allow access to two user accounts using one login?

I have spent the last two hours searching for this and I cannot find a solution to my problem. I have a WP site with WooCommerce running which allows to users to create their own store. My client has a scenario he needs two stores, but without having to login and logout every time to check this data. I've already checked "User Switching" but its functionality is limited. It only allows you to switch to a user from the backend, …
Category: Web

change template with button

I created plugin with code : function fxn($theme) { if(isset($_POST['zmien'])){ $theme = 'loose';} else{ $theme = 'twentytwenty';} return $theme; } add_filter('template', 'fxn'); add_filter('option_template', 'fxn'); add_filter('option_stylesheet', 'fxn'); I found the code and adapted it to my website. I have created the plugin and it works only partially. When I click the button the template changes but when I click on any element on the new template the page returns to the previous template. How can I make a change of template …
Category: Web

switch combined with if statement

I am not able to get this running. What i commented out is running like it should, but i want to use the switch for specific user roles... add_action( 'um_members_just_after_name', 'my_members_after_user_name', 10, 1 ); function my_members_after_user_name( $user_id ) { $user = new WP_User( $user_id ); /* if( $user->roles[0] == 'um_musiker' ) { // update_user_meta( $user_id, 'um_reihung', '40' ); echo '<i class="um-verified um-icon-checkmark-circled um-tip-s" title="Kein Status"></i>'; } */ if( $user->roles[0] == $value ) { switch ( $value ) { case "um_musiker": …
Category: Web

Different home page for logged off users

I creating website and I need to have different homepages for logged in and logged off users. I have page 'Home page' which is set as home page and is filled with information about my site and pictures and simple page 'Home logged in' which was set as BuddyPress activity stream. What I need is: - User A is visiting website but he is not logged in and can see 'Home page' as homepage - User B is visiting website …
Category: Web

Template Loop - add switch case php

My plugin template is currently as follows: if ( $query->have_posts() ) { ?> <ul id="list-con"> <?php while ($query->have_posts()) { $query->the_post(); ?> <li> <a id="floimg" href="<?php the_permalink(); ?>" title="<?php the_title(); ?>"><?php if ( has_post_thumbnail() ) {the_post_thumbnail("mini-me");} ?><span class="flotnm"><?php the_field('fl_name'); ?></span></a> </li> <?php } ?> </ul> I need to incorporate a switch statement inside the loop but I can't figure out the php syntax. <?php $curtype = get_post_type( $post->ID ); switch($curtype){ case "firstcase": return <li> code as defined above break; case "secondcase": …
Category: Web

Create website with a switch between private and business

I'm about to set up a website of a certain company which has private and business customers. There's going to be a switch (private/business) in the top left corner of the website. Both sections have different main menu's. A cookie should be set when visitor choose their customer type and customers should be redirected the second time they visit. I just read about creating a Wordpress multisite for this. Is that the correct solution? Or are there other (better) solutions …
Category: Web

get post id by $content (so by post content)

So weird, huh? But, not joke --> I try to be very clean of being: I have a subdomain based multisite network. If the users posts to their sites, I get a clone from the current post to my network home. Now I want get the clone post's id on the subsite with switch_to_blog(); from the network home. How to get this clone post, if users not always using titles -> so no always titles and slugs... The original post's …
Category: Web

Wordpress language switcher

Is there an easy way I can switch between languages (perhaps with some flag icons) on a single Wordpress site? Can this be done with 2 content editors on the same page, or will I have to resort to a multi-site set up and point each flag to a different version of the site? I only require 2 languages, English and Mandarin, I also need to edit it all manually, I'm unable to rely on auto translators Thank you for …
Category: Web

What structure should I chose for my website?

I have website with local events and news in our city. There are different categories - one for each of event organizers. Right now I need to add support for other city - so that user can select one of cities and see events and news from it. It also will be great if I can limit access for author in different cities. What website structure should I use for that case?
Category: Web

Login Redirect - Multiple Scenarios

I'm trying to create some code that will accomplish the following: If login from any page in this array(example-page-one, example-page-two, example-page-three){ then, simply refresh the page } elseif login from 'example-page-four' { then, redirect to 'payment-page' } elseif login from all other pages { then redirect to '/member-account' } So far, all I've accomplished is pulling out my hair. Any help would be greatly appreciated. I have very limited coding skills here. This is what I've cobbled together so far …
Category: Web

How to batch convert comments to posts?

I want to display comments using a Post slider plugin, but comments aren't posts. I had a dodgy setup with FeedWordPress (sydnication plugin) by sucking the Comments RSS feed in to to the Comments into Posts, but the RSS feed has mysteriously stopped updating. So I'm thinking it might be better to find a way to convert Comments into Posts in a different way. I took a look at some post-type switchers, but didn't see any that considered Comments to …
Category: Web

Switch to other theme at URL

I want to switch to another theme at when a user visits www.mysite.com/m/. Then, redirect mobile users to www.mysite.com/m/ with htaccess based on their user-agent. I have the htaccess redirect rules and it is working for me. But how do I switch to mobile theme based on the URL? The Virtual theme plugin is a great solution for me, but unfortunately it doesn't work for mobile browsers.
Category: Web

Using a switch statement in Wordpress

I've got a piece of text in a div that I want to change on each page of my website. At the moment I'm not sure what function I should be using to do this. Here's what I have so far... <?php $page = is_page(); switch ($page){ 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 …
Category: Web

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

I'm trying to improve this tutorial script including a switch in the first ifcondition to assign a custom priority to my Yoast Xml Sitemap only to certain post or pages. So i'm trying to say to Yoast which if some pages have certain id the priority have to change, but my script assign the 0.5 value to all pages. Any help? 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) { …
Category: Web

How to move a post to different post type with all meta data?

I'm trying to move a post from a custom post type called 'new cars' to 'sold cars' using the Post Type Switcher plugin, and the plugin works well, but the all meta data associated with this post still belonging to 'new cars' post type... So, the problem appears when I list categories from 'new cars' post type and that 'sold car' make, model, colour and other metas still there... Someone have an advice ?
Category: Web

RTL/LTR frontend switcher

I have a theme that supports RTL. When Appearance->Theme settings->Right-to-Left (RTL) text orientation is enabled theme switches correctly. But I want to add to the main menu 2 items to switch orientation from frontend: RTL - switch theme to RTL mode LTR - switch theme to LTR mode How can I do it?
Category: Web

How to switch between two forms for visitor once admin logged in?

I have two forms (form1 and form2). Once the admin is logged in anywhere, all visitors (not logged in) to my WordPress site should see form1 on the page, otherwise they should see form2. I am using this code in a custom page template: if ( current_user_can( 'author' ) || current_user_can( 'administrator' ) ) { // show form1 } else { // show form2 } This works fine, but only for the admin screen, not other users or visitors. How …
Category: Web

About

Geeks Mental is a community that publishes articles and tutorials about Web, Android, Data Science, new techniques and Linux security.