Theme Name: Universal Theme
Description: A simple and versatile WordPress theme.
Tags: Blog, Portfolio, custom-background, custom-colors, custom-logo, custom-menu, editor-style, featured-images, footer-widgets, full-width-template, post-formats
Author: DJABHipHop
Version: 1.0
Tested up to: 5.0
Requires PHP: 7.x
License: GNU General Public License v2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html
Text Domain: universal-theme
I can post the code needed, the php is fine but the css is a bit of a mess im a bit resty.
]]>I want to contribute to this plugin. Is there any git repository? or Any other way to contribute?
Thanks
]]>The goal of the plugin would be to take user inputs from the settings page, then show them based on the screen width on a wordpress post or widget with the use of a shortcode.
I read through the documentation and I’ve been able to upload and activate my plugin without errors, however when I go to use the shortcode the banners aren’t displayed, only the shortcode text.
I’m not really sure how to troubleshoot the issue, and despite searching I can’t seem to find help so I thought I would make a post. My plugin file is on pastebin if anyone has the time to review it for me.
]]>although I am using the Page Restrict plugin (2.2.0), it does not matter if I use “All” as restriction method (in the plugin settings) or “Selected” and simply select the pages I want to restrict.
If I use “All” or “Selected” and make sure that the page “Foo Bar” is selected, but I made a custom page page-foo-bar.php
in my themes-folder, apparently the settings for Page Restrict will be ignored.
Is this expected behaviour? Even though I make sure that the custom page uses <div class="content">...</div>
?
Currently I solved the issue by adding the following code at the top of each custom page:
<?php
if (!is_user_logged_in())
{
header("Location: ".get_bloginfo('url'));
exit;
}
?>
As such, any time a not-loggedin user will be redirected to the root of my WordPress-site where the login form will be shown.
Is this a correct way of solving this issue, of am I mis-using the plugin?
Thank you, kind greetings and best Christmas-wishes,
Wim
https://www.ads-software.com/plugins/pagerestrict/
]]>The blankslate theme that I downloaded did not offer as much as I would have preferred in terms of easy customization. Took a lot of hacking to get smaller things to do exactly what I wanted, and basically figured I would be better off doing it from scratch.
Problem is that I am not quite sure if my substitution would cause any problems? Or if it is even considered good practice?
I set up the archive loop as follows, and was wondering if there is anything that I am missing (such as an already built-in wordpress function)
But basically takes the URL structure for the Archive page that you land on, dissects it, divides it up into year/month/day and then applies a date_query based on it.
Is the following “okay” to use in terms of efficiency and would it be considered an acceptable template?
THE FUNCTION THAT “SLICES” THE URL
global $req_year, $req_month, $req_day;
$current_link = "https://$_SERVER[HTTP_HOST]$_SERVER[REQUEST_URI]";
$site_url = site_url();
$site_url_length = strlen($site_url);
$current_link = substr($current_link, $site_url_length);
$current_link = substr($current_link, 1);
/*----------------------
--Remove the End Slash--
----------------------*/
$current_link = substr($current_link, 0, -1);
$current_link_length = strlen($current_link);
/*-------------------------------------------------------------------------
--Cut up the Current URL that wordpress sets up into Year -> Month -> day--
--When URL Structure = YEAR/MONTH/DAY--------------------------------------
-------------------------------------------------------------------------*/
$req_year = substr($current_link, 0, 4);
$req_month = substr($current_link, 5, 2);
$req_day = substr($current_link, 8, 2);
THE TEMPLATE PART
<div class="mpostfeed <?php echo $req_year.'-'.$req_month.'-'.$req_day;?>-archives archive-template" >
<header class="header">
<h1 class="mp-main-title"><?php
if ( is_day() ) { printf( __( 'Daily Archives: %s', 'Evyr2014' ), get_the_time(get_option('date_format') ) ); }
elseif ( is_month() ) { printf( __( 'Monthly Archives: %s', 'Evyr2014' ), get_the_time('F Y') ); }
elseif ( is_year() ) { printf( __( 'Yearly Archives: %s', 'Evyr2014' ), get_the_time('Y') ); }
else { _e( 'Archives', 'Evyr2014' ); }
?></h1>
</header>
<ul>
<?php
/*--------------------------------------------------------------------
--Set up the arguments for the query, including the paginated aspect--
--------------------------------------------------------------------*/
$paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
evyr2014_date_from_url();
global $req_day, $req_month, $req_year, $the_query;
if($req_day & $req_month & $req_year){
$args = array(
'post_type' => 'post',
'cat' => '-14',
'date_query' => array(
array(
'day' => $req_day,
'year' => $req_year,
'month'=> $req_month,
)
),
'posts_per_page' => 10,
'paged' => $paged
);
}elseif(empty($req_day)){
$args = array(
'post_type' => 'post',
'cat' => '-14',
'date_query' => array(
array(
'year' => $req_year,
'month'=> $req_month,
)
),
'posts_per_page' => 10,
'paged' => $paged
);
}else{
$args = array(
'post_type' => 'post',
'cat' => '-14',
'date_query' => array(
array(
'month'=> $req_month,
)
),
'posts_per_page' => 10,
'paged' => $paged
);
}
/*-------------------------------------------------
--Retrieve the query based on the above arguments--
-------------------------------------------------*/
$the_query = new WP_Query( $args );
if ( $the_query->have_posts() ) :
while ( $the_query->have_posts() ) : $the_query->the_post();
/*---------------------
--Begin the post item--
---------------------*/
?>
<li class="post-item">
<a href="<?php echo the_permalink();?>">
<span class="featured-bg">
<?php
if ( has_post_thumbnail() ) { // check if the post has a Post Thumbnail assigned to it.
the_post_thumbnail();
}else{ ?>
<span class="fp-holder"></span>
<?php }
?>
</span>
</a>
<a href="<?php echo get_permalink();?>" class="mp-title"><?php the_title();?></a>
<span class="mp-excerpt"><?php the_excerpt();?></span>
<span class="mp-panel">
<span class="mp-date">
<?php
/*--------------------------------------------------
--Sets up the Date in [Month] [Day], [Year] Format--
--------------------------------------------------*/
the_time('F d, Y');
?>
</span>
<span class="mp-postcount">
<?php
/*--Retrieve the post view count for the designated post--*/
echo getPostViews(get_the_ID());
?>
</span>
<a href="<?php echo get_permalink();?>" class="mp-readmore">Read More</a>
<span class="divider"></span>
</span>
</li><!--/.post-item-->
<?php
?>
<?php endwhile; ?>
</ul>
<?php
get_template_part('assets/parts/feed', 'pagination');
/*---------------------------------
--Reset the arguments and query,---
--So that multiple queries may be--
--set up in a template-------------
---------------------------------*/
wp_reset_postdata(); ?>
<?php else:
//Do Nothing
endif; ?>
</div>
I apologize for any unnecessary word wrapping in the code caused by the browser and forum formatting…left the indents so that you guys could just select all and then paste into your text editor to be able to read it better.
Thank you in advance for any support that you are able to toss my way.
]]>On the DevOps side, I’m working on a CI project where I wish to deploy and configure a WordPress engine from a unique Makefile.
I so added support for your Polylang plug-in to WP-CLI:
* WP-CLI support: https://github.com/dereckson/polylang/compare/feature%2Fapi…feature%2Fcli?expand=1
* API new methods for this support: https://github.com/dereckson/polylang/compare/feature;api?expand=1
The goal is to be able to add languages with the default configuration with commands like:
wp polylang language add en
wp polylang language add nl
wp polylang language add fr
This is my work in progress of my afternoon work, for comments and code review.
I’m soon intending to offer a more formal patch, when the language delete command.
Are you interested to implement this CLI support in your plugin?
https://www.ads-software.com/plugins/polylang/
]]>Firstly, no permission check is performed on the new page, just when outputting links. This isn’t secure enough, as just about anyone who knows the plugin is installed can manually enter the link and then rename an administrator. This needs another current_user_can('edit_users')
check.
Secondly, because the author did not consistently use $wpdb->prepare()
for his SQL there are several SQL injection vulnerabilities. I don’t advise ever using esc_attr() on database input in place of proper SQL escaping; it can conceivably be bypassed. Anywhere that the plugin uses the $_REQUEST['id']
parameter the input is appended unfiltered to the end of a query. So just displaying the page you could essentially reset the password of an administrator to something you know, or perhaps all users, for just one example.
If you are the author of this plugin: I’ve taken the time to secure this plugin for a project and have sanitized all SQL statements. I made a few tweaks for the sake of this project that you needn’t carry over, but the security check and the SQL protection you really should carry over. You can download and compare my changes here. And if you incorporate my changes, please list me as a contributor: “Robert Kosek, Wood Street Inc”.
https://www.ads-software.com/extend/plugins/username-changer/
]]>We (the Portland WordPress Meetup) hosted a code review night last fall for our developer meetup with mixed success. Prior to the evening, everyone wanted us to do a code review meetup. It was like pulling teeth trying to get people to submit their code though, and we only reviewed a few the day of. Furthermore, we tried to do reviews live, which was time-consuming, had slow spots, and probably wasn’t the best idea.
]]>Can anyone help me find the leak?
It might have something to do with how I am using the GLOBAL variables:
[Huge chunk of code moderated as per the Forum Rules. Please use the pastebin]
]]>I really don’t know if it is the good place to post this question, so do not hesitate to remove, move or just let it live just right here.
I was wondering how to get a pages menu in which you can display the sub pages only if the current post is a part of the top parent family branch.
for exemple if I have that kind of websites pages :
|- graphic
| |- print
| |- web
|- dev
| |-front
| |-back
|…
Yes, it is a peace of crap example, but that is not the point.
Let’s say that I wish to display submenu elements in the same ul hierarchical menu.
I do not want them to be displayed separatly with a ul main navigation and later a separated ul subnavigation.
All the roots menu elements has to be displayed by default, but I want to display the sub elements only if the current page is a part of the current family branch.
for example, if I’m in the “graphic” page, the submenu of graphic will be displayed, but not the submenu of the “dev” page.
If the current page is the “front” page, the submenu of the dev submenu elements will be displayed, but not the submenu of the “graphic” page.
I’m just a noob, so I did not figure “how to” do it with the wp_list_pages() template function.
So here is what I did :
// to display website navigation
function globalnav(){
//niv1 menu
// to get array of the roots menu pages
$pagesNiv1=get_pages("sort_column=menu_order&parent=0");
$menu.=set_menu_recusion($pagesNiv1, 0);
return $menu;
}
// recursive menu
function set_menu_recusion($arrayToParse, $lvl){
//$arrayToParse = element to recurse
//$lvl = current level of navigation
global $wp_query;
$post=$wp_query->post; //get current post datas
$menu='';
//if at least on element in the array
if(count($arrayToParse)>0){
//set ul tag with proper className and id for the root element
$menu.='<ul class="menuNiv'.$lvl.'"'.($lvl===0 ? ' id="menu"' : '').'>';
// loop the array
for($i=0; $i<count($arrayToParse); $i++) {
$menu .= '<li>';
// set if we need a a tag or if the page is the current one
$menu .= (($post->ID == $arrayToParse[$i]->ID) ? '<span>' : '<a href="'.get_page_link($arrayToParse[$i]->ID).'">');
$menu .= $arrayToParse[$i]->post_title;
$menu .= (($post->ID == $arrayToParse[$i]->ID) ? '</span>' : '</a>');
//get the children pages of the current iterated page
$nivInf=get_pages("sort_column=menu_order&child_of=".$arrayToParse[$i]->ID);
//if there is sub-pages and if the top parent page id of the current
//iterated page is the same than the top parent page id of the
//current page called by user
if(count($nivInf)>0 && (get_top_parent($arrayToParse[$i]) === get_top_parent($post)))
// set_menu_recusion, increase lvl
$menu.=set_menu_recusion($nivInf, ++$lvl);
$menu .= '</li>';
}
$menu.='</ul>';
}
return($menu);
}
// get the top parent
function get_top_parent($post){
if ($post->post_parent) {
$ancestors=get_post_ancestors($post->ID);
$root=count($ancestors)-1;
$parent = $ancestors[$root];
} else {
$parent = $post->ID;
}
return($parent);
}
Ok so, from now, it is working and it’s cool
i just need to call :
echo globalnav();
but, yes there is always a but
I got severals questions about the technics I did use to do it.
the first one, am I right to use this kind of code in the present context ?
global $wp_query;
$post=$wp_query->post; //get current post datas
Maybe it is not recommended or not secure, maybe there is a way to reset the global access of the $wp_query after, when I do not need it anymore ?
Maybe It is not recommended to do that way because it could remains performance latencies ?
My other question is : is it possible to do the same with wp_list_pages() template function ?
Thank you all in advance.
]]>