Skip to content

Instantly share code, notes, and snippets.

View davidperezgar's full-sized avatar

David Perez davidperezgar

View GitHub Profile
<?php
$url = "http://{site_url}/service/v4_1/rest.php";
$username = "admin";
$password = "password";
//function to make cURL request
function call($method, $parameters, $url)
{
ob_start();
<?php
$url = "http://{site_url}/service/v4_1/rest.php";
$username = "admin";
$password = "password";
function call($method, $parameters, $url)
{
ob_start();
$curl_request = curl_init();
@davidperezgar
davidperezgar / relacionados-post2-posts.php
Created March 3, 2015 09:03
Posts 2 posts related with ID
$connected = new WP_Query( array(
'connected_type' => 'proyectos_a_sectores',
'connected_items' => get_post($post->post_parent),
'nopaging' => true,
) );
@davidperezgar
davidperezgar / htaccess-301-redirection
Created March 12, 2015 11:51
Redirection 301 htaccess
<IfModule mod_rewrite.c>
RewriteEngine On
redirectMatch 301 ^(.*)$ http://www.$1
</IfModule>
@davidperezgar
davidperezgar / footer.php
Created April 7, 2015 21:52
Placeholder for Wordpres login
@davidperezgar
davidperezgar / wp-config.php
Last active October 5, 2016 10:02
WP Config for Local Site
<?php
define('DB_NAME', '');
define('DB_USER', 'root');
define('DB_PASSWORD', 'root');
define('WP_HOME', 'http://.loc/');
define('WP_SITEURL', 'http://.loc/');
define('DB_HOST', 'localhost');
define('FS_METHOD','direct');
define('WP_DEBUG', true);
@davidperezgar
davidperezgar / script-wrapper
Created April 15, 2015 10:11
Javascript Wrapper for Wordpress
<script type="application/javascript">
(function ($) {
}(jQuery));
</script>
@davidperezgar
davidperezgar / how-to-use-posts-2-posts
Created April 15, 2015 20:44
Posts 2 posts functions for WordPress
<?php
//In functions .php
function my_connection_types() {
p2p_register_connection_type( array(
'name' => 'posts_to_pages',
'from' => 'post',
'to' => 'page'
) );
}
add_action( 'p2p_init', 'my_connection_types' );
@davidperezgar
davidperezgar / media-queries-bootstrap
Last active November 9, 2015 21:31
Media Query Bootstrap
/*Media Queries*/
@media only screen and (min-width: 801px) and (max-width: 980px) {
}
@media only screen
and (min-device-width : 768px)
and (max-device-width : 1024px)
and (orientation : portrait) {
}
@media only screen
@davidperezgar
davidperezgar / robots.txt
Last active August 8, 2016 11:45
Robots TXT for Wordpress
User-agent: *
Allow: /
Sitemap: http:///sitemap_index.xml
Disallow: /wp-admin/
Disallow: /?s=
Disallow: */?orderby=
Disallow: /search
Disallow: */feed/*
Disallow: /*?*