<?php
/*
Plugin Name: MyWPArraySearch
Description: Lists elements of array as hot links searching wordpress.org.
Version: 0.0.1
Author: Gary Garchar
*/
add_shortcode( 'MyWPArraySearch', 'myTableFun' );
// [MyWPArraySearch nColumns=3]
function myTableFun( $atts ) {
$a = shortcode_atts(array('nColumns' => '3'), $atts);
$nColumns = $a['nColumns'];
$array = array(
"Accessability",
"Admin",
"Aesthetics",
"Anti-Spam",
"Archives",
"Backup",
"Blocks",
"Child-Themes",
"CMS",
"Comments",
"Contact-Form",
"Content-Analysis",
"Custom-Post-Types",
"Customizer",
"Development",
"eCommerce",
"Editor",
"Feedback",
"Filters",
"Flexbox",
"Forums",
"Frameworks",
"Galleries",
"Google",
"Gutenberg",
"Hooks",
"HTML5",
"i18n",
"Installation",
"Javascript",
"jQuery",
"Keywords",
"l10n",
"Mapping",
"Math",
"Media",
"Metadata",
"Mobile",
"Multisite",
"MySQL",
"Page-Builder",
"Permalinks",
"PHP",
"Plugins",
"Profit",
"REACT",
"Readability",
"Related-Posts",
"Responsiveness",
"REST",
"Reusable",
"Security",
"SEO",
"Shortcode",
"Sitemap",
"Spam",
"SSL",
"Support",
"Tags",
"Templates",
"Theme",
"Themes",
"Tools",
"UML",
"UX",
"Widgets",
"WordCamp",
"WP_Query",
"XML",
);
$h = "<table class='wp-block-table'>";
$h .= "<caption>WordPress Search</caption>";
$h .= "<tr>";
foreach ($array as $value) {
$newRow = (++$i % $nColumns) == 0;
$h .= '<td><a href="https://wordpress.org/search/';
$h .= $value;
$h .= '" target="_blank">';
$h .= $value;
$h .= "</a></td>";
if($newRow) $h .= "</tr><tr>";
}
$h .= "</tr>";
$h .= "</table>";
return $h;
}
/*
.author {display:none;}
.site-title {font-family: sans-serif; font-style:italic}
caption {text-align: center;}
caption {
background-color: green;
color: white;
text-align: right;
}
td { text-align: right; }
.wp-block-table tr:hover { background-color: #ddd;}
*/