DreamHost error when trying to add a domain: “You can’t add that domain: you must add the parent domain”

I have hosting account on DreamHost I want to add my domain (which is registered outside Dreamhost) I have already changed nameservers. my domain is "xxxx.edu.eg" but I have the following problem: "You can’t add that domain: you must add the parent domain edu.eg to your account before adding a subdomain to it." How to solve it and thank you in advance

How to copy an order item meta from the parent to the child order in a Woocommerce Subscription?

I’m running a function hooked to woocommerce_order_status_completed that uses an API to get a phone number and pin from an external source and save that in a meta key on some order items. Some of these order items are subscriptions.

When a Woocommerce subscription renewal order runs automatically, it fires the API and gets a new set of call-in data. I need to check if a completed order is a subscription renewal and if so skip the API call and just get the renewed item’s parent meta data and insert it into the child items meta.

The top portion of the code I have tried here is not working. The API call portion of the code in the else{} is working so I have truncated it.

add_action ( 'woocommerce_order_status_completed', 'add_item_meta_or_run_api', 10 , 1);  function add_item_meta_or_run_api( $  order_id ) {  $  order = wc_get_order( $  order_id );   if (wcs_order_contains_subscription( $  order, 'renewal' )){ //check if the order contains a renewal subscription    foreach ($  order->get_items() as $  item_id => $  item_obj) { //loop through each rewnewal item        $  parent_id = $  item_obj->get_parent_id(); // Get the parent order ID for the subscriptions.       $  parentSubscriptions = wcs_get_subscriptions_for_order( $  parent_id );//get parent order subscriptions                 foreach (  $  parentSubscriptions->get_items() as $  parent_item_id => $  subscription_item_obj) { //loop through parent order items and get the meta.                   $  ParentCallinData = $  subscription_item_obj->get_meta('call_in_data');               // Store parenent item call in data in renewal order item meta         wc_update_order_item_meta($  item_id,'call_in_data',   $  ParentCallinData, true);             }    } }   else {//if there is not a subscription renewal in the order then we run the Api       foreach ($  order->get_items() as $  item_id => $  item_obj) {    //Code here has been removed that builds and runs the API call to dynamically get the call-in data and store it in $  APIresponse          wc_update_order_item_meta($  item_id,'call_in_data',  $  APIresponse, true); //the APIresponse is added to an order item meta key     }    }   } 

wp_remove_object_terms correct way to call child of parent taxonomy in woocommerce

In Woocommerce I am currently able to assigned and unassign a product taxonomy from a product by calling the following.

// to assign wp_add_object_terms ( $  product_id,'in-stock', 'product_cat' );  //to unassign wp_remove_object_terms ( $  product_id,'in-stock', 'product_cat' );  

However how would one achieve this with a child of the parent taxonomy.

Do I need to call the parent and then the childs tag_ID ? Maybe something like below. Can someone clarify how I should correctly format ‘pa_stock&tag_ID=27’ please.

wp_remove_object_terms ( $  product_id,'in-stock', 'pa_stock&tag_ID=27' );  

Just to clarify pa_stock represents the parent taxonomy, tag_ID 27 represents the child taxonomy.

Get parent theme version

How do I get the parent theme’s version in a child theme?

I want to use it when loading the parent theme’s stylesheet.

Here’s how I load the stylesheets in the child theme’s function.php file:

function sometheme_enqueue_styles() {    // Get parent theme version   $  parent_theme_version = wp_get_theme()->parent()->get( 'Version' );    // Load parent theme stylesheet   wp_enqueue_style( 'sometheme-style', get_template_directory_uri() . '/style.css', array(), $  parent_theme_version );    // Load child theme stylesheet   wp_enqueue_style( 'sometheme-child-style',     get_stylesheet_directory_uri() . '/style.css',     array( 'sometheme-style' ),     wp_get_theme()->get('Version')   );  } add_action( 'wp_enqueue_scripts', 'sometheme_enqueue_styles', 11 ); 

However, this will use the child theme’s version for both stylesheets…

I have also tried this:

$  parent_theme = wp_get_theme('sometheme'); $  parent_theme_version = $  parent_theme->get( 'Version' ); 

…and this:

$  parent_theme = wp_get_theme(get_template()); $  parent_theme_version = $  parent_theme->get( 'Version' ); 

But again, the parent theme version keeps getting the version from the child theme.

How to Use WP_REDIRECT and Continue Parent Execution

I am overriding another plugins’ custom registration form with my own custom template (adding additional fields).

On submission, the original plugin triggers:

wc_add_notice( __( 'Your registration has been submitted successfully.', 'woocommerce-wholesale-pro' ) ); 

This renders in my own custom form submission, however I would like to:

  1. Re-direct the user back to the home page
  2. and then trigger the wc_add_notice() hook so that the success notice is displayed

I have completed 1) by adding the following:

wp_redirect(home_url()); exit(); 

However, now I am unable to see the original plugins wc_add_notice() hook be triggered/rendered on submission.

I am unable to grasp WordPress’s flow to achieve this task.

Is this possible? Any help/guidance would be greatly appreciated!

Please let me know if I can clarify anything from my end.

WordPress add page under admin submenu and retaining the active status of the parent submenu page in the menu

I have added a page in the admin menu(pxmag-menu) and a submenu(pxmag-plans). There is another page(pxmag-plans-edit) set under the submenu(pxmag-plans) as the parent page.

public function __construct() {     require('pxMagAdminPlans.class.php');     $  this->admPlanObj= new pxMagAdminPlans();      add_action('admin_menu', array($  this, 'add_plan_admin_menu')); }  public function add_plan_admin_menu() {     add_menu_page(__('Dashboard', 'textdomain'), get_bloginfo('name'), 'manage_options', 'pxmag-menu', array($  this, 'pxmag_dash'), 'dashicons-welcome-view-site', 6);              add_submenu_page('pxmag-menu', __('Subscription Plans', 'textdomain'), 'Plans', 'manage_options', 'pxmag-plans', array($  this->admPlanObj, 'plan_admin_menu_page'));     add_submenu_page('pxmag-plans', __('Add/edit Plans', 'textdomain'), 'Add/edit plans', 'manage_options', 'pxmag-plans-edit', array($  this->admPlanObj, 'plan_admin_menu_edit')); } 

All the menu and submenu pages load fine.

But, when I open this page(pxmag-plans-edit), the menu selection in the WordPress admin shows nothing as current item, whereas the pxmag-plans is supposed to be the current selection.

(It is supposed to work like: when I click ‘Posts > Categories‘ and subsequently open the ‘edit category‘ page, the ‘Posts > Categories‘ option in menu keeps selected).

What is going wrong? What is the correct process?

Why does the formula floor((i-1)/2) find the parent node in a binary heap?

I learned that when you have a binary heap represented as a vector / list / array with indicies [0, 1, 2, 3, 4, 5, 6, 7, 8, …] the index of the parent of element at index i can be found with parent index = floor((i-1)/2)

I have tried to explain why it works. Can anyone help me verify this?

Took reference from Why does the formula 2n + 1 find the child node in a binary heap? thanks to @Giulio

Save the post parent in a custom post type in Gutenberg

A plugin I’m developing registers two custom post types: Class and Student. Both are connected via the post_parent property in the Student post type (one student belongs to one class). I added a SelectControl control to the PluginDocumentSettingPanel in the Student post type edit screen to be able to set a Class for the Student. Everything is working except the saving part. The changes are not saved. Any ideas?

Thanks in advance

const { __ } = wp.i18n; const { compose } = wp.compose; const { registerPlugin } = wp.plugins; const { SelectControl } = wp.components; const { PluginDocumentSettingPanel } = wp.editPost; const { withSelect, withDispatch } = wp.data;  const applyWithSelect = withSelect( ( select ) => {     const {         getEditedPostAttribute,         getCurrentPostType     } = select( 'core/editor' );     const {         getEntityRecords     } = select( 'core' );      const parent = getEditedPostAttribute( 'parent' );      const posts = getEntityRecords( 'postType', 'class', { per_page: -1, orderby: 'title', order: 'asc', _fields: 'id,title' } )      return {         currentPostType: getCurrentPostType(),         parent: parent,         posts: posts     }; } );  const applyWithDispatch = withDispatch( ( dispatch ) => {     const { editPost } = dispatch( 'core/editor' );      return {         onUpdateParent( value ) {             editPost( { parent: Number( value ) } );         },     }; } );  function StudentOptionsPanelComponent( {     // These props are passed by applyWithSelect().     currentPostType, // current post type     parent, // current value of parent     posts, // all posts     // And these are passed by applyWithDispatch().     onUpdateParent,  // function which updates the meta restrict } ) {     if ( 'student' !== currentPostType ) {         return null;     }      if ( ! posts ) {         return __( 'Loading...', 'my-plugin' );     }      if ( posts.length === 0 ) {         return __( 'No classes found', 'my-plugin' );     }      var options = [];     options.push( {         label: __( 'Select a class...', 'my-plugin' ),         value: ''     } );      for ( var i = 0; i < posts.length; i++ ) {         options.push( {             label: posts[i].title.raw,             value: posts[i].id         } );     }      return (         <PluginDocumentSettingPanel             name='student-options'             title={ __( 'Options', 'my-plugin' ) }             className='student-options-panel'         >             <SelectControl                 label={ __( 'Select a class:', 'my-plugin' ) }                 value={ parent }                 options={ options }                 onChange={ onUpdateParent }             />         </PluginDocumentSettingPanel>     ); }  const StudentOptionsPanel = compose(     applyWithSelect,     applyWithDispatch )( StudentOptionsPanelComponent );  registerPlugin( 'student-options-panel', {     render: StudentOptionsPanel, } ); 

Get/create the parent taxonomy by using shortcode in woocommerce?

How would I get/create the parent taxonomy by using shortcode in woocommerce?

My product categories should be like:

– Food

— Fruits

— Healthy Fruits
— Organic Fruits

— Meat

— Pork
— Lamb
— Beef

For example, I would like to display “Fruits” when user at the “Healthy Fruits” product archive page.

how create sorting sql/php with parent

phpmyadmin

picture

index.php file

$  id = '8'; $  idr = $  row['id']; echo 'id-'.$  id.' : ';  for ($  i = 0; $  i <= $  id; $  i++) {   $  sql="SELECT * FROM menu WHERE parent='$  i' ";   $  result = mysqli_query($  db,$  sql);   $  slug = $  row['slug']; echo $  slug; echo '/';  } if ( !empty ($  id) ) { echo '-No Data-'; } 

I want to show the output as shown below:

id-8 : g/h id-6 : a/b/c/d/e/f id-4 : a/b/c/d id-1 : a id-7 : g id-10 : -No Data-