The perfecting of an appeal shall not stay proceedings as to those provisions of a judgment or order which award, change, or otherwise affect the custody, including the right of visitation, of a minor child in any civil action, in an action filed under the Juvenile Court Law, or in a special proceeding, or the provisions of a judgment or order for the temporary exclusion of a party from a dwelling, as provided in the Family Code. However, the trial court may in its discretion stay execution of these provisions pending review on appeal or for any other period or periods that it may deem appropriate. Further, in the absence of a writ or order of a reviewing court providing otherwise, the provisions of the judgment or order allowing, or eliminating restrictions against, removal of the minor child from the state are stayed by operation of law for a period of seven calendar days from the entry of the judgment or order by a juvenile court in a dependency hearing, or for a period of 30 calendar days from the entry of judgment or order by any other trial court. The periods during which these provisions allowing, or eliminating restrictions against, removal of the minor child from the state are stayed, are subject to further stays as ordered by the trial court or by the juvenile court pursuant to this section. An order directing the return of a child to a sister state or country, including any order effectuating that return, made in a proceeding brought pursuant to the Uniform Child Custody Jurisdiction and Enforcement Act (Part 3 (commencing with Section 3400) of Division 8 of the Family Code), the Parental Kidnapping Prevention Act of 1980 (28 U.S.C. Sec. 1738A), or the Hague Convention on the Civil Aspects of International Child Abduction (implemented pursuant to the International Child Abduction Remedies Act (42 U.S.C. Secs. 11601-11610)) is not a judgment or order which awards, changes, or otherwise affects the custody of a minor child within the meaning of this section, and therefore is not subject to the automatic stay provisions of this section.