How to make a function in postgresql with two parameters to return count from column table?
This would work:
CREATE OR REPLACE FUNCTION yearly_orders(_year int, _order_cat int)
  RETURNS int
  LANGUAGE sql STABLE AS
$func$
SELECT count(*)::int
FROM   orders o
WHERE  o.status = 'Requested'
AND    o.creation &gt;= to_timestamp(_year::text, 'YYYY')
AND    o.creation &lt;  to_timestamp((_year + 1)::text, 'YYYY')
AND    o.code = _order_cat;
$func$;

The conversion from integer to timestamp really depends on what you pass exactly and what that's supposed to mean. You might want to_timestamp(_year::text, 'YY') instead ...
Consider the list in Akina's comment.
Start reading the manual about about SQL functions.
Have a look at PL/pgSQL functions after that.
Overview:

Difference between language sql and language plpgsql in PostgreSQL functions