updated and cleaned up php files. added support to load latest style sheet from url

This commit is contained in:
jorge-vitrubio 2023-01-18 15:29:00 +01:00
parent 0b911426ae
commit 2abc3d6213
8 changed files with 255 additions and 877 deletions

File diff suppressed because it is too large Load Diff

View File

@ -1,106 +0,0 @@
<?php
/**
* The template for displaying archive custom post type ajut
*
* @link https://developer.wordpress.org/themes/basics/template-hierarchy/
*
* @package Oficina_de_Suport_theme
*/
get_header();
?>
<main id="primary" class="site-main">
<section id="filteredfunds" class="ofisuport-filtered-funds ofisuport-ajuts-filtrats">
<aside id="fundsfilter" class="ofisuport-filter-funds ofisuport-fitre-ajuts">
<div id="arhive-filters" class="ofisuport-filters">
<?php
// output all possible values of a checkbox
$groupkey = "group_63ab636898703"; // write here the key for the group of fields from acf
if( $groupkey){
//echo '<h6>check the groupkey <span style="color: #00b">' . $groupkey . '</span></h6>';
$groupkey_fields = acf_get_fields($groupkey);
foreach( $groupkey_fields as $field_key ) {
if( $field_key['type'] == 'checkbox' ){
//echo '<span style="color: #00b">' . ($field_key['key']) . '</span><br/>';
//echo '<span style="color: #00b">' . ($field_key['label']) . '</span><br/>';
//echo '<span style="color: #00b">' . ($field_key['name']) . '</span><br/>';
// https://wordpress.stackexchange.com/a/102915
//$field_key = "field_XXXXXX";// the acf field key unic numbers
$field_key = $field_key['key'];
$fields = get_field_object($field_key);
if( $fields )
{
// check for values in url
foreach( $GLOBALS['my_query_filters'] as $key => $fieldname ):
// set value if available
if( isset($_GET[ $fieldname ]) ) {
$filteredvalues['value'] = explode(',', $_GET[ $fieldname ]);
};
// construct the checkboxes
if( $fieldname == $fields['name']) {
echo '<nav id="fund-filter" class="ofisuport-filter ' . $fields['name'] . '">' ;
echo '<h5>' . $fields['label'] . '</h5>';
echo '<ul>';
foreach( $fields['choices'] as $choicevalue => $choicelabel ) {
echo '<li>';
echo '<input type="checkbox" ';
echo ' value="' . $choicevalue . '" ';
if( in_array($choicevalue,$filteredvalues['value']) ):
echo ' checked="checked" ';
endif;
echo ' />';
echo $choicelabel;
echo '</li>';
}
echo '</ul>';
echo '</nav>';
};
// end of construct checkboxes
endforeach;
// end check for values in url
}
};//end if type checkbox
};//end foreach groupkey field
};//end if groupkey
?>
<?php //endforeach; ?>
</div>
</aside>
<content class="archive-posts <?php ofisuport_class_posttype(); ?>">
<?php if ( have_posts() ) : ?>
<?php while ( have_posts() ) : the_post();
get_template_part( 'template-parts/section', 'eachpost' );
endwhile;
else :
get_template_part( 'template-parts/content', 'none' );
endif;
?>
</content>
</section>
</main><!-- #main -->
<?php
get_footer();

View File

@ -1,6 +1,6 @@
<?php
/**
* The template for displaying archive custom post type ajut
* The template for displaying archive custom post type ofisuport-ajut
*
* @link https://developer.wordpress.org/themes/basics/template-hierarchy/
*
@ -12,11 +12,11 @@ get_header();
<main id="primary" class="site-main">
<?php
// Detect plugin. For use on Front End only.
// Detect plugin. For use on Front End only.
include_once( ABSPATH . 'wp-admin/includes/plugin.php' );
// check for plugin using plugin name
// check for plugin using plugin name
if ( is_plugin_active( 'oficinasuport-wp-plugin/ofisuport-wp-plugin.php' ) ) {
//plugin is activated do
//plugin is activated do
?>
<section id="filteredfunds" class="ofisuport-filtered-funds ofisuport-ajuts-filtrats">

View File

@ -14,12 +14,12 @@
<footer id="colophon" class="site-footer">
<div class="site-info">
<?php dynamic_sidebar( 'footer' ); ?>
<!--a href="<?php //echo esc_url( __( 'https://wordpress.org/', 'ofisuport' ) ); ?>">
<?php //echo '<a href="' . esc_url( __( 'https://wordpress.org/', 'ofisuport' ) ) . '">'; ?>
<?php
/* translators: %s: CMS name, i.e. WordPress. */
//printf( esc_html__( 'Proudly powered by %s', 'ofisuport' ), 'WordPress' );
?>
</a-->
<?php //echo '</a>'; ?>
<!--span class="sep"></span-->
<?php
/* translators: 1: Theme name, 2: Theme author. */

View File

@ -9,7 +9,7 @@
if ( ! defined( '_S_VERSION' ) ) {
// Replace the version number of the theme on each release.
define( '_S_VERSION', '1.0.0' );
define( '_S_VERSION', '1.0.1' );
}
/**
@ -128,7 +128,10 @@ require get_template_directory() . '/inc/widgets-register.php';
* Enqueue scripts and styles.
*/
function ofisuport_scripts() {
wp_enqueue_style( 'ofisuport-style', get_stylesheet_uri(), array(), _S_VERSION );
//wp_enqueue_style( 'ofisuport-style', get_stylesheet_uri(), array(), _S_VERSION );
//https://developer.wordpress.org/reference/functions/wp_enqueue_style/#comment-2056
//wp_enqueue_style('main-styles', get_template_directory_uri() . '/css/style.css', array(), filemtime(get_template_directory() . '/css/style.css'), false);
wp_enqueue_style( 'ofisuport-style', get_stylesheet_uri(), array(), filetime(get_stylesheet_uri() . 'style.css', false);
wp_style_add_data( 'ofisuport-style', 'rtl', 'replace' );
wp_enqueue_script( 'ofisuport-navigation', get_template_directory_uri() . '/js/navigation.js', array(), _S_VERSION, true );

View File

@ -1,22 +1,22 @@
/*
Theme Name: Oficina de Suport theme
Theme URI: http://underscores.me/
Author: jorge-vitrubio.net
Author URI: https://vitrubio.net
Description: theme for the Oficina de Suport de Xarxaprod.cat
Version: 1.0.0
Tested up to: 5.4
Theme Name: Espai Assessorament - XarxaProd.cat
Theme URI: https://git.hangar.org/xarxaprod/
Author: Hangar.org Tech Lab - hangar.org
Author URI: https://hangar.org
Description: theme for the Espai d'assessorament, projecte oficina de suport de <a href="https://xarxaprod.cat">XarxaProd</a>. Inclou la possibilitat de publicar, catalogar i cercar ajuts, resoldre dubtes amb FAQs i altres. Design by Eudald Van der Pla <a href="https://vanderpla.com">vanderpla.com</a>. Coding template and theme by <a href="https://vitrubio.net">Jorge - vitrubio.net</a>
Version: 1.0.2
Tested up to: 6.2
Requires PHP: 5.6
License: GNU General Public License v2 or later
License URI: LICENSE
License: GNU General Public License v3 or later
License URI: https://www.gnu.org/licenses/gpl-3.0.html
Text Domain: ofisuport
Tags: custom-background, custom-logo, custom-menu, featured-images, threaded-comments, translation-ready
Tags: custom-logo, custom-menu, search,custom post-type, translation-ready
This theme, like WordPress, is licensed under the GPL.
Use it to make something cool, have fun, and share what you've learned.
Oficina de Suport theme is based on Underscores https://underscores.me/, (C) 2012-2020 Automattic, Inc.
Epai d'Assessorament, projecte oficina de suport de la XarxaProd.cat theme is based on Underscores https://underscores.me/, (C) 2012-2020 Automattic, Inc.
Underscores is distributed under the terms of the GNU GPL v2 or later.
Normalizing styles have been helped along thanks to the fine work of

View File

@ -18,17 +18,6 @@ get_header();
get_template_part( 'template-parts/content', get_post_type() );
//the_post_navigation(
// array(
// 'prev_text' => '<span class="nav-subtitle">' . esc_html__( 'Anterior:', 'ofisuport' ) . '</span> <span class="nav-title">%title</span>',
// 'next_text' => '<span class="nav-subtitle">' . esc_html__( 'Següent:', 'ofisuport' ) . '</span> <span class="nav-title">%title</span>',
// )
//);
// If comments are open or we have at least one comment, load up the comment template.
//if ( comments_open() || get_comments_number() ) :
// comments_template();
//endif;
endwhile; // End of the loop.
?>

447
style.css

File diff suppressed because it is too large Load Diff