Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 4 of 4
  1. #1
    Regular Coder
    Join Date
    Jan 2009
    Posts
    193
    Thanks
    53
    Thanked 1 Time in 1 Post

    Need to have the same html block for 2 wp sites and want to update in one place. JS?

    I need to have the same html content that displays on two Wordpress sites so I want to find a way to only update in one place. Would javascript be recommended?

    I just found this tutorial but that seems to be for a small amount of html. I'll have 100-200 lines.

    How do I implement?
    Last edited by Daniellez; Nov 14th, 2018 at 03:55 AM.

  2. #2
    Senior Coder jmrker's Avatar
    Join Date
    Aug 2006
    Location
    TX
    Posts
    3,940
    Thanks
    65
    Thanked 601 Times in 595 Posts
    Can you provide a small sample of the code you are trying to use?

  3. #3
    Regular Coder
    Join Date
    Jan 2009
    Posts
    193
    Thanks
    53
    Thanked 1 Time in 1 Post
    Sure...

    Code:
    <strong><img class="absmiddle" src="/img/icon_Fall.png" alt="Fall" width="67" height="67" /> <span style="text-decoration: underline;">FALL 2019</span>:</strong>
    <p style="line-height: 25px;"><em><strong style="font-size: 15px;">Women</strong></em>
    <img class="absmiddle" src="/img/icon_calendar.png" alt="dates" width="14" height="14" /> TBD
    Director: 
    Coordinator: 
    <a title="Signup" href="#" target="_blank" rel="noopener" class="disabled"><img class="absmiddle size-full wp-image-201" src="/img/icon.png" alt="Signup" width="25" height="24" /></a></p>
    
    <p style="line-height: 25px;"><em><strong style="font-size: 15px;">Men</strong></em>
    <img class="absmiddle" src="/img/icon_calendar.png" alt="dates" width="14" height="14" /> TBD
    Director: 
    Coordinator: 
    <a title="Signup" href="#" target="_blank" rel="noopener" class="disabled"><img class="absmiddle size-full wp-image-201" src="/img/icon.png" alt="Signup" width="25" height="24" /></a></p>
    <!--
      _____ __     __ _____  _   _  _____  ____  
     | ____|\ \   / /| ____|| \ | ||_   _|/ ___| 
     |  _|   \ \ / / |  _|  |  \| |  | |  \___ \ 
     | |___   \ V /  | |___ | |\  |  | |   ___) |
     |_____|   \_/   |_____||_| \_|  |_|  |____/ 
                                                 
    -->
    <h1>2️⃣0️⃣1️⃣9️⃣</h1>
    
    <style>
    /* DivTable.com */
    .divTable{
    	display: table;
    	margin-bottom: 21px;
    	width: 100%;
    }
    .divTableRow {
    	display: table-row;
    }
    .divTableHeading {
    	background-color: #EEE;
    	display: table-header-group;
    }
    .divTableCell, .divTableHead {
    	border: none;
    	display: table-cell;
    	padding: 7px 0;
    }
    .divTableHeading {
    	background-color: #EEE;
    	display: table-header-group;
    	font-weight: bold;
    }
    .divTableFoot {
    	background-color: #EEE;
    	display: table-footer-group;
    	font-weight: bold;
    }
    .divTableBody {
    	display: table-row-group;
    }
    </style>
    <div class="divTable">
    	<div class="divTableBody">
    		<div class="divTableRow">
    			<div class="divTableCell">May 11 | 6pm</div>
    			<div class="divTableCell">Gathering</div>
    		</div>
    		<div class="divTableRow">
    			<div class="divTableCell">June 8 | 6pm</div>
    			<div class="divTableCell">Gathering</div>
    		</div>
    		<div class="divTableRow">
    			<div class="divTableCell">August 10 | 6pm</div>
    			<div class="divTableCell">Community Picnic</div>
    		</div>
    		<div class="divTableRow">
    			<div class="divTableCell">September 14 | 6pm</div>
    			<div class="divTableCell">Gathering</div>
    		</div>
    		<div class="divTableRow">
    			<div class="divTableCell">October 12 | 6pm</div>
    			<div class="divTableCell">Gathering</div>
    		</div>
    		<div class="divTableRow">
    			<div class="divTableCell">November 9 | 6pm</div>
    			<div class="divTableCell">Gathering</div>
    		</div>
    		<div class="divTableRow">
    			<div class="divTableCell">December 14 | 6pm</div>
    			<div class="divTableCell">Gathering</div>
    		</div>
    	</div>
    </div>

  4. #4
    Administrator VIPStephan's Avatar
    Join Date
    Jan 2006
    Location
    Halle (Saale), Germany
    Posts
    11,195
    Thanks
    6
    Thanked 1,345 Times in 1,314 Posts
    JavaScript is probably the worst and last solution you should try.
    Are these sites managed independently? Perhaps the REST API would be applicable to you? Here is a slightly old but still informative tutorial about how to fetch posts.


 

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •